mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-09 08:55:33 +00:00
fdkaacenc: Add support for enabling afterburner
This is an additional quality parameter. In the default configuration this quality switch is deactivated because it would cause a workload increase which might be significant. If workload is not an issue in the application it can be recommended to activate this feature.
This commit is contained in:
parent
a63d8ee720
commit
734593ccab
3 changed files with 44 additions and 1 deletions
|
@ -16714,6 +16714,18 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"afterburner": {
|
||||||
|
"blurb": "Additional quality control parameter. Can cause workload increase.",
|
||||||
|
"conditionally-available": false,
|
||||||
|
"construct": false,
|
||||||
|
"construct-only": false,
|
||||||
|
"controllable": false,
|
||||||
|
"default": "false",
|
||||||
|
"mutable": "null",
|
||||||
|
"readable": true,
|
||||||
|
"type": "gboolean",
|
||||||
|
"writable": true
|
||||||
|
},
|
||||||
"bitrate": {
|
"bitrate": {
|
||||||
"blurb": "Target Audio Bitrate (0 = fixed value based on sample rate and channel count)",
|
"blurb": "Target Audio Bitrate (0 = fixed value based on sample rate and channel count)",
|
||||||
"conditionally-available": false,
|
"conditionally-available": false,
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
/* TODO:
|
/* TODO:
|
||||||
* - Add support for other AOT / profiles
|
* - Add support for other AOT / profiles
|
||||||
* - Expose more properties, e.g. afterburner and vbr
|
* - Expose more properties, e.g. vbr
|
||||||
* - Signal encoder delay
|
* - Signal encoder delay
|
||||||
* - LOAS / LATM support
|
* - LOAS / LATM support
|
||||||
*/
|
*/
|
||||||
|
@ -38,6 +38,7 @@
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
PROP_AFTERBURNER,
|
||||||
PROP_BITRATE
|
PROP_BITRATE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -109,6 +110,9 @@ gst_fdkaacenc_set_property (GObject * object, guint prop_id,
|
||||||
case PROP_BITRATE:
|
case PROP_BITRATE:
|
||||||
self->bitrate = g_value_get_int (value);
|
self->bitrate = g_value_get_int (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_AFTERBURNER:
|
||||||
|
self->afterburner = g_value_get_boolean (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -126,6 +130,9 @@ gst_fdkaacenc_get_property (GObject * object, guint prop_id,
|
||||||
case PROP_BITRATE:
|
case PROP_BITRATE:
|
||||||
g_value_set_int (value, self->bitrate);
|
g_value_set_int (value, self->bitrate);
|
||||||
break;
|
break;
|
||||||
|
case PROP_AFTERBURNER:
|
||||||
|
g_value_set_boolean (value, self->afterburner);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -427,6 +434,16 @@ gst_fdkaacenc_set_format (GstAudioEncoder * enc, GstAudioInfo * info)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (self->afterburner) {
|
||||||
|
if ((err =
|
||||||
|
aacEncoder_SetParam (self->enc, AACENC_AFTERBURNER,
|
||||||
|
1)) != AACENC_OK) {
|
||||||
|
GST_ERROR_OBJECT (self, "Could not enable afterburner: %d", err);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_INFO_OBJECT (self, "Afterburner enabled");
|
||||||
|
}
|
||||||
if ((err = aacEncEncode (self->enc, NULL, NULL, NULL, NULL)) != AACENC_OK) {
|
if ((err = aacEncEncode (self->enc, NULL, NULL, NULL, NULL)) != AACENC_OK) {
|
||||||
GST_ERROR_OBJECT (self, "Unable to initialize encoder: %d", err);
|
GST_ERROR_OBJECT (self, "Unable to initialize encoder: %d", err);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -613,6 +630,7 @@ gst_fdkaacenc_init (GstFdkAacEnc * self)
|
||||||
self->bitrate = DEFAULT_BITRATE;
|
self->bitrate = DEFAULT_BITRATE;
|
||||||
self->enc = NULL;
|
self->enc = NULL;
|
||||||
self->is_drained = TRUE;
|
self->is_drained = TRUE;
|
||||||
|
self->afterburner = FALSE;
|
||||||
|
|
||||||
gst_audio_encoder_set_drainable (GST_AUDIO_ENCODER (self), TRUE);
|
gst_audio_encoder_set_drainable (GST_AUDIO_ENCODER (self), TRUE);
|
||||||
}
|
}
|
||||||
|
@ -642,6 +660,17 @@ gst_fdkaacenc_class_init (GstFdkAacEncClass * klass)
|
||||||
0, G_MAXINT, DEFAULT_BITRATE,
|
0, G_MAXINT, DEFAULT_BITRATE,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstFdkAacEnc:afterburner:
|
||||||
|
*
|
||||||
|
* Afterburner - Quality Parameter.
|
||||||
|
*
|
||||||
|
* Since: 1.22
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (object_class, PROP_AFTERBURNER,
|
||||||
|
g_param_spec_boolean ("afterburner", "Afterburner - Quality Parameter",
|
||||||
|
"Additional quality control parameter. Can cause workload increase.",
|
||||||
|
FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
gst_element_class_add_static_pad_template (element_class, &sink_template);
|
gst_element_class_add_static_pad_template (element_class, &sink_template);
|
||||||
gst_element_class_add_static_pad_template (element_class, &src_template);
|
gst_element_class_add_static_pad_template (element_class, &src_template);
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,8 @@ struct _GstFdkAacEnc {
|
||||||
gboolean need_reorder;
|
gboolean need_reorder;
|
||||||
const GstAudioChannelPosition *aac_positions;
|
const GstAudioChannelPosition *aac_positions;
|
||||||
gboolean is_drained;
|
gboolean is_drained;
|
||||||
|
|
||||||
|
gboolean afterburner;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstFdkAacEncClass {
|
struct _GstFdkAacEncClass {
|
||||||
|
|
Loading…
Reference in a new issue