14b169a6bSchristos /* Implementation header. 24b169a6bSchristos 3*6817db7fSchristos Copyright (C) 2022-2024 Free Software Foundation, Inc. 44b169a6bSchristos 54b169a6bSchristos This file is part of libsframe. 64b169a6bSchristos 74b169a6bSchristos This program is free software; you can redistribute it and/or modify 84b169a6bSchristos it under the terms of the GNU General Public License as published by 94b169a6bSchristos the Free Software Foundation; either version 3 of the License, or 104b169a6bSchristos (at your option) any later version. 114b169a6bSchristos 124b169a6bSchristos This program is distributed in the hope that it will be useful, 134b169a6bSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of 144b169a6bSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 154b169a6bSchristos GNU General Public License for more details. 164b169a6bSchristos 174b169a6bSchristos You should have received a copy of the GNU General Public License 184b169a6bSchristos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 194b169a6bSchristos 204b169a6bSchristos #ifndef _SFRAME_IMPL_H 214b169a6bSchristos #define _SFRAME_IMPL_H 224b169a6bSchristos 234b169a6bSchristos #include "sframe-api.h" 244b169a6bSchristos 254b169a6bSchristos #ifdef __cplusplus 264b169a6bSchristos extern "C" 274b169a6bSchristos { 284b169a6bSchristos #endif 294b169a6bSchristos 304b169a6bSchristos #include <assert.h> 314b169a6bSchristos #define sframe_assert(expr) (assert (expr)) 324b169a6bSchristos 334b169a6bSchristos struct sframe_decoder_ctx 344b169a6bSchristos { 35*6817db7fSchristos /* SFrame header. */ 36*6817db7fSchristos sframe_header sfd_header; 37*6817db7fSchristos /* SFrame function desc entries table. */ 38*6817db7fSchristos sframe_func_desc_entry *sfd_funcdesc; 39*6817db7fSchristos /* SFrame FRE table. */ 40*6817db7fSchristos char *sfd_fres; 41*6817db7fSchristos /* Number of bytes needed for SFrame FREs. */ 42*6817db7fSchristos int sfd_fre_nbytes; 43*6817db7fSchristos /* Reference to the internally malloc'd buffer, if any, for endian flipping 44*6817db7fSchristos the original input buffer before decoding. */ 45*6817db7fSchristos void *sfd_buf; 464b169a6bSchristos }; 474b169a6bSchristos 48*6817db7fSchristos typedef struct sf_fde_tbl sf_fde_tbl; 49*6817db7fSchristos typedef struct sf_fre_tbl sf_fre_tbl; 50*6817db7fSchristos 514b169a6bSchristos struct sframe_encoder_ctx 524b169a6bSchristos { 53*6817db7fSchristos /* SFrame header. */ 54*6817db7fSchristos sframe_header sfe_header; 55*6817db7fSchristos /* SFrame function desc entries table. */ 56*6817db7fSchristos sf_fde_tbl *sfe_funcdesc; 57*6817db7fSchristos /* SFrame FRE table. */ 58*6817db7fSchristos sf_fre_tbl *sfe_fres; 59*6817db7fSchristos /* Number of bytes needed for SFrame FREs. */ 60*6817db7fSchristos uint32_t sfe_fre_nbytes; 61*6817db7fSchristos /* SFrame output data buffer. */ 62*6817db7fSchristos char *sfe_data; 63*6817db7fSchristos /* Size of the SFrame output data buffer. */ 64*6817db7fSchristos size_t sfe_data_size; 654b169a6bSchristos }; 664b169a6bSchristos 674b169a6bSchristos #ifdef __cplusplus 684b169a6bSchristos } 694b169a6bSchristos #endif 704b169a6bSchristos 714b169a6bSchristos #endif /* _SFRAME_IMPL_H */ 72