Adds dot generation codes 97/233497/1
authorHyunsoo Park <hance.park@samsung.com>
Fri, 15 May 2020 05:30:25 +0000 (14:30 +0900)
committerHyunsoo Park <hance.park@samsung.com>
Fri, 15 May 2020 05:32:23 +0000 (14:32 +0900)
In case of 'generate dot' ini value is 'yes',
stream recorder would generate dot file.

Change-Id: I89bc3b1a4db3b349cbfc91621b65fb59ab973f57
Signed-off-by: Hyunsoo Park <hance.park@samsung.com>
packaging/libmm-streamrecorder.spec
src/include/mm_streamrecorder_ini.h
src/mm_streamrecorder_gstdispatch.c
src/mm_streamrecorder_ini.c

index 3c6bfc5..8badfa4 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-streamrecorder
 Summary:    Media Stream Recorder library
-Version:    0.0.31
+Version:    0.0.32
 Release:    0
 Group:      Multimedia/Other
 License:    Apache-2.0
index 74df497..eeb2919 100644 (file)
@@ -90,6 +90,8 @@ typedef struct __mm_streamrecorder_ini {
        gchar supported_video_encoders[STREAMRECORDER_ATTRIBUTE_NUM_MAX][STREAMRECORDER_INI_MAX_STRLEN];
        gchar supported_file_formats[STREAMRECORDER_ATTRIBUTE_NUM_MAX][STREAMRECORDER_INI_MAX_STRLEN];
 
+       /* debug */
+       gboolean generate_dot;
 } mm_streamrecorder_ini_t;
 
 /*Default sink ini values*/
@@ -137,6 +139,9 @@ typedef struct __mm_streamrecorder_ini {
 #define DEFAULT_SUPPORTED_VIDEO_ENCODERS ""
 #define DEFAULT_SUPPORTED_FILE_FORMATS ""
 
+/*debug*/
+#define DEFAULT_GENERATE_DOT FALSE
+
 int _mm_streamrecorder_ini_load(mm_streamrecorder_ini_t * ini);
 int _mm_streamrecorder_ini_unload(mm_streamrecorder_ini_t * ini);
 
index 8a0cf6a..042d793 100644 (file)
@@ -812,6 +812,13 @@ gboolean _mmstreamrecorder_pipeline_cb_message(GstBus *bus, GstMessage *message,
                                                vnewstate = (GValue *) gst_structure_get_value(gst_message_get_structure(message), "new-state");
                                                newstate = (GstState) vnewstate->data[0].v_int;
                                                _mmstreamrec_dbg_log("GST_MESSAGE_STATE_CHANGED[%s]", gst_element_state_get_name(newstate));
+                                               if (newstate == 4) {
+                                                       if (hstreamrecorder->ini.generate_dot) {
+                                                               _mmstreamrec_dbg_log("GST_MESSAGE_STATE_PLAYING! DOT would be generated.");
+                                                               g_setenv("GST_DEBUG_DUMP_DOT_DIR", "/tmp/", FALSE);
+                                                               GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst), GST_DEBUG_GRAPH_SHOW_ALL, "streamrecorder_pipeline");
+                                                       }
+                                               }
                                        }
                                }
                        }
index 9f6cce3..4eac503 100644 (file)
@@ -133,6 +133,9 @@ int _mm_streamrecorder_ini_load(mm_streamrecorder_ini_t *ini)
                __get_element_list(ini, iniparser_getstring(dict, "attribute:supported video encoders", (char*)DEFAULT_SUPPORTED_VIDEO_ENCODERS), KEYWORD_VIDEO_ENCODERS);
                __get_element_list(ini, iniparser_getstring(dict, "attribute:supported file formats", (char*)DEFAULT_SUPPORTED_FILE_FORMATS), KEYWORD_FILE_FORMATS);
 
+               /* debug */
+               ini->generate_dot = iniparser_getboolean(dict, "debug:generate dot", DEFAULT_GENERATE_DOT);
+
        } else {                                        /* if dict is not available just fill the structure with default value */
                _mmstreamrec_dbg_err("failed to load ini. using hardcoded default\n");
                /* general */
@@ -178,6 +181,9 @@ int _mm_streamrecorder_ini_load(mm_streamrecorder_ini_t *ini)
                __get_element_list(ini, (char *)DEFAULT_SUPPORTED_AUDIO_ENCODERS, KEYWORD_AUDIO_ENCODERS);
                __get_element_list(ini, (char *)DEFAULT_SUPPORTED_VIDEO_ENCODERS, KEYWORD_VIDEO_ENCODERS);
                __get_element_list(ini, (char *)DEFAULT_SUPPORTED_FILE_FORMATS, KEYWORD_FILE_FORMATS);
+
+               /* debug */
+               ini->generate_dot = DEFAULT_GENERATE_DOT;
        }
 
        /* free dict as we got our own structure */