GNUnet 0.21.1

Provides access to hardware microphones. More...

Collaboration diagram for Microphone library:

Data Structures

struct  GNUNET_MICROPHONE_Handle
 A microphone is a device that can capture or otherwise produce audio data. More...
 

Typedefs

typedef void(* GNUNET_MICROPHONE_RecordedDataCallback) (void *cls, size_t data_size, const void *data)
 Process recorded audio data. More...
 
typedef int(* GNUNET_MICROPHONE_EnableCallback) (void *cls, GNUNET_MICROPHONE_RecordedDataCallback rdc, void *rdc_cls)
 Enable a microphone. More...
 
typedef void(* GNUNET_MICROPHONE_DisableCallback) (void *cls)
 Function that disables a microphone. More...
 
typedef void(* GNUNET_MICROPHONE_DestroyCallback) (void *cls)
 Function to destroy a microphone. More...
 

Functions

struct GNUNET_MICROPHONE_HandleGNUNET_MICROPHONE_create_from_hardware (const struct GNUNET_CONFIGURATION_Handle *cfg)
 Create a microphone that corresponds to the microphone hardware of our system. More...
 
void GNUNET_MICROPHONE_destroy (struct GNUNET_MICROPHONE_Handle *microphone)
 Destroy a microphone. More...
 

Detailed Description

Provides access to hardware microphones.

Typedef Documentation

◆ GNUNET_MICROPHONE_RecordedDataCallback

typedef void(* GNUNET_MICROPHONE_RecordedDataCallback) (void *cls, size_t data_size, const void *data)

Process recorded audio data.

Parameters
clsclsoure
data_sizenumber of bytes in data
dataaudio data to play

Definition at line 57 of file gnunet_microphone_lib.h.

◆ GNUNET_MICROPHONE_EnableCallback

typedef int(* GNUNET_MICROPHONE_EnableCallback) (void *cls, GNUNET_MICROPHONE_RecordedDataCallback rdc, void *rdc_cls)

Enable a microphone.

Parameters
clsclsoure
rdcfunction to call with recorded data
rdc_clsclosure for dc
Returns
GNUNET_OK on success, GNUNET_SYSERR on error

Definition at line 69 of file gnunet_microphone_lib.h.

◆ GNUNET_MICROPHONE_DisableCallback

typedef void(* GNUNET_MICROPHONE_DisableCallback) (void *cls)

Function that disables a microphone.

Parameters
clsclsoure

Definition at line 79 of file gnunet_microphone_lib.h.

◆ GNUNET_MICROPHONE_DestroyCallback

typedef void(* GNUNET_MICROPHONE_DestroyCallback) (void *cls)

Function to destroy a microphone.

Parameters
clsclsoure

Definition at line 86 of file gnunet_microphone_lib.h.

Function Documentation

◆ GNUNET_MICROPHONE_create_from_hardware()

struct GNUNET_MICROPHONE_Handle * GNUNET_MICROPHONE_create_from_hardware ( const struct GNUNET_CONFIGURATION_Handle cfg)

Create a microphone that corresponds to the microphone hardware of our system.

Parameters
cfgconfiguration to use
Returns
NULL on error

Definition at line 170 of file microphone.c.

172{
174 struct Microphone *mic;
175
176 mic = GNUNET_new (struct Microphone);
177 mic->cfg = cfg;
179 microphone->cls = mic;
183 return microphone;
184}
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:109
static struct GNUNET_MICROPHONE_Handle * microphone
Handle to the microphone.
static struct GNUNET_MICROPHONE_Handle * mic
Our microphone.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static void disable(void *cls)
Function that disables a microphone.
Definition: microphone.c:131
static int enable(void *cls, GNUNET_MICROPHONE_RecordedDataCallback rdc, void *rdc_cls)
Enable a microphone.
Definition: microphone.c:98
static void destroy(void *cls)
Function to destroy a microphone.
Definition: microphone.c:153
A microphone is a device that can capture or otherwise produce audio data.
void * cls
Closure for the callbacks.
GNUNET_MICROPHONE_DisableCallback disable_microphone
Turn the microphone off.
GNUNET_MICROPHONE_DestroyCallback destroy_microphone
Destroy the microphone.
GNUNET_MICROPHONE_EnableCallback enable_microphone
Turn on the microphone.
Internal data structures for the microphone.
Definition: microphone.c:38

References cfg, GNUNET_MICROPHONE_Handle::cls, destroy(), GNUNET_MICROPHONE_Handle::destroy_microphone, disable(), GNUNET_MICROPHONE_Handle::disable_microphone, enable(), GNUNET_MICROPHONE_Handle::enable_microphone, GNUNET_new, mic, and microphone.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_MICROPHONE_destroy()

void GNUNET_MICROPHONE_destroy ( struct GNUNET_MICROPHONE_Handle microphone)

Destroy a microphone.

Parameters
microphonemicrophone to destroy

Definition at line 193 of file microphone.c.

194{
197}
#define GNUNET_free(ptr)
Wrapper around free.

References GNUNET_MICROPHONE_Handle::cls, GNUNET_MICROPHONE_Handle::destroy_microphone, GNUNET_free, and microphone.

Referenced by do_shutdown(), and do_stop_task().

Here is the caller graph for this function: