diff --git a/subprojects/gst-plugins-bad/sys/va/gstvaencoder.c b/subprojects/gst-plugins-bad/sys/va/gstvaencoder.c index 94f6f72eaf..19d96c138c 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvaencoder.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvaencoder.c @@ -756,31 +756,33 @@ gst_va_encoder_get_rtformat (GstVaEncoder * self, return attrib.value; } -guint32 +gboolean gst_va_encoder_get_packed_headers (GstVaEncoder * self, VAProfile profile, - VAEntrypoint entrypoint) + VAEntrypoint entrypoint, guint * packed_headers) { VAStatus status; VADisplay dpy; VAConfigAttrib attrib = {.type = VAConfigAttribEncPackedHeaders }; if (profile == VAProfileNone) - return 0; + return FALSE; dpy = gst_va_display_get_va_dpy (self->display); status = vaGetConfigAttributes (dpy, profile, entrypoint, &attrib, 1); if (status != VA_STATUS_SUCCESS) { GST_ERROR_OBJECT (self, "Failed to query packed headers: %s", vaErrorStr (status)); - return 0; + return FALSE; } if (attrib.value == VA_ATTRIB_NOT_SUPPORTED) { GST_WARNING_OBJECT (self, "Driver does not support any packed headers"); - return 0; + return FALSE; } - return attrib.value; + if (packed_headers) + *packed_headers = attrib.value; + return TRUE; } /* Add packed header such as SPS, PPS, SEI, etc. If adding slice header, diff --git a/subprojects/gst-plugins-bad/sys/va/gstvaencoder.h b/subprojects/gst-plugins-bad/sys/va/gstvaencoder.h index dd46fd9a0a..dad76309f6 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvaencoder.h +++ b/subprojects/gst-plugins-bad/sys/va/gstvaencoder.h @@ -80,9 +80,10 @@ gboolean gst_va_encoder_has_trellis (GstVaEncoder * self, guint32 gst_va_encoder_get_rtformat (GstVaEncoder * self, VAProfile profile, VAEntrypoint entrypoint); -guint32 gst_va_encoder_get_packed_headers (GstVaEncoder * self, +gboolean gst_va_encoder_get_packed_headers (GstVaEncoder * self, VAProfile profile, - VAEntrypoint entrypoint); + VAEntrypoint entrypoint, + guint32 * packed_headers); gboolean gst_va_encoder_get_rate_control_enum (GstVaEncoder * self, GEnumValue ratectl[16]); gboolean gst_va_encoder_add_param (GstVaEncoder * self, diff --git a/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c b/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c index 076bcab511..33dfc244ef 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c @@ -1258,10 +1258,8 @@ _init_packed_headers (GstVaH264Enc * self) self->packed_headers = 0; - packed_headers = gst_va_encoder_get_packed_headers (base->encoder, - base->profile, base->entrypoint); - - if (packed_headers == 0) + if (!gst_va_encoder_get_packed_headers (base->encoder, base->profile, + base->entrypoint, &packed_headers)) return FALSE; if (desired_packed_headers & ~packed_headers) {