<div dir="ltr">Hi Stephenwei,<div><br></div><div>i can get PID of the display pipeline, besides i use the killall -2 gst-launch-1.0 which will send the SIGINT to the pipeline. The pipeline is receiving the interrupt. But it is not exiting. Pipeline will exit if running in foreground and giving Ctrl+c. Below is the c application i use. Here /tmp/test is a fifo.(fifo made with mkfifo )</div><div><br></div><div><div>/*</div><div> * program for decoding h264 data from baresip</div><div> * and display using imxg2dvideosink plugin</div><div>*/</div><div><br></div><div>#include<stdio.h></div><div>#include<gst/gst.h></div><div>#include<signal.h></div><div>#include<stdlib.h></div><div><br></div><div>typedef struct {</div><div><br></div><div><span style="white-space:pre">   </span>GstElement *pipeline;</div><div><span style="white-space:pre"> </span>GstElement *source;</div><div><span style="white-space:pre">   </span>GstElement *h264parser;</div><div><span style="white-space:pre">       </span>GstElement *decoder;</div><div><span style="white-space:pre">  </span>GstElement *display;</div><div><span style="white-space:pre">  </span>GstBus *bus;</div><div><span style="white-space:pre">  </span>GMainLoop *loop;</div><div><br></div><div>} DisplayData;</div><div><br></div><div>DisplayData Data; /*structure containing all elements*/</div><div>static gboolean bus_msg_hndler(GstBus *bus, GstMessage *msg, void *user_data);</div><div>static int signal_handle_int(int data) {</div><div><span style="white-space:pre">     </span>g_printf("Display pipeline-end\n");</div><div><span style="white-space:pre"> </span>gst_element_send_event(Data.pipeline, gst_event_new_eos());</div><div><span style="white-space:pre">   </span>return 0;</div><div>}</div><div><br></div><div>int main(int argc, char *argv[])</div><div>{</div><div><span style="white-space:pre">     </span>FILE *fd;</div><div><span style="white-space:pre">     </span>char buf[30];</div><div><span style="white-space:pre"> </span>char model[10];</div><div><span style="white-space:pre">       </span>char cmd[50];</div><div><br></div><div><span style="white-space:pre">        </span>guint bus_watch_id;</div><div><br></div><div><br></div><div><span style="white-space:pre"> </span>/*gstreamer initialisation*/</div><div><span style="white-space:pre">  </span>gst_init(&argc, &argv);</div><div><span style="white-space:pre">       </span>//signal(SIGINT, signal_handle_int);</div><div><span style="white-space:pre">  </span>/*main loop*/</div><div><span style="white-space:pre"> </span>Data.loop = g_main_loop_new(NULL, FALSE);</div><div><span style="white-space:pre">     </span>/*main pipeline*/</div><div><span style="white-space:pre">     </span>Data.pipeline = gst_pipeline_new("display_pipeline");</div><div><span style="white-space:pre">       </span>/*GstBus for video_main_pipeline*/</div><div><span style="white-space:pre">    </span>Data.bus = gst_pipeline_get_bus(Data.pipeline);</div><div><span style="white-space:pre">       </span>bus_watch_id = gst_bus_add_watch(Data.bus, bus_msg_hndler, NULL);</div><div><span style="white-space:pre">     </span>gst_object_unref(Data.bus);</div><div><br></div><div><span style="white-space:pre">  </span>/*Create all elements*/</div><div><span style="white-space:pre">       </span>Data.source = gst_element_factory_make("filesrc", "file_source");</div><div><span style="white-space:pre"> </span>Data.h264parser = gst_element_factory_make("h264parse", "h264_parser");</div><div><span style="white-space:pre">   </span>Data.decoder = gst_element_factory_make("imxvpudec", "imxvpu_decoder");</div><div><span style="white-space:pre">   </span>Data.display = gst_element_factory_make("imxg2dvideosink", "g2d_videodisplay");</div><div><span style="white-space:pre">   </span>if (!Data.source || !Data.h264parser || !Data.decoder || !Data.display) {</div><div><span style="white-space:pre">             </span>g_critical("gst_element_factory_make error");</div><div><span style="white-space:pre">               </span>gst_object_unref(Data.pipeline);</div><div><span style="white-space:pre">              </span>g_main_loop_unref(Data.loop);</div><div><span style="white-space:pre">         </span>return -1;</div><div><span style="white-space:pre">    </span>}</div><div><span style="white-space:pre">     </span>gst_bin_add_many(GST_BIN(Data.pipeline), Data.source, Data.h264parser, Data.decoder, Data.display, NULL);</div><div><span style="white-space:pre">     </span>if (!gst_element_link_many(Data.source, Data.h264parser, Data.decoder, Data.display, NULL)) {</div><div><span style="white-space:pre">         </span>g_critical("Unable to link elements\n");</div><div><span style="white-space:pre">            </span>return -1;</div><div><span style="white-space:pre">    </span>}</div><div><span style="white-space:pre">     </span>g_object_set(Data.source, "location", "/tmp/test", NULL);</div><div><br></div><div><span style="white-space:pre">        </span>GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(Data.pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "display-pipeline");</div><div><span style="white-space:pre">    </span>gst_element_set_state(GST_ELEMENT(Data.pipeline), GST_STATE_PLAYING);</div><div><span style="white-space:pre"> </span>g_main_loop_run(Data.loop);</div><div>}</div><div>static gboolean bus_msg_hndler(GstBus *bus, GstMessage *msg, void *user_data)</div><div>{</div><div><span style="white-space:pre">       </span>switch (GST_MESSAGE_TYPE(msg))</div><div><span style="white-space:pre">        </span>{</div><div><span style="white-space:pre">             </span>case GST_MESSAGE_EOS:</div><div><span style="white-space:pre">                 </span>{</div><div><span style="white-space:pre">                             </span>g_main_loop_quit(Data.loop);</div><div><span style="white-space:pre">                          </span>gst_element_set_state(GST_ELEMENT(Data.pipeline), GST_STATE_NULL);</div><div><span style="white-space:pre">                            </span>gst_object_unref(GST_OBJECT(Data.pipeline));</div><div><span style="white-space:pre">                          </span>g_main_loop_unref (Data.loop);</div><div><span style="white-space:pre">                                </span>break;</div><div><span style="white-space:pre">                        </span>}</div><div><span style="white-space:pre">             </span>case GST_MESSAGE_ERROR:</div><div><span style="white-space:pre">                       </span>{</div><div><span style="white-space:pre">                             </span>GError *err;</div><div><span style="white-space:pre">                          </span>gst_message_parse_error(msg, &err, NULL);</div><div><span style="white-space:pre">                         </span>//report error</div><div><span style="white-space:pre">                                </span>g_print ("ERROR: %s", err->message);</div><div><span style="white-space:pre">                             </span>g_error_free(err);</div><div><span style="white-space:pre">                            </span>g_main_loop_quit(Data.loop);</div><div><span style="white-space:pre">                          </span>break;</div><div><span style="white-space:pre">                        </span>}</div><div><span style="white-space:pre">             </span>case GST_MESSAGE_APPLICATION:</div><div><span style="white-space:pre">                 </span>{</div><div><span style="white-space:pre">                             </span>const GstStructure *str;</div><div><span style="white-space:pre">                              </span>str = gst_message_get_structure (msg);</div><div><span style="white-space:pre">                                </span>if (gst_structure_has_name(str,"turn_off"))</div><div><span style="white-space:pre">                         </span>{</div><div><span style="white-space:pre">                                     </span>g_main_loop_quit(Data.loop);</div><div><span style="white-space:pre">                          </span>}</div><div><span style="white-space:pre">                             </span>break;</div><div><span style="white-space:pre">                        </span>}</div><div><span style="white-space:pre">             </span>case GST_MESSAGE_STATE_CHANGED:</div><div><span style="white-space:pre">                       </span>{</div><div><span style="white-space:pre">                             </span>GstState old_state, pending_state, new_state;</div><div><span style="white-space:pre">                         </span>gst_message_parse_state_changed(msg, &old_state, &new_state, &pending_state);</div><div><span style="white-space:pre">                             </span>if(GST_OBJECT_NAME(msg->src) == GST_OBJECT_NAME(Data.pipeline)){</div><div><span style="white-space:pre">                                   </span>//show  pipeline messages</div><div><span style="white-space:pre">                                    </span>g_print("'%s' state changed from %s to %s. \n", GST_OBJECT_NAME(msg->src),</div><div><span style="white-space:pre">                                                       </span>gst_element_state_get_name(old_state),</div><div><span style="white-space:pre">                                                        </span>gst_element_state_get_name(new_state));</div><div><span style="white-space:pre">                               </span>}</div><div><span style="white-space:pre">                             </span>break;</div><div><span style="white-space:pre">                        </span>}</div><div><span style="white-space:pre">             </span>default:</div><div><span style="white-space:pre">                      </span>break;</div><div><span style="white-space:pre">        </span>}</div><div><span style="white-space:pre">     </span>return TRUE;</div><div>}</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 6, 2018 at 3:45 PM, Stephenwei <span dir="ltr"><<a href="mailto:lofy.stephen@gmail.com" target="_blank">lofy.stephen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
I suggest you store the pid when send system common.<br>
Besides please upload your c code.<br>
<br>
Regards,<br>
Stephen<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://gstreamer-devel.966125.n4.nabble.com/" rel="noreferrer" target="_blank">http://gstreamer-devel.966125.<wbr>n4.nabble.com/</a><br>
<div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.<wbr>freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/gstreamer-<wbr>devel</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><br>*With Best Regards*<br><br><br>*Anjo John*<br><br>VVDN Technologies Pvt Ltd<br><br>*Cell : *+91 9539931442 | Skype :anjojohn051<br> <br><br></div>
</div>