libcamera: Use PixelFormat instead of unsigned int where appropriate

Use the PixelFormat instead of unsigned int where a pixel format is to
be used. PixelFormat is defined as an unsigned int but is about to be
turned into a class to add functionality.

There is no functional change in this patch.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Niklas Söderlund 2020-02-28 02:38:18 +01:00
parent 9a1e71b8a1
commit f28ca20960
10 changed files with 22 additions and 18 deletions

View file

@ -79,16 +79,16 @@ gst_libcamera_stream_formats_to_caps(const StreamFormats &formats)
{
GstCaps *caps = gst_caps_new_empty();
for (unsigned int fourcc : formats.pixelformats()) {
g_autoptr(GstStructure) bare_s = bare_structure_from_fourcc(fourcc);
for (PixelFormat pixelformat : formats.pixelformats()) {
g_autoptr(GstStructure) bare_s = bare_structure_from_fourcc(pixelformat);
if (!bare_s) {
GST_WARNING("Unsupported DRM format %" GST_FOURCC_FORMAT,
GST_FOURCC_ARGS(fourcc));
GST_FOURCC_ARGS(pixelformat));
continue;
}
for (const Size &size : formats.sizes(fourcc)) {
for (const Size &size : formats.sizes(pixelformat)) {
GstStructure *s = gst_structure_copy(bare_s);
gst_structure_set(s,
"width", G_TYPE_INT, size.width,
@ -97,7 +97,7 @@ gst_libcamera_stream_formats_to_caps(const StreamFormats &formats)
gst_caps_append_structure(caps, s);
}
const SizeRange &range = formats.range(fourcc);
const SizeRange &range = formats.range(pixelformat);
if (range.hStep && range.vStep) {
GstStructure *s = gst_structure_copy(bare_s);
GValue val = G_VALUE_INIT;