Hi All,
i have a Gstreamer application to read H264 data from a fifo and decode+display. Problem i am facing is whenever i run the pipeline using gst-launch i am able to stop the pipeline with ctrl+c interrupt. But if i run the same pipeline using system () command from other application and sending kill -2 to gst-launch , pipeline is not stopping. this is my pipeline gst-launch-1.0 -e filesrc location=/tmp/test ! h264parse ! imxvpudec ! imxg2dvideosink framebuffer=/dev/fb1 i have converted this to c application and added a signal handler for SIGINT. in signal handler i sent the event gst_element_send_event(pipeline, gst_event_new_eos()); but the call never returns. Also tried to sent the event to filesrc element. It is also hanging. is there any way to stop the pipeline gracefully, any help is appreciated *With Best Regards* *Anjo John* VVDN Technologies Pvt Ltd *Cell : *+91 9539931442 | Skype :anjojohn051 _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
I suggest you store the pid when send system common. Besides please upload your c code. Regards, Stephen -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by anjojohn
I handle this with a named pipe Von meinem Samsung Galaxy Smartphone gesendet. -------- Ursprüngliche Nachricht -------- Von: Anjo John <[hidden email]> Datum: 06.03.18 08:13 (GMT+01:00) An: Discussion of the development of and with GStreamer <[hidden email]> Betreff: element send EOS event not returning Hi All,
i have a Gstreamer application to read H264 data from a fifo and decode+display. Problem i am facing is whenever i run the pipeline using gst-launch i am able to stop the pipeline with ctrl+c interrupt. But if i run the same pipeline using system () command from other application and sending kill -2 to gst-launch , pipeline is not stopping. this is my pipeline gst-launch-1.0 -e filesrc location=/tmp/test ! h264parse ! imxvpudec ! imxg2dvideosink framebuffer=/dev/fb1 i have converted this to c application and added a signal handler for SIGINT. in signal handler i sent the event gst_element_send_event(pipeline, gst_event_new_eos()); but the call never returns. Also tried to sent the event to filesrc element. It is also hanging. is there any way to stop the pipeline gracefully, any help is appreciated *With Best Regards* *Anjo John* VVDN Technologies Pvt Ltd *Cell : *+91 9539931442 | Skype :anjojohn051 _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi Bernhard, Would you please explain "I handle this with a named pipe". In my implementation , the /tmp/test is also a fifo. the filesrc element read from this fifo. But i am not able to send EOS even to pipeline or the filesrc element (call isn't returned ). I have tried ulinking and deleting this fifo, also tried with fdsrc instead of filesrc. All result in same behaviour. Would you tell me if i am doing anything wrong? the pipeline is stopping correctly when running in foreground. Only cause issues when run from other programs using system() command or making this as an application. On Tue, Mar 6, 2018 at 4:51 PM, bernhard.graaf <[hidden email]> wrote:
*With Best Regards* *Anjo John* VVDN Technologies Pvt Ltd *Cell : *+91 9539931442 | Skype :anjojohn051 _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Quit simple: Generate named pipe. Example Code from my
program: -------------- umask(0);
sprintf(np_name,"/home/bgraaf/wrk/bgl/bgl_np.%i", pid); if (mkfifo (np_name,
O_RDWR | 0666) < 0) { if ( errno == EEXIST)
printf("Versuche vorhandene Named Pipe '%s' zu verwenden\n",
np_name); else { perror("mkfifo()"); syslog(LOG_ERR, "Eigene Named
Pipe nicht erstellt --> Progammabbruch\n"); exit(EXIT_FAILURE); } } fd1 = open ( np_name,
O_RDONLY | O_NONBLOCK); if ( fd1 == -1) { sprintf(tmp_str,
"Konnte Named Pipe '%s' nicht öffnen\n", np_name); syslog(LOG_ERR, "%s\n",tmp_str); perror(tmp_str); exit(EXIT_FAILURE); } ---------------------- Include a timer f.e.: g_timeout_add
(500, (GSourceFunc)np, NULL); And add a function Example: int np(gpointer data) { char tmp_str[25]; if (read ( fd1,
tmp_str, 20) != 0) { printf("Stoppe
mp (got '%s')\n",tmp_str);
gst_element_send_event (dvb_pipe, gst_event_new_eos()); } return 1; } From another program you
can write what ever into the named pipe and the pipeline will close. Works fine in my app. Regards Bernhard Von:
gstreamer-devel [mailto:[hidden email]] Im Auftrag von Anjo John Hi Bernhard, Would you please explain "I handle this with a
named pipe". In my implementation , the /tmp/test is
also a fifo. the filesrc element read from this fifo. But i am not able to send
EOS even to pipeline or the filesrc element (call isn't returned ). I have
tried ulinking and deleting this fifo, also tried with fdsrc instead of
filesrc. All result in same behaviour. Would you tell me if i am doing anything
wrong? the pipeline is stopping correctly when running in foreground. Only
cause issues when run from other programs using system() command or making this
as an application. On Tue, Mar 6, 2018 at 4:51 PM, bernhard.graaf <[hidden email]>
wrote: I handle this with a named pipe Von meinem Samsung Galaxy Smartphone
gesendet. -------- Ursprüngliche Nachricht -------- Von: Anjo John <[hidden email]>
Datum: 06.03.18 08:13 (GMT+01:00) An: Betreff: element send EOS event not
returning Hi All, i have a Gstreamer application to read H264 data from a fifo and
decode+display. Problem i am facing is whenever i run the pipeline using
gst-launch i am able to stop the pipeline with ctrl+c interrupt. But if i run
the same pipeline using system () command from other application and sending
kill -2 to gst-launch , pipeline is not stopping. this is my pipeline gst-launch-1.0 -e filesrc location=/tmp/test ! h264parse ! imxvpudec !
imxg2dvideosink framebuffer=/dev/fb1 i have converted this to c application and added a signal handler for
SIGINT. in signal handler i sent the event gst_element_send_event( but the call never returns. Also tried to sent the event to filesrc
element. It is also hanging. is there any way to stop the pipeline gracefully, any help is
appreciated --
--
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by Stephenwei
Hi Stephenwei, 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 ) /* * program for decoding h264 data from baresip * and display using imxg2dvideosink plugin */ #include<stdio.h> #include<gst/gst.h> #include<signal.h> #include<stdlib.h> typedef struct { GstElement *pipeline; GstElement *source; GstElement *h264parser; GstElement *decoder; GstElement *display; GstBus *bus; GMainLoop *loop; } DisplayData; DisplayData Data; /*structure containing all elements*/ static gboolean bus_msg_hndler(GstBus *bus, GstMessage *msg, void *user_data); static int signal_handle_int(int data) { g_printf("Display pipeline-end\n"); gst_element_send_event(Data.pipeline, gst_event_new_eos()); return 0; } int main(int argc, char *argv[]) { FILE *fd; char buf[30]; char model[10]; char cmd[50]; guint bus_watch_id; /*gstreamer initialisation*/ gst_init(&argc, &argv); //signal(SIGINT, signal_handle_int); /*main loop*/ Data.loop = g_main_loop_new(NULL, FALSE); /*main pipeline*/ Data.pipeline = gst_pipeline_new("display_pipeline"); /*GstBus for video_main_pipeline*/ Data.bus = gst_pipeline_get_bus(Data.pipeline); bus_watch_id = gst_bus_add_watch(Data.bus, bus_msg_hndler, NULL); gst_object_unref(Data.bus); /*Create all elements*/ Data.source = gst_element_factory_make("filesrc", "file_source"); Data.h264parser = gst_element_factory_make("h264parse", "h264_parser"); Data.decoder = gst_element_factory_make("imxvpudec", "imxvpu_decoder"); Data.display = gst_element_factory_make("imxg2dvideosink", "g2d_videodisplay"); if (!Data.source || !Data.h264parser || !Data.decoder || !Data.display) { g_critical("gst_element_factory_make error"); gst_object_unref(Data.pipeline); g_main_loop_unref(Data.loop); return -1; } gst_bin_add_many(GST_BIN(Data.pipeline), Data.source, Data.h264parser, Data.decoder, Data.display, NULL); if (!gst_element_link_many(Data.source, Data.h264parser, Data.decoder, Data.display, NULL)) { g_critical("Unable to link elements\n"); return -1; } g_object_set(Data.source, "location", "/tmp/test", NULL); GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(Data.pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "display-pipeline"); gst_element_set_state(GST_ELEMENT(Data.pipeline), GST_STATE_PLAYING); g_main_loop_run(Data.loop); } static gboolean bus_msg_hndler(GstBus *bus, GstMessage *msg, void *user_data) { switch (GST_MESSAGE_TYPE(msg)) { case GST_MESSAGE_EOS: { g_main_loop_quit(Data.loop); gst_element_set_state(GST_ELEMENT(Data.pipeline), GST_STATE_NULL); gst_object_unref(GST_OBJECT(Data.pipeline)); g_main_loop_unref (Data.loop); break; } case GST_MESSAGE_ERROR: { GError *err; gst_message_parse_error(msg, &err, NULL); //report error g_print ("ERROR: %s", err->message); g_error_free(err); g_main_loop_quit(Data.loop); break; } case GST_MESSAGE_APPLICATION: { const GstStructure *str; str = gst_message_get_structure (msg); if (gst_structure_has_name(str,"turn_off")) { g_main_loop_quit(Data.loop); } break; } case GST_MESSAGE_STATE_CHANGED: { GstState old_state, pending_state, new_state; gst_message_parse_state_changed(msg, &old_state, &new_state, &pending_state); if(GST_OBJECT_NAME(msg->src) == GST_OBJECT_NAME(Data.pipeline)){ //show pipeline messages g_print("'%s' state changed from %s to %s. \n", GST_OBJECT_NAME(msg->src), gst_element_state_get_name(old_state), gst_element_state_get_name(new_state)); } break; } default: break; } return TRUE; } On Tue, Mar 6, 2018 at 3:45 PM, Stephenwei <[hidden email]> wrote: Hi, *With Best Regards* *Anjo John* VVDN Technologies Pvt Ltd *Cell : *+91 9539931442 | Skype :anjojohn051 _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by BGraaf
Hi Bernhard,
Currently i am using the filesrc element. It reads the buffers it self. Doing some more debugging shows that the filesrc element is in PAUSE state when the fifo is empty. Instead of going for EOS , filesrc element waits. i believe this is the reason filesrc not changing to READY or NULL state. I will check your solution with appsrc element , which i will read from the fio and push to the appsrc element. On Tue, Mar 6, 2018 at 6:57 PM, Bernhard Graaf <[hidden email]> wrote:
*With Best Regards* *Anjo John* VVDN Technologies Pvt Ltd *Cell : *+91 9539931442 | Skype :anjojohn051 _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi Bernhard, Issue got fixed. i used fdsrc instead of filesrc. the fd pointer for fdsrc was opened in NON-BLOCKING mode. mkfifo("/tmp/test", 0666); fp = open("/tmp/test", O_RDONLY | O_NONBLOCK); if (fp == NULL) { fprintf(stderr, "/tmp/test fifo create error\n"); } g_object_set(Data.source, "fd", fp, NULL); Thank you for the suggestion. On Wed, Mar 7, 2018 at 8:49 AM, Anjo John <[hidden email]> wrote:
*With Best Regards* *Anjo John* VVDN Technologies Pvt Ltd *Cell : *+91 9539931442 | Skype :anjojohn051 _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |