1. Fix to use ini for loading source element 77/49377/1
authorYeJin Cho <cho.yejin@samsung.com>
Fri, 4 Sep 2015 11:32:54 +0000 (20:32 +0900)
committerSangkyu Park <sk1122.park@samsung.com>
Mon, 12 Oct 2015 07:16:30 +0000 (16:16 +0900)
2. Check to set property after checking that property is found

Change-Id: Id8ab57eb8de9c867527c8124f938d6e8eace1b47
Signed-off-by: YeJin Cho <cho.yejin@samsung.com>
common/include/mm_wfd_sink_ini.h
common/mm_wfd_sink_ini.c
config/mmfw_wfd_sink.ini
packaging/libmm-wfd.spec
sink/mm_wfd_sink_priv.c

index 9e39dca..a3a1292 100755 (executable)
@@ -68,9 +68,10 @@ typedef struct __mm_wfd_sink_ini {
        gboolean enable_retransmission;
        gboolean enable_reset_basetime;
        gboolean enable_ts_data_dump;
-       gboolean enable_wfdrtspsrc_pad_probe;
+       gboolean enable_wfdsrc_pad_probe;
 
        /* pipeline */
+       gchar name_of_source[WFD_SINK_INI_MAX_STRLEN];
        gchar name_of_tsdemux[WFD_SINK_INI_MAX_STRLEN];
        gchar name_of_audio_hdcp[WFD_SINK_INI_MAX_STRLEN];
        gchar name_of_aac_parser[WFD_SINK_INI_MAX_STRLEN];
@@ -137,6 +138,7 @@ typedef struct __mm_wfd_sink_ini {
 #define DEFAULT_ENABLE_WFDRTSPSRC_PAD_PROBE FALSE
 
 /* Pipeline */
+#define DEFAULT_NAME_OF_SOURCE "wfdsrc"
 #define DEFAULT_NAME_OF_TSDEMUX ""
 #define DEFAULT_NAME_OF_AUDIO_HDCP ""
 #define DEFAULT_NAME_OF_AAC_PARSER ""
@@ -205,8 +207,8 @@ generate dot = no\n\
 ; enable pad probe\n\
 enable pad probe = no\n\
 \n\
-; enable wfdrtspsrc inner pad probe\n\
-enable wfdrtspsrc pad probe = no\n\
+; enable wfdsrc inner pad probe\n\
+enable wfdsrc pad probe = no\n\
 \n\
 ; enable ts data dump(/var/tmp/*.ts)\n\
 enable ts data dump = no\n\
@@ -214,13 +216,13 @@ enable ts data dump = no\n\
 ; allowed timeout for changing pipeline state\n\
 state change timeout = 5 ; sec\n\
 \n\
-; set debug property to wfdrtspsrc plugin for debugging rtsp message\n\
+; set debug property to wfdsrc plugin for debugging rtsp message\n\
 set debug property = yes\n\
 \n\
 ; for asm function enable = yes, disable = no\n\
 enable asm = no\n\
 \n\
-; 0: default value set by wfdrtspsrc element, other: user define value.\n\
+; 0: default value set by wfdsrc element, other: user define value.\n\
 jitter buffer latency=10\n\
 \n\
 ; for retransmission request enable = yes, disable = no\n\
@@ -244,6 +246,8 @@ video sink async=no\n\
 \n\
 \n\
 [pipeline]\n\
+wfdsrc element = wfdsrc\n\
+\n\
 tsdemux element = wfdtsdemux\n\
 \n\
 aac parser element = aacparse\n\
index c0951f1..d89b6c3 100755 (executable)
@@ -134,10 +134,11 @@ mm_wfd_sink_ini_load(mm_wfd_sink_ini_t *ini)
                ini->audio_sink_async = iniparser_getboolean(dict, "general:audio sink async", DEFAULT_AUDIO_SINK_ASYNC);
                ini->video_sink_async = iniparser_getboolean(dict, "general:video sink async", DEFAULT_VIDEO_SINK_ASYNC);
                ini->enable_ts_data_dump = iniparser_getboolean(dict, "general:enable ts data dump", DEFAULT_ENABLE_TS_DATA_DUMP);
-               ini->enable_wfdrtspsrc_pad_probe = iniparser_getboolean(dict, "general:enable wfdrtspsrc pad probe", DEFAULT_ENABLE_WFDRTSPSRC_PAD_PROBE);
+               ini->enable_wfdsrc_pad_probe = iniparser_getboolean(dict, "general:enable wfdsrc pad probe", DEFAULT_ENABLE_WFDRTSPSRC_PAD_PROBE);
 
 
                /* pipeline */
+               MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_source, "pipeline:wfdsrc element", DEFAULT_NAME_OF_SOURCE);
                MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_tsdemux, "pipeline:tsdemux element", DEFAULT_NAME_OF_TSDEMUX);
                MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_audio_hdcp, "pipeline:audio hdcp element", DEFAULT_NAME_OF_AUDIO_HDCP);
                MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_aac_parser, "pipeline:aac parser element", DEFAULT_NAME_OF_AAC_PARSER);
@@ -201,9 +202,10 @@ mm_wfd_sink_ini_load(mm_wfd_sink_ini_t *ini)
                ini->video_sink_max_lateness = DEFAULT_VIDEO_SINK_MAX_LATENESS;
                ini->sink_ts_offset = DEFAULT_SINK_TS_OFFSET;
                ini->enable_ts_data_dump = DEFAULT_ENABLE_TS_DATA_DUMP;
-               ini->enable_wfdrtspsrc_pad_probe = DEFAULT_ENABLE_WFDRTSPSRC_PAD_PROBE;
+               ini->enable_wfdsrc_pad_probe = DEFAULT_ENABLE_WFDRTSPSRC_PAD_PROBE;
 
                /* pipeline */
+               strncpy(ini->name_of_source, DEFAULT_NAME_OF_TSDEMUX, WFD_SINK_INI_MAX_STRLEN - 1);
                strncpy(ini->name_of_tsdemux, DEFAULT_NAME_OF_TSDEMUX, WFD_SINK_INI_MAX_STRLEN - 1);
                strncpy(ini->name_of_audio_hdcp, DEFAULT_NAME_OF_AUDIO_HDCP, WFD_SINK_INI_MAX_STRLEN - 1);
                strncpy(ini->name_of_aac_parser, DEFAULT_NAME_OF_AAC_PARSER, WFD_SINK_INI_MAX_STRLEN - 1);
@@ -279,9 +281,10 @@ mm_wfd_sink_ini_load(mm_wfd_sink_ini_t *ini)
        wfd_sink_debug("audio_sink_async : %d\n", ini->audio_sink_async);
        wfd_sink_debug("video_sink_async : %d\n", ini->video_sink_async);
        wfd_sink_debug("enable_ts_data_dump : %d\n", ini->enable_ts_data_dump);
-       wfd_sink_debug("enable_wfdrtspsrc_pad_probe : %d\n", ini->enable_wfdrtspsrc_pad_probe);
+       wfd_sink_debug("enable_wfdsrc_pad_probe : %d\n", ini->enable_wfdsrc_pad_probe);
 
        /* pipeline */
+       wfd_sink_debug("name_of_source : %s\n", ini->name_of_source);
        wfd_sink_debug("name_of_tsdemux : %s\n", ini->name_of_tsdemux);
        wfd_sink_debug("name_of_audio_hdcp : %s\n", ini->name_of_audio_hdcp);
        wfd_sink_debug("name_of_aac_parser : %s\n", ini->name_of_aac_parser);
index 0ba94e5..2526523 100755 (executable)
@@ -52,6 +52,8 @@ video sink async=no
 
 
 [pipeline]
+wfdsrc element = wfdsrc
+
 tsdemux element = wfdtsdemux
 
 aac parser element = aacparse
index 2a78fab..9527a30 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-wfd
 Summary:    Multimedia Framework Wifi-Display Library
-Version:    0.2.185
+Version:    0.2.186
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index ce4fe2e..8973fb8 100755 (executable)
@@ -255,7 +255,7 @@ int _mm_wfd_sink_connect(mm_wfd_sink_t *wfd_sink, const char *uri)
 
        wfd_sink_debug("try to connect to %s.....", GST_STR_NULL(uri));
 
-       /* set uri to wfdrtspsrc */
+       /* set uri to wfdsrc */
        g_object_set(G_OBJECT(wfd_sink->pipeline->mainbin[WFD_SINK_M_SRC].gst), "location", uri, NULL);
 
        /* set pipeline PAUSED state */
@@ -1713,7 +1713,7 @@ ERROR:
 }
 
 static void
-__mm_wfd_sink_change_av_format(GstElement *wfdrtspsrc, gpointer *need_to_flush, gpointer data)
+__mm_wfd_sink_change_av_format(GstElement *wfdsrc, gpointer *need_to_flush, gpointer data)
 {
        mm_wfd_sink_t *wfd_sink = (mm_wfd_sink_t *)data;
 
@@ -1736,7 +1736,7 @@ __mm_wfd_sink_change_av_format(GstElement *wfdrtspsrc, gpointer *need_to_flush,
 
 
 static void
-__mm_wfd_sink_update_stream_info(GstElement *wfdrtspsrc, GstStructure *str, gpointer data)
+__mm_wfd_sink_update_stream_info(GstElement *wfdsrc, GstStructure *str, gpointer data)
 {
        mm_wfd_sink_t *wfd_sink = (mm_wfd_sink_t *)data;
        MMWFDSinkStreamInfo *stream_info = NULL;
@@ -1834,7 +1834,7 @@ __mm_wfd_sink_update_stream_info(GstElement *wfdrtspsrc, GstStructure *str, gpoi
        wfd_sink_debug_fleave();
 }
 
-static int __mm_wfd_sink_prepare_wfdrtspsrc(mm_wfd_sink_t *wfd_sink, GstElement *wfdrtspsrc)
+static int __mm_wfd_sink_prepare_source(mm_wfd_sink_t *wfd_sink, GstElement *wfdsrc)
 {
        GstStructure *audio_param = NULL;
        GstStructure *video_param = NULL;
@@ -1844,18 +1844,24 @@ static int __mm_wfd_sink_prepare_wfdrtspsrc(mm_wfd_sink_t *wfd_sink, GstElement
        guint CEA_resolution = 0;
        guint VESA_resolution = 0;
        guint HH_resolution = 0;
+       GObjectClass *klass;
 
        wfd_sink_debug_fenter();
 
        wfd_sink_return_val_if_fail(wfd_sink, MM_ERROR_WFD_NOT_INITIALIZED);
        wfd_sink_return_val_if_fail(wfd_sink->attrs, MM_ERROR_WFD_NOT_INITIALIZED);
-       wfd_sink_return_val_if_fail(wfdrtspsrc, MM_ERROR_WFD_NOT_INITIALIZED);
+       wfd_sink_return_val_if_fail(wfdsrc, MM_ERROR_WFD_NOT_INITIALIZED);
 
-       g_object_set(G_OBJECT(wfdrtspsrc), "debug", wfd_sink->ini.set_debug_property, NULL);
-       g_object_set(G_OBJECT(wfdrtspsrc), "latency", wfd_sink->ini.jitter_buffer_latency, NULL);
-       g_object_set(G_OBJECT(wfdrtspsrc), "do-request", wfd_sink->ini.enable_retransmission, NULL);
-       g_object_set(G_OBJECT(wfdrtspsrc), "enable-pad-probe", wfd_sink->ini.enable_wfdrtspsrc_pad_probe, NULL);
-       g_object_set(G_OBJECT(wfdrtspsrc), "udp-buffer-size", 2097152, NULL);
+       klass = G_OBJECT_GET_CLASS (G_OBJECT (wfdsrc));
+
+       g_object_set(G_OBJECT(wfdsrc), "debug", wfd_sink->ini.set_debug_property, NULL);
+       g_object_set(G_OBJECT(wfdsrc), "enable-pad-probe", wfd_sink->ini.enable_wfdsrc_pad_probe, NULL);
+       if (g_object_class_find_property (klass, "udp-buffer-size"))
+               g_object_set(G_OBJECT(wfdsrc), "udp-buffer-size", 2097152, NULL);
+       if (g_object_class_find_property (klass, "do-request"))
+               g_object_set(G_OBJECT(wfdsrc), "do-request", wfd_sink->ini.enable_retransmission, NULL);
+       if (g_object_class_find_property (klass, "latency"))
+               g_object_set(G_OBJECT(wfdsrc), "latency", wfd_sink->ini.jitter_buffer_latency, NULL);
 
        audio_param = gst_structure_new("audio_param",
                                        "audio_codec", G_TYPE_UINT, wfd_sink->ini.audio_codec,
@@ -1898,14 +1904,14 @@ static int __mm_wfd_sink_prepare_wfdrtspsrc(mm_wfd_sink_t *wfd_sink, GstElement
                                       "hdcp_port_no", G_TYPE_INT, hdcp_port,
                                       NULL);
 
-       g_object_set(G_OBJECT(wfdrtspsrc), "audio-param", audio_param, NULL);
-       g_object_set(G_OBJECT(wfdrtspsrc), "video-param", video_param, NULL);
-       g_object_set(G_OBJECT(wfdrtspsrc), "hdcp-param", hdcp_param, NULL);
+       g_object_set(G_OBJECT(wfdsrc), "audio-param", audio_param, NULL);
+       g_object_set(G_OBJECT(wfdsrc), "video-param", video_param, NULL);
+       g_object_set(G_OBJECT(wfdsrc), "hdcp-param", hdcp_param, NULL);
 
-       g_signal_connect(wfdrtspsrc, "update-media-info",
+       g_signal_connect(wfdsrc, "update-media-info",
                         G_CALLBACK(__mm_wfd_sink_update_stream_info), wfd_sink);
 
-       g_signal_connect(wfdrtspsrc, "change-av-format",
+       g_signal_connect(wfdsrc, "change-av-format",
                         G_CALLBACK(__mm_wfd_sink_change_av_format), wfd_sink);
 
        wfd_sink_debug_fleave();
@@ -1996,12 +2002,12 @@ static int __mm_wfd_sink_create_pipeline(mm_wfd_sink_t *wfd_sink)
                goto CREATE_ERROR;
        }
 
-       /* create wfdrtspsrc */
-       MMWFDSINK_CREATE_ELEMENT(mainbin, WFD_SINK_M_SRC, "wfdrtspsrc", "wfdsink_source", TRUE);
+       /* create wfdsrc */
+       MMWFDSINK_CREATE_ELEMENT(mainbin, WFD_SINK_M_SRC, wfd_sink->ini.name_of_source, "wfdsink_source", TRUE);
        MMWFDSINK_PAD_PROBE(wfd_sink, NULL, mainbin[WFD_SINK_M_SRC].gst,  "src");
        if (mainbin[WFD_SINK_M_SRC].gst) {
-               if (MM_ERROR_NONE != __mm_wfd_sink_prepare_wfdrtspsrc(wfd_sink, mainbin[WFD_SINK_M_SRC].gst)) {
-                       wfd_sink_error("failed to prepare wfdrtspsrc...");
+               if (MM_ERROR_NONE != __mm_wfd_sink_prepare_source(wfd_sink, mainbin[WFD_SINK_M_SRC].gst)) {
+                       wfd_sink_error("failed to prepare wfdsrc...");
                        goto CREATE_ERROR;
                }
        }