mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-01 14:11:15 +00:00
va: basedec: Select the best format of the whole caps
The current way only selects the best video format from the first structure of the caps. The caps like: video/x-raw(memory:VAMemory),drm-format=(string)NV12; \ video/x-raw(memory:VAMemory),format=(string){ NV12, Y210 } Will just choose NV12 as the result, even the bitstream is 10 bits. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4928>
This commit is contained in:
parent
b9ecd4e618
commit
83e307ac96
1 changed files with 16 additions and 2 deletions
|
@ -798,6 +798,7 @@ _caps_video_format_from_chroma (GstCaps * caps, GstCapsFeatures * features,
|
||||||
GstCapsFeatures *feats;
|
GstCapsFeatures *feats;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
const GValue *format;
|
const GValue *format;
|
||||||
|
GstVideoFormat fmt, ret_fmt = GST_VIDEO_FORMAT_UNKNOWN;
|
||||||
|
|
||||||
num_structures = gst_caps_get_size (caps);
|
num_structures = gst_caps_get_size (caps);
|
||||||
for (i = 0; i < num_structures; i++) {
|
for (i = 0; i < num_structures; i++) {
|
||||||
|
@ -806,10 +807,23 @@ _caps_video_format_from_chroma (GstCaps * caps, GstCapsFeatures * features,
|
||||||
continue;
|
continue;
|
||||||
structure = gst_caps_get_structure (caps, i);
|
structure = gst_caps_get_structure (caps, i);
|
||||||
format = gst_structure_get_value (structure, "format");
|
format = gst_structure_get_value (structure, "format");
|
||||||
return _find_video_format_from_chroma (format, chroma_type);
|
|
||||||
|
fmt = _find_video_format_from_chroma (format, chroma_type);
|
||||||
|
if (fmt == GST_VIDEO_FORMAT_UNKNOWN)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Record the first valid format as the fallback if we can
|
||||||
|
not find a better one. */
|
||||||
|
if (ret_fmt == GST_VIDEO_FORMAT_UNKNOWN)
|
||||||
|
ret_fmt = fmt;
|
||||||
|
|
||||||
|
if (gst_va_chroma_from_video_format (fmt) == chroma_type) {
|
||||||
|
ret_fmt = fmt;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return GST_VIDEO_FORMAT_UNKNOWN;
|
return ret_fmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstVideoFormat
|
static GstVideoFormat
|
||||||
|
|
Loading…
Reference in a new issue