Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
codecs.h File Reference
#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_handlecodec_handle_t
 
typedef struct _codec_context_t codec_context_t
 
typedef void *(* codec_init_fn) (codec_context_t *context)
 
typedef void(* codec_release_fn) (codec_context_t *context)
 
typedef unsigned(* codec_get_channels_fn) (codec_context_t *context)
 
typedef unsigned(* codec_get_frequency_fn) (codec_context_t *context)
 
typedef size_t(* codec_decode_fn) (codec_context_t *context, const void *inputBytes, size_t inputBytesSize, void *outputSamples, size_t *outputSamplesSize)
 

Functions

WS_DLL_PUBLIC void codecs_register_plugin (const codecs_plugin *plug)
 
WS_DLL_PUBLIC void codecs_init (void)
 
WS_DLL_PUBLIC void codecs_cleanup (void)
 
WS_DLL_PUBLIC void codec_get_compiled_version_info (GString *str)
 
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)
 
WS_DLL_PUBLIC bool deregister_codec (const char *name)
 
WS_DLL_PUBLIC codec_handle_t find_codec (const char *name)
 
WS_DLL_PUBLIC void * codec_init (codec_handle_t codec, codec_context_t *context)
 
WS_DLL_PUBLIC void codec_release (codec_handle_t codec, codec_context_t *context)
 
WS_DLL_PUBLIC unsigned codec_get_channels (codec_handle_t codec, codec_context_t *context)
 
WS_DLL_PUBLIC unsigned codec_get_frequency (codec_handle_t codec, codec_context_t *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)
 

Detailed Description

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 Documentation

◆ codec_decode_fn

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)

Parameters
contextPointer to codec context
inputBytesPointer to input frame
inputBytesSizeLength of input frame in bytes (count of bytes to decode)
outputSamplesPointer to output buffer with samples
outputSamplesSizeLength 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.
Returns
Count of reqired bytes (!not samples) to allocate in (1) or Count of decoded bytes (!not samples) in (2)

◆ codec_get_channels_fn

typedef unsigned(* codec_get_channels_fn) (codec_context_t *context)

Get count of channels provided by the codec

Parameters
contextPointer to codec context
Returns
Count of channels (e.g. 1)

◆ codec_get_frequency_fn

typedef unsigned(* codec_get_frequency_fn) (codec_context_t *context)

Get frequency/rate provided by the codec

Parameters
contextPointer to codec context
Returns
Frequency (e.g. 8000)

◆ codec_init_fn

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!

Returns
Pointer to codec context

◆ codec_release_fn

typedef void(* codec_release_fn) (codec_context_t *context)

Destroy context of codec

Parameters
contextPointer to codec context

Function Documentation

◆ codec_get_compiled_version_info()

WS_DLL_PUBLIC void codec_get_compiled_version_info ( GString *  str)

Get compile-time information for libraries used by libwscodecs.

◆ codecs_init()

WS_DLL_PUBLIC void codecs_init ( void  )

For all built-in codecs and codec plugins, call their register routines.