summaryrefslogtreecommitdiff
path: root/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2014-01-06 15:10:36 +0100
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2014-01-13 17:31:54 +0100
commita24c52e4d0b3d0c168b30939aae406879c6c6a94 (patch)
tree40fcd88481d33409390d4a6846a164b576e2d569 /gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c
parent076d75aeb89b2b7cc09a2297f8fa6ebecab6cf68 (diff)
downloadgst-vaapi-a24c52e4d0b3d0c168b30939aae406879c6c6a94.tar.gz
encoder: add rate control API.
Add gst_vaapi_encoder_set_rate_control() interface to request a new rate control mode for encoding. Changing the rate control mode is only valid prior to encoding the very first frame. Afterwards, an error ("operation-failed") is issued. https://bugzilla.gnome.org/show_bug.cgi?id=719529
Diffstat (limited to 'gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c')
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c b/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c
index c4b6b201..3c1c34b6 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c
@@ -37,6 +37,14 @@
#define DEBUG 1
#include "gstvaapidebug.h"
+/* Define default rate control mode ("constant-qp") */
+#define DEFAULT_RATECONTROL GST_VAAPI_RATECONTROL_CQP
+
+/* Supported set of VA rate controls, within this implementation */
+#define SUPPORTED_RATECONTROLS \
+ (GST_VAAPI_RATECONTROL_MASK (NONE) | \
+ GST_VAAPI_RATECONTROL_MASK (CQP) | \
+ GST_VAAPI_RATECONTROL_MASK (CBR))
static gboolean
gst_bit_writer_write_sps (GstBitWriter * bitwriter,
@@ -720,6 +728,8 @@ gst_vaapi_encoder_mpeg2_init (GstVaapiEncoder * base)
{
GstVaapiEncoderMpeg2 *encoder = GST_VAAPI_ENCODER_MPEG2 (base);
+ base->rate_control = DEFAULT_RATECONTROL;
+
/* re-ordering */
g_queue_init (&encoder->b_frames);
encoder->dump_frames = FALSE;
@@ -778,6 +788,8 @@ gst_vaapi_encoder_mpeg2_finalize (GstVaapiEncoder * base)
g_queue_clear (&encoder->b_frames);
}
+GST_VAAPI_ENCODER_DEFINE_CLASS_DATA (MPEG2);
+
static inline const GstVaapiEncoderClass *
gst_vaapi_encoder_mpeg2_class (void)
{