ALSA project - the C library reference: Hook Extension

ALSA project - the C library reference

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Files | Typedefs | Enumerations | Functions
Hook Extension
PCM Interface

## Files
file | pcm_hooks.c
| PCM Hook Interface.

## Typedefs
typedef struct _snd_pcm_hook | snd_pcm_hook_t
typedef int(* | snd_pcm_hook_func_t )(snd_pcm_hook_t *hook)

## Enumerations
enum | snd_pcm_hook_type_t { SND_PCM_HOOK_TYPE_HW_PARAMS = 0, SND_PCM_HOOK_TYPE_HW_FREE, SND_PCM_HOOK_TYPE_CLOSE, SND_PCM_HOOK_TYPE_LAST = SND_PCM_HOOK_TYPE_CLOSE }

## Functions
snd_pcm_t * | snd_pcm_hook_get_pcm (snd_pcm_hook_t *hook)
| Get PCM handle for a PCM hook. More...
void * | snd_pcm_hook_get_private (snd_pcm_hook_t *hook)
| Get callback function private data for a PCM hook. More...
void | snd_pcm_hook_set_private (snd_pcm_hook_t *hook, void *private_data)
| Set callback function private data for a PCM hook. More...
int | snd_pcm_hook_add (snd_pcm_hook_t **hookp, snd_pcm_t *pcm, snd_pcm_hook_type_t type, snd_pcm_hook_func_t func, void *private_data)
| Add a PCM hook at end of hooks chain. More...
int | snd_pcm_hook_remove (snd_pcm_hook_t *hook)
| Remove a PCM hook. More...

## Detailed Description

See the PCM (digital audio) interface page for more details.

## Typedef Documentation

typedef int(* snd_pcm_hook_func_t)(snd_pcm_hook_t *hook)

PCM hook callback function

typedef struct _snd_pcm_hook snd_pcm_hook_t

PCM hook container

## Enumeration Type Documentation

enum snd_pcm_hook_type_t

type of pcm hook

## Function Documentation

int snd_pcm_hook_add | ( | snd_pcm_hook_t ** | hookp,
|  | snd_pcm_t * | pcm,
|  | snd_pcm_hook_type_t | type,
|  | snd_pcm_hook_func_t | func,
|  | void * | private_data
| ) |  |

Add a PCM hook at end of hooks chain.

Parameters

  hookp | Returned PCM hook handle
  pcm | PCM handle
  type | PCM hook type
  func | PCM hook callback function
  private_data | PCM hook private data

Returns
  0 on success otherwise a negative error code

Warning: an hook callback function cannot remove an hook of the same type different from itself

snd_pcm_t* snd_pcm_hook_get_pcm | ( | snd_pcm_hook_t * | hook | ) |

Get PCM handle for a PCM hook.

Parameters

  hook | PCM hook handle

Returns
  PCM handle

void* snd_pcm_hook_get_private | ( | snd_pcm_hook_t * | hook | ) |

Get callback function private data for a PCM hook.

Parameters

  hook | PCM hook handle

Returns
  callback function private data

int snd_pcm_hook_remove | ( | snd_pcm_hook_t * | hook | ) |

Remove a PCM hook.

Parameters

  hook | PCM hook handle

Returns
  0 on success otherwise a negative error code

Warning: an hook callback cannot remove an hook of the same type different from itself

void snd_pcm_hook_set_private | ( | snd_pcm_hook_t * | hook,
|  | void * | private_data
| ) |  |

Set callback function private data for a PCM hook.

Parameters

  hook | PCM hook handle
  private_data | The private data value