In snapshot mode pngenc should output exactly one frame
and then return FLOW_EOS to upstream. If upstream sends
more input frames before shutting down, it should keep
returning FLOW_EOS but not output any more encoded frames.
After a flushing seek it should output frames again though.
Fixes#3069.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5546>
Previously, we would create a new GstMemory per write operation
and then append them to the GstBuffer. This would cause a reallocation
every 16 Memories which is an issue since the png encoder will usually
do write in a pattern of 4, 8 and 8k bytes repeating until the frame
is done.
Instead allocate a single GstMemory and keep writting it into it
with a manual index. Much like the jpegenc does.
Doing some basic testing With a testsrc snow pattern at 4k and 8k
the same pipeline would take ~3.30s to encode a 4k frame and ~23s
for an 8k. At 4k 0.70s/33% is taken by memory allocations, while at
8k its ~10.5s/45%.
With this patch, at 4k the pipeline takes ~2.40s and at 8k only 9.60s
making this 28% and 58% faster accordingly on my laptop, and
allocation runtime is dropped to subsecond times.
Here's the test pipeline used, increase num-buffers in image freeze
to gather more samples.
```
gst-launch-1.0 videotestsrc num-buffers=1 pattern=snow ! imagefreeze num-buffers=1 ! \
video/x-raw,width=7680,height=4320 ! pngenc ! fakesink
```
Close#2717
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4944>
Due to the alpha value being inserted with _BEFORE, we were ending up
with ARGB instead of RGBA, thus displaying completely wrong colours.
According to libpng's manual, "to add an opaque alpha channel, use filler=0xff
or 0xffff and PNG_FILLER_AFTER which will generate RGBA pixels".
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4756>
GLib guarantees libintl is always present, using proxy-libintl as
last resort. There is no need to mock gettex API any more.
This fix static build on Windows because G_INTL_STATIC_COMPILATION must
be defined before including libintl.h, and glib does it for us as part
as including glib.h.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2028>