ekg2
Struktury danych | Definicje | Funkcje | Zmienne

Dokumentacja pliku ekg/audio.c

#include <stdarg.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include "audio.h"
#include "commands.h"
#include "debug.h"
#include "dynstuff.h"
#include "dynstuff_inline.h"
#include "plugins.h"
#include "themes.h"
#include "stuff.h"
#include "xmalloc.h"
#include "audio_wav.h"

Struktury danych

struct  stream_private_t

Definicje

#define __SET(args...)

Funkcje

 AUDIO_DEFINE (stream)
 DYNSTUFF_LIST_DECLARE_NF (audio_inputs, audio_t, static __DYNSTUFF_LIST_ADD, static __DYNSTUFF_LIST_UNLINK) DYNSTUFF_LIST_DECLARE_NF(audio_codecs
static static static
__DYNSTUFF_LIST_UNLINK 
__DYNSTUFF_LIST_ADD (streams, stream_t, NULL)
int cmd_streams (const char *name, const char **params, session_t *session, const char *target, int quiet)
codec_tcodec_find (const char *name)
int codec_register (codec_t *codec)
void codec_unregister (codec_t *codec)
audio_taudio_find (const char *name)
int audio_register (audio_t *audio)
void audio_unregister (audio_t *audio)
int stream_audio_read (int type, int fd, string_t buf, void *data)
int stream_audio_write (int type, int fd, string_t buf, void *data)
 AUDIO_CONTROL (stream_audio_control)
int stream_handle_write (int type, int fd, const char *watch, void *data)
int stream_handle (int type, int fd, watch_type_t watch, void *data)
int stream_create (char *name, audio_io_t *in, audio_codec_t *co, audio_io_t *out)
audio_io_tstream_as_audio (stream_t *s)
int audio_initialize ()
int audio_deinitialize ()

Zmienne

codec_taudio_codecs
audio_taudio_inputs
stream_tstreams
 codec_t
static __DYNSTUFF_LIST_ADD

Dokumentacja definicji

#define __SET (   args...)
Wartość:
(co) ? co->c->control_handler(AUDIO_CONTROL_SET, AUDIO_RDWR, co, args) : \
                                out->a->control_handler(AUDIO_CONTROL_SET, AUDIO_RDWR, co, args)

Dokumentacja funkcji

static static static __DYNSTUFF_LIST_UNLINK __DYNSTUFF_LIST_ADD ( streams  ,
stream_t  ,
NULL   
) [static]
AUDIO_CONTROL ( stream_audio_control  )
AUDIO_DEFINE ( stream  )
int audio_deinitialize ( )
audio_t* audio_find ( const char *  name)

audio_find()

Find audio_t by name

Parametry:
name- name of audio_t
Zwraca:
if name founded, return struct describing it. else NULL
int audio_initialize ( )
int audio_register ( audio_t audio)

audio_register()

Register new audio I/O (audio)

Nota:
This should be done @ *_plugin_init() and just before plugin_register() If audio_register() fails (return not 0) than you should NOT call plugin_register() only display some info... and return -1
Parametry:
audio- audio_t to register
Zobacz również:
audio_unregister() - to unregister audio_t
Zwraca:
-1 if invalid params (audio NULL)
-2 if audio with such name already exists
0 on success
void audio_unregister ( audio_t audio)

audio_unregister()

Unregister audio_t

Nota:
This should be done @ *_plugin_destroy() just before plugin_unregister()
Parametry:
audio- audio_t to unregister
int cmd_streams ( const char *  name,
const char **  params,
session_t session,
const char *  target,
int  quiet 
)
codec_t* codec_find ( const char *  name)

codec_find()

Find codec_t by name

Parametry:
name- name of codec_t
Zwraca:
if name founded, return struct describing it, else NULL
int codec_register ( codec_t codec)

codec_register()

Register new codec_t (codec)

Nota:
This should be done @ *_plugin_init() and just before plugin_register() If codec_register() fails (return not 0) than you should NOT call plugin_register() only display some info... and return -1
Parametry:
codec- codec_t to register
Zobacz również:
codec_unregister() - to unregister codec_t
Zwraca:
-1 if invalid params (codec NULL)
-2 if codec with such name already exists
0 on success
void codec_unregister ( codec_t codec)

audio_unregister()

Unregister codec_t

Nota:
This should be done @ *_plugin_destroy() just before plugin_unregister()
Parametry:
codec- codec_t to unregister
DYNSTUFF_LIST_DECLARE_NF ( audio_inputs  ,
audio_t  ,
static  __DYNSTUFF_LIST_ADD,
static  __DYNSTUFF_LIST_UNLINK 
)
audio_io_t* stream_as_audio ( stream_t s)

stream_as_audio()

Do zrobienia:
Ever not begin.
Nota:
This is not implemented, that was only idea howto do multiple encoding/decoding for example we want to decode MPEG 1 Layer 3 stream and reencode it to OGG so we could do:
stream_create("Reencoding from MPEG to OGG",
__AINIT_F("stream", AUDIO_READ, "file", "plik.mp3", "format", "mp3"), READING FROM FILE: plik.mp3 WITH FORMAT mp3
__CINIT_F("lame", ....), INIT LAME CODEC
__AINI(stream_as_audio( INIT ANOTHER STREAM, HERE WE HAVE DATA IN PCM FORMAT
stream_create("Reencoding from MPEG to OGG (part II)",
NULL, WE PASS AS INPUT HERE NULL.
__CINIT_F("ogg", .....), INIT OGG CODEC
__AINIT_F("stream", AUDIO_WRITE, "file", "plik.ogg", "format", "ogg") WRITE OGG FILE TO DISK
))
)
);
But it was only idea... and i had/have no time for it. For now... So if you really want this feature. implement it ;)
Parametry:
s- stream_t to convert.
Zwraca:
audio_io_t struct. [NULL for now]
int stream_audio_read ( int  type,
int  fd,
string_t  buf,
void *  data 
)
int stream_audio_write ( int  type,
int  fd,
string_t  buf,
void *  data 
)
int stream_create ( char *  name,
audio_io_t in,
audio_codec_t co,
audio_io_t out 
)

stream_create()

Function to create streams /input fd/ --> [codec function] --> /output fd or function/

Nota:
in->fd must != -1, out->fd can be -1
Do zrobienia:
Implement errors. make param , char **error
Pass it to AUDIO_CONTROL_INIT and if smth fail, there should be allocated description of error.
Do zrobienia:
Implement stream_close()
Zwraca:
1 on sucess [created stream_t] or 0 if fail.
int stream_handle ( int  type,
int  fd,
watch_type_t  watch,
void *  data 
)
int stream_handle_write ( int  type,
int  fd,
const char *  watch,
void *  data 
)

Dokumentacja zmiennych

__DYNSTUFF_LIST_ADD [static]
 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje