GNUnet  0.10.x
Data Structures | Typedefs | Functions
Microphone library

Provides access to hardware microphones. More...

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 53 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 65 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 74 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 81 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 173 of file microphone.c.

References Microphone::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().

174 {
176  struct Microphone *mic;
177 
178  mic = GNUNET_new (struct Microphone);
179  mic->cfg = cfg;
180  microphone = GNUNET_new (struct GNUNET_MICROPHONE_Handle);
181  microphone->cls = mic;
182  microphone->enable_microphone = &enable;
183  microphone->disable_microphone = &disable;
184  microphone->destroy_microphone = &destroy;
185  return microphone;
186 }
static int enable(void *cls, GNUNET_MICROPHONE_RecordedDataCallback rdc, void *rdc_cls)
Enable a microphone.
Definition: microphone.c:100
GNUNET_MICROPHONE_DisableCallback disable_microphone
Turn the microphone off.
GNUNET_MICROPHONE_EnableCallback enable_microphone
Turn on the microphone.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static void destroy(void *cls)
Function to destroy a microphone.
Definition: microphone.c:156
static struct GNUNET_MICROPHONE_Handle * mic
Our microphone.
GNUNET_MICROPHONE_DestroyCallback destroy_microphone
Destroy the microphone.
void * cls
Closure for the callbacks.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
static void disable(void *cls)
Function that disables a microphone.
Definition: microphone.c:134
Internal data structures for the microphone.
Definition: microphone.c:37
const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: microphone.c:43
A microphone is a device that can capture or otherwise produce audio data.
static struct GNUNET_MICROPHONE_Handle * microphone
Handle to the microphone.
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 195 of file microphone.c.

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

Referenced by do_shutdown(), and do_stop_task().

196 {
197  microphone->destroy_microphone (microphone->cls);
198  GNUNET_free (microphone);
199 }
GNUNET_MICROPHONE_DestroyCallback destroy_microphone
Destroy the microphone.
void * cls
Closure for the callbacks.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function: