diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2019-06-28 15:41:16 -0400 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2020-01-19 15:55:47 +0000 |
commit | 866a9f069d54b6cf55ca9c78a7f69e7c58193d5a (patch) | |
tree | d23568fc0d7f10f8930ee5e779786aebb75c7842 /gst-libs | |
parent | 73159cdc5d82484176e0fac9d410a4045c3856b5 (diff) |
vaapih264dec: Add a property to assume constrained-baseline
When baseline-as-constrained is set, the decoder will expose support
for baseline decoding and assume that the baseline content is
constrained-baseline. This can be handy to decode streams in hardware
that would otherwise not be possible to decode. A lot of baseline
content is in fact constrained.
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapidecoder_h264.c | 21 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapidecoder_h264.h | 4 |
2 files changed, 24 insertions, 1 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c index b20e7272..48f72d20 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c @@ -537,6 +537,7 @@ struct _GstVaapiDecoderH264Private gboolean force_low_latency; gboolean base_only; + gboolean baseline_as_constrained; }; /** @@ -1473,7 +1474,7 @@ get_profile (GstVaapiDecoderH264 * decoder, GstH264SPS * sps, guint dpb_size) fill_profiles (profiles, &n_profiles, profile); switch (profile) { case GST_VAAPI_PROFILE_H264_BASELINE: - if (sps->constraint_set1_flag) { // A.2.2 (main profile) + if (priv->baseline_as_constrained || sps->constraint_set1_flag) { // A.2.2 (main profile) fill_profiles (profiles, &n_profiles, GST_VAAPI_PROFILE_H264_CONSTRAINED_BASELINE); fill_profiles (profiles, &n_profiles, GST_VAAPI_PROFILE_H264_MAIN); @@ -4801,6 +4802,24 @@ gst_vaapi_decoder_h264_set_base_only (GstVaapiDecoderH264 * decoder, } /** + * gst_vaapi_decoder_h264_set_baseline_as_constrained: + * @decoder: a #GstVaapiDecoderH264 + * @baseline_as_constrained: %TRUE to assume all baseline is constrained + * + * This is a small hack that makes the decoder assumes that baseline contents + * is already constrained. This may allow decoding some streams that would + * otherwise fails to negotiation. + */ +void +gst_vaapi_decoder_h264_set_baseline_as_constrained (GstVaapiDecoderH264 * + decoder, gboolean baseline_as_constrained) +{ + g_return_if_fail (decoder != NULL); + + decoder->priv.baseline_as_constrained = baseline_as_constrained; +} + +/** * gst_vaapi_decoder_h264_set_low_latency: * @decoder: a #GstVaapiDecoderH264 * @force_low_latency: %TRUE if force low latency diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.h b/gst-libs/gst/vaapi/gstvaapidecoder_h264.h index 999e80b2..04386068 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.h @@ -73,6 +73,10 @@ void gst_vaapi_decoder_h264_set_base_only(GstVaapiDecoderH264 * decoder, gboolean base_only); +void +gst_vaapi_decoder_h264_set_baseline_as_constrained(GstVaapiDecoderH264 * decoder, + gboolean baseline_as_constrained); + G_END_DECLS #endif /* GST_VAAPI_DECODER_H264_H */ |