Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
codecs.h
Go to the documentation of this file.
1
11#ifndef _CODECS_H_
12#define _CODECS_H_
13
14#include "ws_symbol_export.h"
15#include "ws_attributes.h"
16
17#include <stdbool.h>
18
20
21#ifdef __cplusplus
22extern "C" {
23#endif /* __cplusplus */
24
25typedef struct {
26 void (*register_codec_module)(void); /* routine to call to register a codec */
28
29WS_DLL_PUBLIC void codecs_register_plugin(const codecs_plugin *plug);
30
34WS_DLL_PUBLIC void codecs_init(void);
35
36WS_DLL_PUBLIC void codecs_cleanup(void);
37
41WS_DLL_PUBLIC void codec_get_compiled_version_info(GString *str);
42
43struct codec_handle;
44typedef struct codec_handle *codec_handle_t;
45
46typedef struct _codec_context_t {
47 unsigned sample_rate;
48 unsigned channels;
49 wmem_map_t *fmtp_map;
50 void *priv; /* Private state set by the decoder */
52
53/*****************************************************************************/
54/* Interface which must be implemented by a codec */
55/* Codec decodes bytes to samples. Sample is 2 bytes! Codec writer must
56 * be careful when API refers bytes and when samples and its counts.
57 */
58/*****************************************************************************/
59
67typedef void *(*codec_init_fn)(codec_context_t *context);
68
73typedef void (*codec_release_fn)(codec_context_t *context);
74
81typedef unsigned (*codec_get_channels_fn)(codec_context_t *context);
82
89typedef unsigned (*codec_get_frequency_fn)(codec_context_t *context);
90
111typedef size_t (*codec_decode_fn)(codec_context_t *context,
112 const void *inputBytes, size_t inputBytesSize,
113 void *outputSamples, size_t *outputSamplesSize);
114
115/*****************************************************************************/
116/* Codec registering interface */
117/*****************************************************************************/
118
119WS_DLL_PUBLIC bool register_codec(const char *name, codec_init_fn init_fn,
120 codec_release_fn release_fn, codec_get_channels_fn channels_fn,
121 codec_get_frequency_fn frequency_fn, codec_decode_fn decode_fn);
122WS_DLL_PUBLIC bool deregister_codec(const char *name);
123WS_DLL_PUBLIC codec_handle_t find_codec(const char *name);
124WS_DLL_PUBLIC void *codec_init(codec_handle_t codec, codec_context_t *context);
125WS_DLL_PUBLIC void codec_release(codec_handle_t codec, codec_context_t *context);
126WS_DLL_PUBLIC unsigned codec_get_channels(codec_handle_t codec, codec_context_t *context);
127WS_DLL_PUBLIC unsigned codec_get_frequency(codec_handle_t codec, codec_context_t *context);
128WS_DLL_PUBLIC size_t codec_decode(codec_handle_t codec, codec_context_t *context,
129 const void *inputBytes, size_t inputBytesSize,
130 void *outputSamples, size_t *outputSamplesSize);
131
132#ifdef __cplusplus
133}
134#endif /* __cplusplus */
135
136#endif /* _CODECS_H_ */
137
138/*
139 * Editor modelines - https://www.wireshark.org/tools/modelines.html
140 *
141 * Local variables:
142 * c-basic-offset: 4
143 * tab-width: 8
144 * indent-tabs-mode: nil
145 * End:
146 *
147 * vi: set shiftwidth=4 tabstop=8 expandtab:
148 * :indentSize=4:tabSize=8:noTabs=true:
149 */
WS_DLL_PUBLIC void codecs_init(void)
Definition codecs.c:55
void(* codec_release_fn)(codec_context_t *context)
Definition codecs.h:73
size_t(* codec_decode_fn)(codec_context_t *context, const void *inputBytes, size_t inputBytesSize, void *outputSamples, size_t *outputSamplesSize)
Definition codecs.h:111
unsigned(* codec_get_frequency_fn)(codec_context_t *context)
Definition codecs.h:89
void *(* codec_init_fn)(codec_context_t *context)
Definition codecs.h:67
unsigned(* codec_get_channels_fn)(codec_context_t *context)
Definition codecs.h:81
WS_DLL_PUBLIC void codec_get_compiled_version_info(GString *str)
Definition codecs.h:46
Definition wmem_map.c:44
Definition codecs.c:75
Definition codecs.h:25