Problem with multiple tees in pipeline
Nicolas Dufresne
nicolas.dufresne at collabora.com
Mon Jul 21 07:18:53 PDT 2014
Le lundi 21 juillet 2014 à 05:11 -0700, yoyosuper8 a écrit :
> videotestsrc ! videoconvert ! t name=t t.
> ! queue ! valve name=snapshot
> drop=true ! jpegenc ! filesink location=/sdcard/DCIM/pic1.jpg async=false t.
> ! queue ! eglglessink async=false
> name=videosink t.
>
> So, when I press on the button to do a snapshot, I change the drop property
> to "false" in the valve and the snapshot is taken. At the same time the
> video is being displayed on the videosink. A second later, I change the drop
> property back to "true" in the valve to prevent the pic file from being
> overwritten. At this point, the video stops displaying in the videosink. All
> I see now is a still image of the videotestsrc. I thought maybe it was
> because I have the t. at the end of the videosink branch, but that doesn't
> make a difference.
I must say, I'm not 100% sure, but one think I notice is that you want a
live pipeline. Set is-live=TRUE on videotestsrc. This you avoid having
to set async=false on eglglessink (if you move to 1.4, this is called
glimagesink now, be aware).
The problem with this approach is that you have no control over how many
buffers will go through the valve. I think a better approach would be to
have two independant pipeline:
videotestsrc ! videoconvert ! eglglessink enable-last-sample=1
And a second:
appsrc ! videoconvert ! jpegenc ! filesink location=...
Keep the first one playing and the second can simply be paused. When you
want a snapshot, simply do:
g_object_get (eglsink, "last-sample", &mysample, NULL);
This sample contains a buffers and caps. Set the caps on the appsrc, and
push the buffer, gst_app_src_push_buffer(). Finally, ensure the file is
written to disk, by pushing an EOS event.
This way you avoid potential race, and you have a simpler way for doing
preview and snapshot.
cheers,
Nicolas
More information about the gstreamer-devel
mailing list