From 9c4b163cb546f0627a4d3106d2750db37d6aed50 Mon Sep 17 00:00:00 2001 From: Indu Bhagat Date: Fri, 16 Dec 2022 22:01:57 -0800 Subject: [PATCH] libsframe: provide new access API for mangled RA bit include/ChangeLog: * sframe-api.h (sframe_fre_get_ra_mangled_p): New declaration. ChangeLog: * libsframe/sframe.c (sframe_get_fre_ra_mangled_p): New definition. (sframe_fre_get_ra_mangled_p): New static function. --- include/sframe-api.h | 7 +++++++ libsframe/sframe.c | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/include/sframe-api.h b/include/sframe-api.h index c9db39eaaf0..bd1833558a4 100644 --- a/include/sframe-api.h +++ b/include/sframe-api.h @@ -21,6 +21,7 @@ #define _SFRAME_API_H #include +#include #ifdef __cplusplus extern "C" @@ -184,6 +185,12 @@ extern int32_t sframe_fre_get_ra_offset (sframe_decoder_ctx *dctx, sframe_frame_row_entry *fre, int *errp); +/* Get whether the RA is mangled. */ + +extern bool +sframe_fre_get_ra_mangled_p (sframe_decoder_ctx *dctx, + sframe_frame_row_entry *fre, int *errp); + /* The SFrame Encoder. */ /* Create an encoder context with the given SFrame format version VER, FLAGS diff --git a/libsframe/sframe.c b/libsframe/sframe.c index b17d3234236..b8fde2f04f8 100644 --- a/libsframe/sframe.c +++ b/libsframe/sframe.c @@ -124,6 +124,12 @@ sframe_fre_get_offset_size (unsigned char fre_info) return SFRAME_V1_FRE_OFFSET_SIZE (fre_info); } +static bool +sframe_get_fre_ra_mangled_p (unsigned char fre_info) +{ + return SFRAME_V1_FRE_MANGLED_RA_P (fre_info); +} + /* Access functions for info from function descriptor entry. */ static unsigned int @@ -640,6 +646,18 @@ sframe_fre_get_ra_offset (sframe_decoder_ctx *dctx, return sframe_get_fre_offset (fre, SFRAME_FRE_RA_OFFSET_IDX, errp); } +/* Get whether the RA is mangled. */ + +bool +sframe_fre_get_ra_mangled_p (sframe_decoder_ctx *dctx ATTRIBUTE_UNUSED, + sframe_frame_row_entry *fre, int *errp) +{ + if (fre == NULL || !sframe_fre_sanity_check_p (fre)) + return sframe_set_errno (errp, SFRAME_ERR_FRE_INVAL); + + return sframe_get_fre_ra_mangled_p (fre->fre_info); +} + static int sframe_frame_row_entry_copy (sframe_frame_row_entry *dst, sframe_frame_row_entry *src) { -- 2.30.2