From a5651f8b447a318d04b94d95d2df2ae641b1f2ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Tue, 6 Aug 2024 10:57:56 +0200 Subject: [PATCH] vah26xenc: use gst_h26x_slice_type_to_string() Rather than custom function. Part-of: --- .../gst-plugins-bad/sys/va/gstvah264enc.c | 26 ++++--------------- .../gst-plugins-bad/sys/va/gstvah265enc.c | 26 ++++--------------- 2 files changed, 10 insertions(+), 42 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c b/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c index f50525c788..43fb85a871 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c @@ -336,23 +336,6 @@ static const GstVaH264LevelLimits _va_h264_level_limits[] = { /* *INDENT-ON* */ #ifndef GST_DISABLE_GST_DEBUG -static const gchar * -_slice_type_name (GstH264SliceType type) -{ - switch (type) { - case GST_H264_P_SLICE: - return "P"; - case GST_H264_B_SLICE: - return "B"; - case GST_H264_I_SLICE: - return "I"; - default: - g_assert_not_reached (); - } - - return NULL; -} - static const gchar * _rate_control_get_name (guint32 rc_mode) { @@ -825,7 +808,7 @@ _print_gop_structure (GstVaH264Enc * self) } g_string_append_printf (str, "%s", - _slice_type_name (self->gop.frame_types[i].slice_type)); + gst_h264_slice_type_to_string (self->gop.frame_types[i].slice_type)); if (self->gop.b_pyramid && self->gop.frame_types[i].slice_type == GST_H264_B_SLICE) { @@ -1828,7 +1811,7 @@ _push_one_frame (GstVaBaseEnc * base, GstVideoCodecFrame * gst_frame, GST_LOG_OBJECT (self, "Push frame, system_frame_number: %d, poc %d, " "frame type %s", gst_frame->system_frame_number, frame->poc, - _slice_type_name (frame->type)); + gst_h264_slice_type_to_string (frame->type)); self->gop.cur_frame_index++; @@ -2054,7 +2037,8 @@ get_one: } else { GST_LOG_OBJECT (self, "pop a frame with system_frame_number: %d," " frame type: %s, poc: %d, frame num: %d, is_ref: %s", - frame->system_frame_number, _slice_type_name (vaframe->type), + frame->system_frame_number, + gst_h264_slice_type_to_string (vaframe->type), vaframe->poc, vaframe->frame_num, vaframe->is_ref ? "true" : "false"); } @@ -2391,7 +2375,7 @@ _fill_picture_parameter (GstVaH264Enc * self, GstVaH264EncFrame * frame, if (g_queue_is_empty (&base->ref_list)) { GST_ERROR_OBJECT (self, "No reference found for frame type %s", - _slice_type_name (frame->type)); + gst_h264_slice_type_to_string (frame->type)); return FALSE; } diff --git a/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c b/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c index 9e809fb28c..71ac07b77a 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c @@ -408,23 +408,6 @@ static const GstVaH265LevelLimits _va_h265_level_limits[] = { /* *INDENT-ON* */ #ifndef GST_DISABLE_GST_DEBUG -static const gchar * -_h265_slice_type_name (GstH265SliceType type) -{ - switch (type) { - case GST_H265_P_SLICE: - return "P"; - case GST_H265_B_SLICE: - return "B"; - case GST_H265_I_SLICE: - return "I"; - default: - g_assert_not_reached (); - } - - return NULL; -} - static const gchar * _rate_control_get_name (guint32 rc_mode) { @@ -1547,7 +1530,7 @@ _h265_fill_picture_parameter (GstVaH265Enc * self, GstVaH265EncFrame * frame, if (g_queue_is_empty (&base->ref_list)) { GST_ERROR_OBJECT (self, "No reference found for frame type %s", - _h265_slice_type_name (frame->type)); + gst_h265_slice_type_to_string (frame->type)); return FALSE; } @@ -2099,7 +2082,7 @@ _h265_push_one_frame (GstVaBaseEnc * base, GstVideoCodecFrame * gst_frame, GST_LOG_OBJECT (self, "Push frame, system_frame_number: %d, poc %d, " "frame type %s", gst_frame->system_frame_number, frame->poc, - _h265_slice_type_name (frame->type)); + gst_h265_slice_type_to_string (frame->type)); self->gop.cur_frame_index++; g_queue_push_tail (&base->reorder_list, @@ -2317,7 +2300,8 @@ get_one: } else { GST_LOG_OBJECT (self, "pop a frame with system_frame_number: %d," " frame type: %s, poc: %d, is_ref: %s", - frame->system_frame_number, _h265_slice_type_name (vaframe->type), + frame->system_frame_number, + gst_h265_slice_type_to_string (vaframe->type), vaframe->poc, vaframe->is_ref ? "true" : "false"); } @@ -3683,7 +3667,7 @@ _h265_print_gop_structure (GstVaH265Enc * self) g_string_append_printf (str, "%s", "LDB"); } else { g_string_append_printf (str, "%s", - _h265_slice_type_name (self->gop.frame_types[i].slice_type)); + gst_h265_slice_type_to_string (self->gop.frame_types[i].slice_type)); } if (self->gop.b_pyramid