jpegdec: Factor out gst_jpeg_turbo_parse_ext_fmt_convert()
authorMarek Vasut <marex@denx.de>
Fri, 11 Feb 2022 22:44:20 +0000 (23:44 +0100)
committerMarek Vasut <marex@denx.de>
Sun, 13 Feb 2022 13:46:31 +0000 (14:46 +0100)
commit4ee4a9bff96f2bc93796bfeadafe618fb6e5e94e
tree93def95efe0330d28f085baa00f7085e033e56a8
parent9a029f016d727d6cf57c324c725e1561cf49d510
jpegdec: Factor out gst_jpeg_turbo_parse_ext_fmt_convert()

Pull out peer caps checking code into gst_jpeg_turbo_parse_ext_fmt_convert().
This code is used by libjpeg-turbo extras to determine whether peer is capable
of handling buffers into which libjpeg-turbo can directly decode data. This
kind of check must be performed before jpeg_start_decompress() is called in
gst_jpeg_dec_prepare_decode() as well as in gst_jpeg_dec_negotiate(), hence
the common code.

This commit does modify the code a little to make it easier to call from both
call sites without much duplication, hence the extra `if (*clrspc)` test.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1687>
subprojects/gst-plugins-good/ext/jpeg/gstjpegdec.c