amci.h File Reference

Definition of the codec interface. More...

#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  amci_file_desc_t
 File format declaration. More...
struct  amci_codec_fmt_info_t
 Codec's init function pointer. More...
struct  amci_codec_t
 Codec description. More...
struct  amci_subtype_t
 supported subtypes for a file More...
struct  amci_inoutfmt_t
 File format declaration. More...
struct  amci_payload_t
 ayload declaration More...
struct  amci_exports_t
 Complete plug-in declaration. More...

Defines

#define AUDIO_BUFFER_SIZE   (1<<12)
#define AMCI_RDONLY   1
#define AMCI_WRONLY   2
#define AMCI_FMT_FRAME_LENGTH   1
#define AMCI_FMT_FRAME_SIZE   2
#define AMCI_FMT_ENCODED_FRAME_SIZE   3
#define AMCI_PT_AUDIO_LINEAR   0
#define AMCI_PT_AUDIO_FRAME   1
#define BEGIN_EXPORTS(name, module_load, module_destroy)
#define END_EXPORTS
#define BEGIN_CODECS
#define END_CODECS
#define CODEC(id, intern2type, type2intern, plc, init, destroy, bytes2samples, samples2bytes)
#define BEGIN_PAYLOADS
#define END_PAYLOADS
#define PAYLOAD(id, name, rate, channels, codec_id, type)
#define BEGIN_FILE_FORMATS
#define END_FILE_FORMATS
#define BEGIN_FILE_FORMAT(name, ext, email_content_type, open, on_close, mem_open, mem_close)
#define END_FILE_FORMAT
#define BEGIN_SUBTYPES
#define END_SUBTYPES
#define SUBTYPE(type, name, rate, channels, codec_id)
#define AMCI_NO_MODULEINIT   NULL
#define AMCI_NO_MODULEDESTROY   NULL
#define AMCI_NO_CODEC_PLC   NULL
#define AMCI_NO_CODECCREATE   NULL
#define AMCI_NO_CODECDESTROY   NULL

Typedefs

typedef int(*) amci_converter_t (unsigned char *out, unsigned char *in, unsigned int size, unsigned int channels, unsigned int rate, long h_codec)
 Sound converter function pointer.
typedef int(*) amci_plc_t (unsigned char *out, unsigned int size, unsigned int channels, unsigned int rate, long h_codec)
 Codec specific packet loss concealment function pointer.
typedef int(*) amci_file_open_t (FILE *fptr, struct amci_file_desc_t *fmt_desc, int options, long h_codec)
 File format handler's open function.
typedef int(*) amci_file_close_t (FILE *fptr, struct amci_file_desc_t *fmt_desc, int options, long h_codec, struct amci_codec_t *codec)
typedef int(*) amci_file_mem_open_t (unsigned char *mptr, unsigned long size, unsigned long *pos, struct amci_file_desc_t *fmt_desc, int options, long h_codec)
typedef int(*) amci_file_mem_close_t (unsigned char *mptr, unsigned long *pos, struct amci_file_desc_t *fmt_desc, int options, long h_codec, struct amci_codec_t *codec)
typedef int(*) amci_codec_module_load_t (void)
 Codec module 's init function pointer. this function initializes the codec module.
typedef void(*) amci_codec_module_destroy_t (void)
 Codec's module's destroy function pointer.
typedef long(*) amci_codec_init_t (const char *format_parameters, amci_codec_fmt_info_t *format_description)
typedef void(*) amci_codec_destroy_t (long h_codec)
 Codec's destroy function pointer.
typedef unsigned int(*) amci_codec_bytes2samples_t (long h_codec, unsigned int num_bytes)
 Codec's function for calculating the number of samples from bytes.
typedef unsigned int(*) amci_codec_samples2bytes_t (long h_codec, unsigned int num_samples)
 Codec's function for calculating the number of bytes from samples.


Detailed Description

Definition of the codec interface.

This codec interface makes it possible for third-party developer to implement and integrate their own codecs and file formats.

Three entities can be declared within a plug-in:

  1. Codecs: transform samples to/from the internal coding scheme from/to these described in the plug-in.

  2. Payloads: special format definition used by the RTP protocol and including a codec.

  3. File formats: collection of subtypes sharing the same header scheme whereby each subtype can use a different codec.
Warning:
Please use only the macros at the end of this file for export definition. This is a much more portable solution than using directly the structures.

Define Documentation

#define AMCI_PT_AUDIO_FRAME   1

Payload type for frame based audio

#define AMCI_PT_AUDIO_LINEAR   0

Payload type for continuous audio

Examples:
plug-in/wav/wav.c.

#define AUDIO_BUFFER_SIZE   (1<<12)

AUDIO_BUFFER_SIZE must be a power of 2

#define BEGIN_CODECS

Portable export definition macro see example media plug-in 'wav' (plug-in/wav/wav.c).

Examples:
plug-in/wav/wav.c.

#define BEGIN_EXPORTS ( name,
module_load,
module_destroy   ) 

Portable export definition macro see example media plug-in 'wav' (plug-in/wav/wav.c).

Examples:
plug-in/wav/wav.c.

#define BEGIN_FILE_FORMAT ( name,
ext,
email_content_type,
open,
on_close,
mem_open,
mem_close   ) 

Portable export definition macro see example media plug-in 'wav' (plug-in/wav/wav.c).

Examples:
plug-in/wav/wav.c.

#define BEGIN_FILE_FORMATS

Portable export definition macro see example media plug-in 'wav' (plug-in/wav/wav.c).

Examples:
plug-in/wav/wav.c.

#define BEGIN_PAYLOADS

Portable export definition macro see example media plug-in 'wav' (plug-in/wav/wav.c).

Examples:
plug-in/wav/wav.c.

#define BEGIN_SUBTYPES

Portable export definition macro see example media plug-in 'wav' (plug-in/wav/wav.c).

Examples:
plug-in/wav/wav.c.

#define CODEC ( id,
intern2type,
type2intern,
plc,
init,
destroy,
bytes2samples,
samples2bytes   ) 

Portable export definition macro see example media plug-in 'wav' (plug-in/wav/wav.c).

Examples:
plug-in/wav/wav.c.

#define END_CODECS

Portable export definition macro see example media plug-in 'wav' (plug-in/wav/wav.c).

Examples:
plug-in/wav/wav.c.

#define END_EXPORTS

Portable export definition macro see example media plug-in 'wav' (plug-in/wav/wav.c).

Examples:
plug-in/wav/wav.c.

#define END_FILE_FORMAT

Portable export definition macro see example media plug-in 'wav' (plug-in/wav/wav.c).

Examples:
plug-in/wav/wav.c.

#define END_FILE_FORMATS

Portable export definition macro see example media plug-in 'wav' (plug-in/wav/wav.c).

Examples:
plug-in/wav/wav.c.

#define END_PAYLOADS

Portable export definition macro see example media plug-in 'wav' (plug-in/wav/wav.c).

Examples:
plug-in/wav/wav.c.

#define END_SUBTYPES

Portable export definition macro see example media plug-in 'wav' (plug-in/wav/wav.c).

Examples:
plug-in/wav/wav.c.

#define PAYLOAD ( id,
name,
rate,
channels,
codec_id,
type   ) 

Portable export definition macro see example media plug-in 'wav' (plug-in/wav/wav.c).

Examples:
plug-in/wav/wav.c.

#define SUBTYPE ( type,
name,
rate,
channels,
codec_id   ) 

Portable export definition macro see example media plug-in 'wav' (plug-in/wav/wav.c).

Examples:
plug-in/wav/wav.c.


Typedef Documentation

typedef void(*) amci_codec_destroy_t(long h_codec)

Codec's destroy function pointer.

Parameters:
h_codec Codec handle (from init function).

typedef int(*) amci_codec_module_load_t(void)

Codec module 's init function pointer. this function initializes the codec module.

Returns:
0 on success, <0 on error

typedef int(*) amci_converter_t(unsigned char *out, unsigned char *in, unsigned int size, unsigned int channels, unsigned int rate, long h_codec)

Sound converter function pointer.

Parameters:
out [out] output buffer
in [in] input buffer
size [in] size of input buffer
channels [in] number of channels
rate [in] sampling rate
h_codec [in] codec handle
Returns:
  • if sucess: bytes written in output buffer (0 is legal)
  • if failure: err < 0
See also:
amci_codec_t::intern2type

amci_codec_t::type2intern

typedef int(*) amci_file_close_t(FILE *fptr, struct amci_file_desc_t *fmt_desc, int options, long h_codec, struct amci_codec_t *codec)

File format handler's close function

Parameters:
fptr [in] fresh opened file pointer
fmt_desc [out] file description
options [in] options (see amci_inoutfmt_t)
h_codec [in] handle of the codec
codec [in] codec structure
Returns:
if failure -1, else 0.
See also:
amci_inoutfmt_t::on_close

typedef int(*) amci_file_mem_close_t(unsigned char *mptr, unsigned long *pos, struct amci_file_desc_t *fmt_desc, int options, long h_codec, struct amci_codec_t *codec)

File format handler's mem close function (usually no-op)

Parameters:
fptr [in] pointer to memory where file is loaded
pos [in,out] position in memory
fmt_desc [out] file description
options [in] options (see amci_inoutfmt_t)
h_codec [in] handle of the codec
codec [in] codec structure
Returns:
if failure -1, else 0.
See also:
amci_inoutfmt_t::on_close

typedef int(*) amci_file_mem_open_t(unsigned char *mptr, unsigned long size, unsigned long *pos, struct amci_file_desc_t *fmt_desc, int options, long h_codec)

File format handler's open function from memory area

Parameters:
fptr [in] pointer to memory where file is loaded
size [in] length of file in mem
pos [out] position after open
fmt_desc [out] file description
options [in] options (see amci_inoutfmt_t)
h_codec [in] handle of the codec
Returns:
if failure -1, else 0.
See also:
amci_inoutfmt_t::open

typedef int(*) amci_file_open_t(FILE *fptr, struct amci_file_desc_t *fmt_desc, int options, long h_codec)

File format handler's open function.

Parameters:
fptr [in] fresh opened file pointer
fmt_desc [out] file description
options [in] options (see amci_inoutfmt_t)
h_codec [in] handle of the codec
Returns:
if failure -1, else 0.
See also:
amci_inoutfmt_t::open

typedef int(*) amci_plc_t(unsigned char *out, unsigned int size, unsigned int channels, unsigned int rate, long h_codec)

Codec specific packet loss concealment function pointer.

Parameters:
out [out] output buffer
size [in] required size of output
channels [in] number of channels
rate [in] sampling rate
h_codec [in] codec handle
Returns:
  • if sucess: bytes written in output buffer (0 is legal)
  • if failure: err < 0
See also:
amci_codec_t::plc


Generated on Fri May 16 12:02:06 2008 for SEMS by  doxygen 1.5.1
Home |  Recent changes |  Search |  Glossary |  Sitemap |  Login