libs: encoder: remove unused cast macro

Remove internal macro to cast structure that are already declared
in the header.
This commit is contained in:
Víctor Manuel Jáquez Leal 2017-08-28 19:20:42 +02:00
parent 9c2246740b
commit 3bfb29e4c2
5 changed files with 37 additions and 75 deletions

View file

@ -694,9 +694,6 @@ bs_error:
/* --- H.264 Encoder --- */
/* ------------------------------------------------------------------------- */
#define GST_VAAPI_ENCODER_H264_CAST(encoder) \
((GstVaapiEncoderH264 *)(encoder))
struct _GstVaapiEncoderH264
{
GstVaapiEncoder parent_instance;
@ -2593,8 +2590,7 @@ static GstVaapiEncoderStatus
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;
@ -2631,8 +2627,7 @@ error:
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;
@ -2659,8 +2654,7 @@ static GstVaapiEncoderStatus
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;
@ -2759,8 +2753,7 @@ static GstVaapiEncoderStatus
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;
@ -2872,8 +2865,7 @@ end:
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;
@ -2932,8 +2924,7 @@ set_context_info (GstVaapiEncoder * base_encoder)
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;
@ -2969,8 +2960,7 @@ gst_vaapi_encoder_h264_reconfigure (GstVaapiEncoder * base_encoder)
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 */
@ -3012,8 +3002,7 @@ static void
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;
@ -3049,8 +3038,7 @@ static GstVaapiEncoderStatus
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:

View file

@ -85,9 +85,6 @@ typedef struct _GstVaapiH265ReorderPool
/* --- H.265 Encoder --- */
/* ------------------------------------------------------------------------- */
#define GST_VAAPI_ENCODER_H265_CAST(encoder) \
((GstVaapiEncoderH265 *)(encoder))
struct _GstVaapiEncoderH265
{
GstVaapiEncoder parent_instance;
@ -2021,8 +2018,7 @@ static GstVaapiEncoderStatus
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;
@ -2059,8 +2055,7 @@ error:
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;
@ -2083,8 +2078,7 @@ static GstVaapiEncoderStatus
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;
@ -2230,8 +2224,7 @@ static GstVaapiEncoderStatus
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;
@ -2330,8 +2323,7 @@ end:
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;
@ -2383,8 +2375,7 @@ set_context_info (GstVaapiEncoder * base_encoder)
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;
@ -2429,8 +2420,7 @@ gst_vaapi_encoder_h265_reconfigure (GstVaapiEncoder * base_encoder)
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;
@ -2458,8 +2448,7 @@ static void
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;
@ -2491,8 +2480,7 @@ static GstVaapiEncoderStatus
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:

View file

@ -56,9 +56,6 @@
/* --- JPEG Encoder --- */
/* ------------------------------------------------------------------------- */
#define GST_VAAPI_ENCODER_JPEG_CAST(encoder) \
((GstVaapiEncoderJpeg *)(encoder))
struct _GstVaapiEncoderJpeg
{
GstVaapiEncoder parent_instance;
@ -175,7 +172,7 @@ error_unsupported_profile:
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) */
@ -662,8 +659,7 @@ static GstVaapiEncoderStatus
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;
@ -709,8 +705,7 @@ static GstVaapiEncoderStatus
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;
@ -731,8 +726,7 @@ gst_vaapi_encoder_jpeg_reordering (GstVaapiEncoder * base_encoder,
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);
@ -748,8 +742,7 @@ gst_vaapi_encoder_jpeg_reconfigure (GstVaapiEncoder * base_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));
@ -770,8 +763,7 @@ static GstVaapiEncoderStatus
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:

View file

@ -57,9 +57,6 @@
/* --- VP8 Encoder --- */
/* ------------------------------------------------------------------------- */
#define GST_VAAPI_ENCODER_VP8_CAST(encoder) \
((GstVaapiEncoderVP8 *)(encoder))
struct _GstVaapiEncoderVP8
{
GstVaapiEncoder parent_instance;
@ -145,7 +142,7 @@ ensure_bitrate (GstVaapiEncoderVP8 * encoder)
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) */
@ -409,7 +406,7 @@ static GstVaapiEncoderStatus
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;
@ -455,7 +452,7 @@ static GstVaapiEncoderStatus
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;
@ -488,7 +485,7 @@ gst_vaapi_encoder_vp8_reordering (GstVaapiEncoder * base_encoder,
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);
@ -511,7 +508,7 @@ error:
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;
@ -524,7 +521,7 @@ gst_vaapi_encoder_vp8_init (GstVaapiEncoder * base_encoder)
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);
}
@ -532,7 +529,7 @@ static GstVaapiEncoderStatus
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:

View file

@ -91,9 +91,6 @@ gst_vaapi_encoder_vp9_ref_pic_mode_type (void)
/* --- VP9 Encoder --- */
/* ------------------------------------------------------------------------- */
#define GST_VAAPI_ENCODER_VP9_CAST(encoder) \
((GstVaapiEncoderVP9 *)(encoder))
struct _GstVaapiEncoderVP9
{
GstVaapiEncoder parent_instance;
@ -195,7 +192,7 @@ error_unsupported_profile:
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;
@ -431,7 +428,7 @@ static GstVaapiEncoderStatus
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;
@ -472,7 +469,7 @@ static GstVaapiEncoderStatus
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;
@ -504,7 +501,7 @@ gst_vaapi_encoder_vp9_reordering (GstVaapiEncoder * base_encoder,
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);
@ -518,7 +515,7 @@ gst_vaapi_encoder_vp9_reconfigure (GstVaapiEncoder * base_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;
@ -542,7 +539,7 @@ static GstVaapiEncoderStatus
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: