amfh265enc: Handle preset option
authorSeungha Yang <seungha@centricular.com>
Tue, 12 Apr 2022 16:46:34 +0000 (01:46 +0900)
committerSeungha Yang <seungha@centricular.com>
Tue, 12 Apr 2022 16:46:34 +0000 (01:46 +0900)
Add missing preset option handling

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2165>

subprojects/gst-plugins-bad/sys/amfcodec/gstamfh265enc.cpp

index e231e98..a31fca0 100644 (file)
@@ -669,6 +669,16 @@ gst_amf_h265_enc_set_format (GstAmfEncoder * encoder,
     goto error;
   }
 
+  if (self->preset > AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_UNKNOWN) {
+    result = comp->SetProperty (AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET,
+        (amf_int64) self->preset);
+    if (result != AMF_OK) {
+      GST_ERROR_OBJECT (self, "Failed to set quality preset, result %"
+          GST_AMF_RESULT_FORMAT, GST_AMF_RESULT_ARGS (result));
+      goto error;
+    }
+  }
+
   result = comp->SetProperty (AMF_VIDEO_ENCODER_HEVC_PROFILE,
       (amf_int64) AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN);
   if (result != AMF_OK) {