/* --- H.264 Encoder --- */
/* ------------------------------------------------------------------------- */
-#define GST_VAAPI_ENCODER_H264_CAST(encoder) \
- ((GstVaapiEncoderH264 *)(encoder))
-
struct _GstVaapiEncoderH264
{
GstVaapiEncoder parent_instance;
gst_vaapi_encoder_h264_encode (GstVaapiEncoder * base_encoder,
GstVaapiEncPicture * picture, GstVaapiCodedBufferProxy * codedbuf)
{
- GstVaapiEncoderH264 *const encoder =
- GST_VAAPI_ENCODER_H264_CAST (base_encoder);
+ GstVaapiEncoderH264 *const encoder = GST_VAAPI_ENCODER_H264 (base_encoder);
GstVaapiEncoderStatus ret = GST_VAAPI_ENCODER_STATUS_ERROR_UNKNOWN;
GstVaapiSurfaceProxy *reconstruct = NULL;
static GstVaapiEncoderStatus
gst_vaapi_encoder_h264_flush (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderH264 *const encoder =
- GST_VAAPI_ENCODER_H264_CAST (base_encoder);
+ GstVaapiEncoderH264 *const encoder = GST_VAAPI_ENCODER_H264 (base_encoder);
GstVaapiH264ViewReorderPool *reorder_pool;
GstVaapiEncPicture *pic;
guint i;
gst_vaapi_encoder_h264_get_codec_data (GstVaapiEncoder * base_encoder,
GstBuffer ** out_buffer_ptr)
{
- GstVaapiEncoderH264 *const encoder =
- GST_VAAPI_ENCODER_H264_CAST (base_encoder);
+ GstVaapiEncoderH264 *const encoder = GST_VAAPI_ENCODER_H264 (base_encoder);
const guint32 configuration_version = 0x01;
const guint32 nal_length_size = 4;
guint8 profile_idc, profile_comp, level_idc;
gst_vaapi_encoder_h264_reordering (GstVaapiEncoder * base_encoder,
GstVideoCodecFrame * frame, GstVaapiEncPicture ** output)
{
- GstVaapiEncoderH264 *const encoder =
- GST_VAAPI_ENCODER_H264_CAST (base_encoder);
+ GstVaapiEncoderH264 *const encoder = GST_VAAPI_ENCODER_H264 (base_encoder);
GstVaapiH264ViewReorderPool *reorder_pool = NULL;
GstVaapiEncPicture *picture;
gboolean is_idr = FALSE;
static GstVaapiEncoderStatus
set_context_info (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderH264 *const encoder =
- GST_VAAPI_ENCODER_H264_CAST (base_encoder);
+ GstVaapiEncoderH264 *const encoder = GST_VAAPI_ENCODER_H264 (base_encoder);
GstVideoInfo *const vip = GST_VAAPI_ENCODER_VIDEO_INFO (encoder);
const guint DEFAULT_SURFACES_COUNT = 3;
static GstVaapiEncoderStatus
gst_vaapi_encoder_h264_reconfigure (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderH264 *const encoder =
- GST_VAAPI_ENCODER_H264_CAST (base_encoder);
+ GstVaapiEncoderH264 *const encoder = GST_VAAPI_ENCODER_H264 (base_encoder);
GstVideoInfo *const vip = GST_VAAPI_ENCODER_VIDEO_INFO (encoder);
GstVaapiEncoderStatus status;
guint mb_width, mb_height;
static gboolean
gst_vaapi_encoder_h264_init (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderH264 *const encoder =
- GST_VAAPI_ENCODER_H264_CAST (base_encoder);
+ GstVaapiEncoderH264 *const encoder = GST_VAAPI_ENCODER_H264 (base_encoder);
guint32 i;
/* Default encoding entrypoint */
gst_vaapi_encoder_h264_finalize (GstVaapiEncoder * base_encoder)
{
/*free private buffers */
- GstVaapiEncoderH264 *const encoder =
- GST_VAAPI_ENCODER_H264_CAST (base_encoder);
+ GstVaapiEncoderH264 *const encoder = GST_VAAPI_ENCODER_H264 (base_encoder);
GstVaapiEncPicture *pic;
GstVaapiEncoderH264Ref *ref;
guint32 i;
gst_vaapi_encoder_h264_set_property (GstVaapiEncoder * base_encoder,
gint prop_id, const GValue * value)
{
- GstVaapiEncoderH264 *const encoder =
- GST_VAAPI_ENCODER_H264_CAST (base_encoder);
+ GstVaapiEncoderH264 *const encoder = GST_VAAPI_ENCODER_H264 (base_encoder);
switch (prop_id) {
case GST_VAAPI_ENCODER_H264_PROP_MAX_BFRAMES:
/* --- H.265 Encoder --- */
/* ------------------------------------------------------------------------- */
-#define GST_VAAPI_ENCODER_H265_CAST(encoder) \
- ((GstVaapiEncoderH265 *)(encoder))
-
struct _GstVaapiEncoderH265
{
GstVaapiEncoder parent_instance;
gst_vaapi_encoder_h265_encode (GstVaapiEncoder * base_encoder,
GstVaapiEncPicture * picture, GstVaapiCodedBufferProxy * codedbuf)
{
- GstVaapiEncoderH265 *const encoder =
- GST_VAAPI_ENCODER_H265_CAST (base_encoder);
+ GstVaapiEncoderH265 *const encoder = GST_VAAPI_ENCODER_H265 (base_encoder);
GstVaapiEncoderStatus ret = GST_VAAPI_ENCODER_STATUS_ERROR_UNKNOWN;
GstVaapiSurfaceProxy *reconstruct = NULL;
static GstVaapiEncoderStatus
gst_vaapi_encoder_h265_flush (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderH265 *const encoder =
- GST_VAAPI_ENCODER_H265_CAST (base_encoder);
+ GstVaapiEncoderH265 *const encoder = GST_VAAPI_ENCODER_H265 (base_encoder);
GstVaapiH265ReorderPool *reorder_pool;
GstVaapiEncPicture *pic;
gst_vaapi_encoder_h265_get_codec_data (GstVaapiEncoder * base_encoder,
GstBuffer ** out_buffer_ptr)
{
- GstVaapiEncoderH265 *const encoder =
- GST_VAAPI_ENCODER_H265_CAST (base_encoder);
+ GstVaapiEncoderH265 *const encoder = GST_VAAPI_ENCODER_H265 (base_encoder);
const guint32 configuration_version = 0x01;
const guint32 nal_length_size = 4;
GstMapInfo vps_info, sps_info, pps_info;
gst_vaapi_encoder_h265_reordering (GstVaapiEncoder * base_encoder,
GstVideoCodecFrame * frame, GstVaapiEncPicture ** output)
{
- GstVaapiEncoderH265 *const encoder =
- GST_VAAPI_ENCODER_H265_CAST (base_encoder);
+ GstVaapiEncoderH265 *const encoder = GST_VAAPI_ENCODER_H265 (base_encoder);
GstVaapiH265ReorderPool *reorder_pool = NULL;
GstVaapiEncPicture *picture;
gboolean is_idr = FALSE;
static GstVaapiEncoderStatus
set_context_info (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderH265 *const encoder =
- GST_VAAPI_ENCODER_H265_CAST (base_encoder);
+ GstVaapiEncoderH265 *const encoder = GST_VAAPI_ENCODER_H265 (base_encoder);
GstVideoInfo *const vip = GST_VAAPI_ENCODER_VIDEO_INFO (encoder);
const guint DEFAULT_SURFACES_COUNT = 3;
static GstVaapiEncoderStatus
gst_vaapi_encoder_h265_reconfigure (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderH265 *const encoder =
- GST_VAAPI_ENCODER_H265_CAST (base_encoder);
+ GstVaapiEncoderH265 *const encoder = GST_VAAPI_ENCODER_H265 (base_encoder);
GstVaapiEncoderStatus status;
guint luma_width, luma_height;
static gboolean
gst_vaapi_encoder_h265_init (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderH265 *const encoder =
- GST_VAAPI_ENCODER_H265_CAST (base_encoder);
+ GstVaapiEncoderH265 *const encoder = GST_VAAPI_ENCODER_H265 (base_encoder);
GstVaapiH265ReorderPool *reorder_pool;
GstVaapiH265RefPool *ref_pool;
gst_vaapi_encoder_h265_finalize (GstVaapiEncoder * base_encoder)
{
/*free private buffers */
- GstVaapiEncoderH265 *const encoder =
- GST_VAAPI_ENCODER_H265_CAST (base_encoder);
+ GstVaapiEncoderH265 *const encoder = GST_VAAPI_ENCODER_H265 (base_encoder);
GstVaapiEncPicture *pic;
GstVaapiEncoderH265Ref *ref;
GstVaapiH265RefPool *ref_pool;
gst_vaapi_encoder_h265_set_property (GstVaapiEncoder * base_encoder,
gint prop_id, const GValue * value)
{
- GstVaapiEncoderH265 *const encoder =
- GST_VAAPI_ENCODER_H265_CAST (base_encoder);
+ GstVaapiEncoderH265 *const encoder = GST_VAAPI_ENCODER_H265 (base_encoder);
switch (prop_id) {
case GST_VAAPI_ENCODER_H265_PROP_MAX_BFRAMES:
/* --- JPEG Encoder --- */
/* ------------------------------------------------------------------------- */
-#define GST_VAAPI_ENCODER_JPEG_CAST(encoder) \
- ((GstVaapiEncoderJpeg *)(encoder))
-
struct _GstVaapiEncoderJpeg
{
GstVaapiEncoder parent_instance;
static GstVaapiEncoderStatus
set_context_info (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderJpeg *encoder = GST_VAAPI_ENCODER_JPEG_CAST (base_encoder);
+ GstVaapiEncoderJpeg *encoder = GST_VAAPI_ENCODER_JPEG (base_encoder);
GstVideoInfo *const vip = GST_VAAPI_ENCODER_VIDEO_INFO (encoder);
/* Maximum sizes for common headers (in bytes) */
gst_vaapi_encoder_jpeg_encode (GstVaapiEncoder * base_encoder,
GstVaapiEncPicture * picture, GstVaapiCodedBufferProxy * codedbuf)
{
- GstVaapiEncoderJpeg *const encoder =
- GST_VAAPI_ENCODER_JPEG_CAST (base_encoder);
+ GstVaapiEncoderJpeg *const encoder = GST_VAAPI_ENCODER_JPEG (base_encoder);
GstVaapiEncoderStatus ret = GST_VAAPI_ENCODER_STATUS_ERROR_UNKNOWN;
GstVaapiSurfaceProxy *reconstruct = NULL;
gst_vaapi_encoder_jpeg_reordering (GstVaapiEncoder * base_encoder,
GstVideoCodecFrame * frame, GstVaapiEncPicture ** output)
{
- GstVaapiEncoderJpeg *const encoder =
- GST_VAAPI_ENCODER_JPEG_CAST (base_encoder);
+ GstVaapiEncoderJpeg *const encoder = GST_VAAPI_ENCODER_JPEG (base_encoder);
GstVaapiEncPicture *picture = NULL;
GstVaapiEncoderStatus status = GST_VAAPI_ENCODER_STATUS_SUCCESS;
static GstVaapiEncoderStatus
gst_vaapi_encoder_jpeg_reconfigure (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderJpeg *const encoder =
- GST_VAAPI_ENCODER_JPEG_CAST (base_encoder);
+ GstVaapiEncoderJpeg *const encoder = GST_VAAPI_ENCODER_JPEG (base_encoder);
GstVaapiEncoderStatus status;
status = ensure_profile (encoder);
static gboolean
gst_vaapi_encoder_jpeg_init (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderJpeg *const encoder =
- GST_VAAPI_ENCODER_JPEG_CAST (base_encoder);
+ GstVaapiEncoderJpeg *const encoder = GST_VAAPI_ENCODER_JPEG (base_encoder);
encoder->has_quant_tables = FALSE;
memset (&encoder->quant_tables, 0, sizeof (encoder->quant_tables));
gst_vaapi_encoder_jpeg_set_property (GstVaapiEncoder * base_encoder,
gint prop_id, const GValue * value)
{
- GstVaapiEncoderJpeg *const encoder =
- GST_VAAPI_ENCODER_JPEG_CAST (base_encoder);
+ GstVaapiEncoderJpeg *const encoder = GST_VAAPI_ENCODER_JPEG (base_encoder);
switch (prop_id) {
case GST_VAAPI_ENCODER_JPEG_PROP_QUALITY:
/* --- VP8 Encoder --- */
/* ------------------------------------------------------------------------- */
-#define GST_VAAPI_ENCODER_VP8_CAST(encoder) \
- ((GstVaapiEncoderVP8 *)(encoder))
-
struct _GstVaapiEncoderVP8
{
GstVaapiEncoder parent_instance;
static GstVaapiEncoderStatus
set_context_info (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderVP8 *encoder = GST_VAAPI_ENCODER_VP8_CAST (base_encoder);
+ GstVaapiEncoderVP8 *encoder = GST_VAAPI_ENCODER_VP8 (base_encoder);
GstVideoInfo *const vip = GST_VAAPI_ENCODER_VIDEO_INFO (encoder);
/* Maximum sizes for common headers (in bytes) */
gst_vaapi_encoder_vp8_encode (GstVaapiEncoder * base_encoder,
GstVaapiEncPicture * picture, GstVaapiCodedBufferProxy * codedbuf)
{
- GstVaapiEncoderVP8 *const encoder = GST_VAAPI_ENCODER_VP8_CAST (base_encoder);
+ GstVaapiEncoderVP8 *const encoder = GST_VAAPI_ENCODER_VP8 (base_encoder);
GstVaapiEncoderStatus ret = GST_VAAPI_ENCODER_STATUS_ERROR_UNKNOWN;
GstVaapiSurfaceProxy *reconstruct = NULL;
gst_vaapi_encoder_vp8_reordering (GstVaapiEncoder * base_encoder,
GstVideoCodecFrame * frame, GstVaapiEncPicture ** output)
{
- GstVaapiEncoderVP8 *const encoder = GST_VAAPI_ENCODER_VP8_CAST (base_encoder);
+ GstVaapiEncoderVP8 *const encoder = GST_VAAPI_ENCODER_VP8 (base_encoder);
GstVaapiEncPicture *picture = NULL;
GstVaapiEncoderStatus status = GST_VAAPI_ENCODER_STATUS_SUCCESS;
static GstVaapiEncoderStatus
gst_vaapi_encoder_vp8_reconfigure (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderVP8 *const encoder = GST_VAAPI_ENCODER_VP8_CAST (base_encoder);
+ GstVaapiEncoderVP8 *const encoder = GST_VAAPI_ENCODER_VP8 (base_encoder);
GstVaapiEncoderStatus status;
status = ensure_profile (encoder);
static gboolean
gst_vaapi_encoder_vp8_init (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderVP8 *const encoder = GST_VAAPI_ENCODER_VP8_CAST (base_encoder);
+ GstVaapiEncoderVP8 *const encoder = GST_VAAPI_ENCODER_VP8 (base_encoder);
encoder->frame_num = 0;
encoder->last_ref = NULL;
static void
gst_vaapi_encoder_vp8_finalize (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderVP8 *const encoder = GST_VAAPI_ENCODER_VP8_CAST (base_encoder);
+ GstVaapiEncoderVP8 *const encoder = GST_VAAPI_ENCODER_VP8 (base_encoder);
clear_references (encoder);
}
gst_vaapi_encoder_vp8_set_property (GstVaapiEncoder * base_encoder,
gint prop_id, const GValue * value)
{
- GstVaapiEncoderVP8 *const encoder = GST_VAAPI_ENCODER_VP8_CAST (base_encoder);
+ GstVaapiEncoderVP8 *const encoder = GST_VAAPI_ENCODER_VP8 (base_encoder);
switch (prop_id) {
case GST_VAAPI_ENCODER_VP8_PROP_LOOP_FILTER_LEVEL:
/* --- VP9 Encoder --- */
/* ------------------------------------------------------------------------- */
-#define GST_VAAPI_ENCODER_VP9_CAST(encoder) \
- ((GstVaapiEncoderVP9 *)(encoder))
-
struct _GstVaapiEncoderVP9
{
GstVaapiEncoder parent_instance;
static GstVaapiEncoderStatus
set_context_info (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderVP9 *encoder = GST_VAAPI_ENCODER_VP9_CAST (base_encoder);
+ GstVaapiEncoderVP9 *encoder = GST_VAAPI_ENCODER_VP9 (base_encoder);
GstVideoInfo *const vip = GST_VAAPI_ENCODER_VIDEO_INFO (encoder);
const guint DEFAULT_SURFACES_COUNT = 2;
gst_vaapi_encoder_vp9_encode (GstVaapiEncoder * base_encoder,
GstVaapiEncPicture * picture, GstVaapiCodedBufferProxy * codedbuf)
{
- GstVaapiEncoderVP9 *const encoder = GST_VAAPI_ENCODER_VP9_CAST (base_encoder);
+ GstVaapiEncoderVP9 *const encoder = GST_VAAPI_ENCODER_VP9 (base_encoder);
GstVaapiEncoderStatus ret = GST_VAAPI_ENCODER_STATUS_ERROR_UNKNOWN;
GstVaapiSurfaceProxy *reconstruct = NULL;
gst_vaapi_encoder_vp9_reordering (GstVaapiEncoder * base_encoder,
GstVideoCodecFrame * frame, GstVaapiEncPicture ** output)
{
- GstVaapiEncoderVP9 *const encoder = GST_VAAPI_ENCODER_VP9_CAST (base_encoder);
+ GstVaapiEncoderVP9 *const encoder = GST_VAAPI_ENCODER_VP9 (base_encoder);
GstVaapiEncPicture *picture = NULL;
GstVaapiEncoderStatus status = GST_VAAPI_ENCODER_STATUS_SUCCESS;
static GstVaapiEncoderStatus
gst_vaapi_encoder_vp9_reconfigure (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderVP9 *const encoder = GST_VAAPI_ENCODER_VP9_CAST (base_encoder);
+ GstVaapiEncoderVP9 *const encoder = GST_VAAPI_ENCODER_VP9 (base_encoder);
GstVaapiEncoderStatus status;
status = ensure_profile (encoder);
static gboolean
gst_vaapi_encoder_vp9_init (GstVaapiEncoder * base_encoder)
{
- GstVaapiEncoderVP9 *const encoder = GST_VAAPI_ENCODER_VP9_CAST (base_encoder);
+ GstVaapiEncoderVP9 *const encoder = GST_VAAPI_ENCODER_VP9 (base_encoder);
encoder->frame_num = 0;
encoder->loop_filter_level = DEFAULT_LOOP_FILTER_LEVEL;
gst_vaapi_encoder_vp9_set_property (GstVaapiEncoder * base_encoder,
gint prop_id, const GValue * value)
{
- GstVaapiEncoderVP9 *const encoder = GST_VAAPI_ENCODER_VP9_CAST (base_encoder);
+ GstVaapiEncoderVP9 *const encoder = GST_VAAPI_ENCODER_VP9 (base_encoder);
switch (prop_id) {
case GST_VAAPI_ENCODER_VP9_PROP_LOOP_FILTER_LEVEL: