|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
#include "ws_symbol_export.h"#include "ws_attributes.h"#include <stdbool.h>#include "wsutil/wmem/wmem_map.h"Go to the source code of this file.
Classes | |
| struct | codecs_plugin |
| struct | _codec_context_t |
Typedefs | |
| typedef struct codec_handle * | codec_handle_t |
| typedef struct _codec_context_t | codec_context_t |
| typedef void *(* | codec_init_fn) (codec_context_t *context) |
| Initialize context of codec. Context can contain any information required by codec to pass between calls Note: There is just one codec context in runtime therefore no RTP stream related information should be stored in the context! | |
| typedef void(* | codec_release_fn) (codec_context_t *context) |
| Destroy context of codec. | |
| typedef unsigned(* | codec_get_channels_fn) (codec_context_t *context) |
| Get count of channels provided by the codec. | |
| typedef unsigned(* | codec_get_frequency_fn) (codec_context_t *context) |
| Get frequency/rate provided by the codec. | |
| typedef size_t(* | codec_decode_fn) (codec_context_t *context, const void *inputBytes, size_t inputBytesSize, void *outputSamples, size_t *outputSamplesSize) |
| Decode one frame of payload. | |
Functions | |
| WS_DLL_PUBLIC void | codecs_register_plugin (const codecs_plugin *plug) |
| Register a codec plugin with the system. | |
| WS_DLL_PUBLIC void | codecs_init (const char *app_env_var_prefix) |
| Initialize all built-in and plugin-based codecs. | |
| WS_DLL_PUBLIC void | codecs_cleanup (void) |
| Clean up all registered codecs. | |
| WS_DLL_PUBLIC void | codec_get_compiled_version_info (GString *str) |
| Retrieve compile-time version information for codec-related libraries. | |
| WS_DLL_PUBLIC bool | register_codec (const char *name, codec_init_fn init_fn, codec_release_fn release_fn, codec_get_channels_fn channels_fn, codec_get_frequency_fn frequency_fn, codec_decode_fn decode_fn) |
| Register a new codec implementation. | |
| WS_DLL_PUBLIC bool | deregister_codec (const char *name) |
| Deregister a previously registered codec. | |
| WS_DLL_PUBLIC codec_handle_t | find_codec (const char *name) |
| Find a registered codec by name. | |
| WS_DLL_PUBLIC void * | codec_init (codec_handle_t codec, codec_context_t *context) |
| Initialize codec-specific state. | |
| WS_DLL_PUBLIC void | codec_release (codec_handle_t codec, codec_context_t *context) |
| Release codec-specific resources. | |
| WS_DLL_PUBLIC unsigned | codec_get_channels (codec_handle_t codec, codec_context_t *context) |
| Query the number of audio channels for a codec. | |
| WS_DLL_PUBLIC unsigned | codec_get_frequency (codec_handle_t codec, codec_context_t *context) |
| Query the sample rate for a codec. | |
| WS_DLL_PUBLIC size_t | codec_decode (codec_handle_t codec, codec_context_t *context, const void *inputBytes, size_t inputBytesSize, void *outputSamples, size_t *outputSamplesSize) |
| Decode input bytes into audio samples. | |
codecs interface 2007 Tomas Kukosa
Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs
SPDX-License-Identifier: GPL-2.0-or-later
| typedef size_t(* codec_decode_fn) (codec_context_t *context, const void *inputBytes, size_t inputBytesSize, void *outputSamples, size_t *outputSamplesSize) |
Decode one frame of payload.
Function is called twice, with different values of parameters: (1) To query size of required buffer in bytes for decoded samples pointed by inputBytes: outputSamples or outputSamplesSize must be set NULL (2) To decode samples: outputSamples points to allocated memory, outputSamplesSize is set to value returned in step (1)
| context | Pointer to codec context |
| inputBytes | Pointer to input frame |
| inputBytesSize | Length of input frame in bytes (count of bytes to decode) |
| outputSamples | Pointer to output buffer with samples |
| outputSamplesSize | Length of output buffer in bytes (not samples!) Function can override this value. All codecs set it to same value as it returns in (2) when (2) is called. |
| typedef unsigned(* codec_get_channels_fn) (codec_context_t *context) |
Get count of channels provided by the codec.
| context | Pointer to codec context |
| typedef unsigned(* codec_get_frequency_fn) (codec_context_t *context) |
Get frequency/rate provided by the codec.
| context | Pointer to codec context |
| typedef void *(* codec_init_fn) (codec_context_t *context) |
Initialize context of codec. Context can contain any information required by codec to pass between calls Note: There is just one codec context in runtime therefore no RTP stream related information should be stored in the context!
| typedef void(* codec_release_fn) (codec_context_t *context) |
Destroy context of codec.
| context | Pointer to codec context |
| WS_DLL_PUBLIC size_t codec_decode | ( | codec_handle_t | codec, |
| codec_context_t * | context, | ||
| const void * | inputBytes, | ||
| size_t | inputBytesSize, | ||
| void * | outputSamples, | ||
| size_t * | outputSamplesSize | ||
| ) |
Decode input bytes into audio samples.
Converts encoded input data into raw audio samples. The output buffer must be large enough to hold the decoded samples. The actual number of samples written is returned via outputSamplesSize.
| codec | Handle to the codec. |
| context | Pointer to the associated context. |
| inputBytes | Pointer to encoded input data. |
| inputBytesSize | Size of the input data in bytes. |
| outputSamples | Pointer to output buffer for decoded samples. |
| outputSamplesSize | Pointer to variable receiving the number of bytes written. |
| WS_DLL_PUBLIC unsigned codec_get_channels | ( | codec_handle_t | codec, |
| codec_context_t * | context | ||
| ) |
Query the number of audio channels for a codec.
Returns the channel count (e.g., 1 for mono, 2 for stereo).
| codec | Handle to the codec. |
| context | Pointer to the associated context. |
| WS_DLL_PUBLIC void codec_get_compiled_version_info | ( | GString * | str | ) |
Retrieve compile-time version information for codec-related libraries.
Appends version details for all libraries linked with libwscodecs at build time to the provided GString.
| str | Pointer to a GString that will receive the formatted version info. |
| WS_DLL_PUBLIC unsigned codec_get_frequency | ( | codec_handle_t | codec, |
| codec_context_t * | context | ||
| ) |
Query the sample rate for a codec.
Returns the sample rate in Hz (e.g., 8000, 44100).
| codec | Handle to the codec. |
| context | Pointer to the associated context. |
| WS_DLL_PUBLIC void * codec_init | ( | codec_handle_t | codec, |
| codec_context_t * | context | ||
| ) |
Initialize codec-specific state.
Prepares the codec for decoding using the provided context.
| codec | Handle to the codec. |
| context | Pointer to a codec_context_t structure. |
NULL on failure. | WS_DLL_PUBLIC void codec_release | ( | codec_handle_t | codec, |
| codec_context_t * | context | ||
| ) |
Release codec-specific resources.
Cleans up any state associated with the codec and context.
| codec | Handle to the codec. |
| context | Pointer to the associated context. |
| WS_DLL_PUBLIC void codecs_cleanup | ( | void | ) |
Clean up all registered codecs.
Releases resources associated with built-in and plugin-based codecs. This function is typically called during shutdown or when reinitializing codec support (e.g., after preference changes).
| WS_DLL_PUBLIC void codecs_init | ( | const char * | app_env_var_prefix | ) |
Initialize all built-in and plugin-based codecs.
Invokes the registration routines for all supported codecs, including statically linked and dynamically loaded plugins. This function should be called during application startup or dissector initialization to ensure codec availability for decoding and playback.
| app_env_var_prefix | The prefix for the application environment variable used to get plugin directory. |
| WS_DLL_PUBLIC void codecs_register_plugin | ( | const codecs_plugin * | plug | ) |
Register a codec plugin with the system.
Adds the specified codec plugin to the internal registry, enabling support for additional encoding or decoding formats. This function is typically called during plugin initialization to make custom codecs available for dissection or playback.
| plug | Pointer to a codecs_plugin structure describing the plugin. |
| WS_DLL_PUBLIC bool deregister_codec | ( | const char * | name | ) |
Deregister a previously registered codec.
Removes the codec identified by name from the internal registry.
| name | Name of the codec to remove. |
true if the codec was found and removed, false otherwise. | WS_DLL_PUBLIC codec_handle_t find_codec | ( | const char * | name | ) |
Find a registered codec by name.
Retrieves a handle to the codec identified by name, if available.
| name | Name of the codec to locate. |
NULL if not found. | WS_DLL_PUBLIC bool register_codec | ( | const char * | name, |
| codec_init_fn | init_fn, | ||
| codec_release_fn | release_fn, | ||
| codec_get_channels_fn | channels_fn, | ||
| codec_get_frequency_fn | frequency_fn, | ||
| codec_decode_fn | decode_fn | ||
| ) |
Register a new codec implementation.
Adds a codec to the internal registry using the provided function pointers. This enables support for custom decoding logic and metadata access.
| name | Unique name identifying the codec. |
| init_fn | Function to initialize codec state. |
| release_fn | Function to release codec resources. |
| channels_fn | Function to query channel count. |
| frequency_fn | Function to query sample rate. |
| decode_fn | Function to decode input bytes into audio samples. |
true if registration succeeded, false otherwise.