not as clever as I hoped :-(

Michael Gruner michael.gruner at ridgerun.com
Fri Aug 13 23:18:05 UTC 2021


Hey James

Your original snippets look good, however it’s hard to be more helpful without the full source. Here’s the same basic_tutorial12.c modified to send and EOS on SIGTERM.

Michael
www.ridgerun.com <http://www.ridgerun.com/>



> On 13 Aug 2021, at 03:58, James via gstreamer-devel <gstreamer-devel at lists.freedesktop.org> wrote:
> 
>> 
>> I took much of my stuff from basic_tutorial12.c so playing with it here:
>> 
>> when I run tutorial and send it SIGTERM the handler is immediatly invoked.
>> yet is never set
>> EOS is not sent (explicity, but happens)
>> 
>> If I let the clip play to the end then EOS message and yet is set.
>> 
>> What am I missing, in particular I want to send eos on SIGTERM
>> 
>> volatile int yet = 0;
>> GstElement *pipeline;
>> 
>> void handler (int signum)
>> {
>> g_print ("[handler function] send eos] %d\n", gst_element_send_event (pipeline, gst_event_new_eos ()));
>> while (!(yet)) {
>>    g_print ("%d\n", yet);
>>    g_usleep (100000);
>> }
>> g_print ("exit\n");
>> exit (0);
>> }
>> 
>> 
>> and
>> 
>> case GST_MESSAGE_EOS:
>>  /* end-of-stream */
>>  gst_element_set_state (data->pipeline, GST_STATE_READY);
>>  g_main_loop_quit (data->loop);
>> yet = 1;
>> g_print (“\nEOS\n");
>>  break;
>> 
>> 
>> In case it is interesting here are traces:
>> 
>> --------------------------------
>> tutorial run to end:
>> ————————————————
>> 
>> jam at ws101:~> ./basic
>> Buffering (100%)
>> EOS
>> 
>> ————————————————
>> tutorial gets SIGTERM
>> ————————————————
>> 
>> jam at ws101:~> ./basic
>> [handler function] send eos] 1
>> 0
>> 0
>> 0
>> forever
>> playback STOPS but yet is never set
> 
> 
> Can anybody help with a C eos please.
> 
> I have a sig handler (partly nicked from google)
> 
> void handler (int signum)
> {
>    g_print ("[handler function] send eos\n");
> 
>    //post EOS message to pipe line
>    gst_element_post_message (pipeline, gst_message_new_eos(GST_OBJECT(pipeline)));
>    //block until EOS is detected
>    gst_bus_timed_pop_filtered (gst_element_get_bus(pipeline),
>    GST_CLOCK_TIME_NONE, GST_MESSAGE_EOS);
>    g_print ("exit\n");
>    exit (0);
> }
> 
> 
> It definitly gets the signal
> 
> dvr at ws100:~> tail -f /var/log/dvr/gstreamer.log
> [handler function] send eos
> exit
> 
> but eos is not sent
> 
> dvr at ws100:~> ffprobe Channel1.13Aug2021.174559.mp4
> ffprobe version 4.4 Copyright (c) 2007-2021 the FFmpeg developers
>  built with gcc 7 (SUSE Linux)
>  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --enable-version3 --disable-openssl --enable-avresample --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcelt --enable-libcdio --enable-libdav1d --enable-libdc1394 --enable-libdrm --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libzvbi --enable-libmfx --enable-vaapi --enable-vdpau --enable-version3 --enable-libfdk-aac-dlopen --enable-nonfree --enable-libvo-amrwbenc --enable-libx264 --enable-libx265 --enable-librtmp --enable-libxvid
>  libavutil      56. 70.100 / 56. 70.100
>  libavcodec     58.134.100 / 58.134.100
>  libavformat    58. 76.100 / 58. 76.100
>  libavdevice    58. 13.100 / 58. 13.100
>  libavfilter     7.110.100 /  7.110.100
>  libavresample   4.  0.  0 /  4.  0.  0
>  libswscale      5.  9.100 /  5.  9.100
>  libswresample   3.  9.100 /  3.  9.100
>  libpostproc    55.  9.100 / 55.  9.100
> [mov,mp4,m4a,3gp,3g2,mj2 @ 0x561d9c630600] moov atom not found
> Channel1.13Aug2021.174559.mp4: Invalid data found when processing input
> 
> I’m rather stuck
> James

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210813/528c08e7/attachment-0002.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: basic_tutorial12.c
Type: application/octet-stream
Size: 3121 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210813/528c08e7/attachment-0001.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210813/528c08e7/attachment-0003.htm>


More information about the gstreamer-devel mailing list