Debian Codegraph @

Xpjproject/pjmedia/include/pjmedia-codec/lyra.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2024 Teluu Inc. (http://www.teluu.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 #ifndef __PJMEDIA_CODEC_LYRA_H__
19 #define __PJMEDIA_CODEC_LYRA_H__
20
21 /**
22 * @file pjmedia-codec/lyra.hpp
23 * @brief lyra codec.
24 */
25
26 #include <pjmedia-codec/types.h>
27
28 /**
29 * @defgroup PJMED_LYRA lyra Codec
30 * @ingroup PJMEDIA_CODEC_CODECS
31 * @brief Implementation of lyra Codec
32 * @{
33 *
34 * This section describes functions to initialize and register lyra codec
35 * factory to the codec manager. After the codec factory has been registered,
36 * application can use @ref PJMEDIA_CODEC API to manipulate the codec.
37 *
38 * Lyra codec supports 16-bit PCM audio signal with sampling rate of (8000Hz,
39 * 16000Hz, 32000Hz and 48000Hz), frame length 20ms, and resulting in
40 * bitrate 3200bps, 6000bps and 9200bps.
41 */
42
43 PJ_BEGIN_DECL
44
45 /**
46 * Lyra codec setting;
47 */
48 typedef struct pjmedia_codec_lyra_config
49 {
50 /**
51 * The value represents the decoder bitrate requested by the receiver.
52 * Endpoints can be configured with different bitrates. For example,
53 * the local endpoint might be set to a bitrate of 3200, while
54 * the remote endpoint is set to 6000. In this scenario, the remote
55 * endpoint will send data at 3200 bitrate, while the local endpoint
56 * will send data at 6000 bitrate. Valid bitrate: 3200, 6000, 9200.
57 * By default it is set to PJMEDIA_CODEC_LYRA_DEFAULT_BIT_RATE.
58 */
59 unsigned bit_rate;
60
61 /**
62 * Lyra required some additional (model) files, including
63 * \b lyra_config.binarypb , \b lyragan.tflite , \b quantizer.tflite and
64 * \b soundstream_encoder.tflite .
65 * This setting represents the folder containing the above files.
66 * The specified folder should contain these files. If an invalid folder
67 * is provided, the codec creation will fail.
68 */
69 pj_str_t model_path;
70
71 } pjmedia_codec_lyra_config;
72
73 /**
74 * Initialize and register lyra codec factory to pjmedia endpoint.
75 *
76 * @param endpt The pjmedia endpoint.
77 *
78 * @return PJ_SUCCESS on success.
79 */
80 PJ_DECL(pj_status_t) pjmedia_codec_lyra_init(pjmedia_endpt *endpt);
81
82 /**
83 * Unregister lyra codec factory from pjmedia endpoint and deinitialize
84 * the lyra codec library.
85 *
86 * @return PJ_SUCCESS on success.
87 */
88 PJ_DECL(pj_status_t) pjmedia_codec_lyra_deinit(void);
89
90 /**
91 * Get the default Lyra configuration.
92 *
93 * @param cfg Lyra codec configuration.
94 *
95 * @return PJ_SUCCESS on success.
96 */
97 PJ_DECL(pj_status_t)
98 pjmedia_codec_lyra_get_config( pjmedia_codec_lyra_config *cfg);
99
100 /**
101 * Set the default Lyra configuration.
102 *
103 * @param cfg Lyra codec configuration.
104 *
105 * @return PJ_SUCCESS on success.
106 */
107 PJ_DECL(pj_status_t)
108 pjmedia_codec_lyra_set_config(const pjmedia_codec_lyra_config *cfg);
109
110
111 PJ_END_DECL
112
113
114 /**
115 * @}
116 */
117
118 #endif /* __PJMEDIA_CODEC_LYRA_H__ */
119