Each supported file format is described by the following structure. More...
#include <mod_format.h>
Data Fields | |
int | buf_size |
void(* | close )(struct ast_filestream *) |
int | desc_size |
char | exts [80] |
format_t | format |
char *(* | getcomment )(struct ast_filestream *) |
struct { | |
struct ast_format * next | |
} | list |
struct ast_module * | module |
char | name [80] |
int(* | open )(struct ast_filestream *s) |
Prepare an input stream for playback. | |
struct ast_frame *(* | read )(struct ast_filestream *, int *whennext) |
int(* | rewrite )(struct ast_filestream *s, const char *comment) |
Prepare a stream for output, and comment it appropriately if applicable. | |
int(* | seek )(struct ast_filestream *, off_t, int) |
off_t(* | tell )(struct ast_filestream *fs) |
int(* | trunc )(struct ast_filestream *fs) |
int(* | write )(struct ast_filestream *, struct ast_frame *) |
Each supported file format is described by the following structure.
Not all are necessary, the support routine implement default values for some of them. A handler typically fills a structure initializing the desired fields, and then calls ast_format_register() with the (readonly) structure as an argument.
Definition at line 43 of file mod_format.h.
int buf_size |
If the handler needs a buffer (for read, typically) and/or a private descriptor, put here the required size (in bytes) and the support routine will allocate them for you, pointed by s->buf and s->private, respectively. When allocating a buffer, remember to leave AST_FRIENDLY_OFFSET spare bytes at the bginning. size of frame buffer, if any, aligned to 8 bytes.
Definition at line 89 of file mod_format.h.
Referenced by __ast_format_register(), and get_filestream().
void(* close)(struct ast_filestream *) |
Do any closing actions, if any. The descriptor and structure are closed and destroyed by the generic routines, so they must not be done here.
Referenced by filestream_destructor().
int desc_size |
size of private descriptor, if any
Definition at line 90 of file mod_format.h.
Referenced by get_filestream().
char exts[80] |
Extensions (separated by | if more than one) this format can read. First is assumed for writing (e.g. .mp3)
Definition at line 45 of file mod_format.h.
Referenced by __ast_format_register(), ast_filehelper(), ast_format_str_reduce(), ast_readfile(), ast_writefile(), and handle_cli_core_show_file_formats().
Format of frames it uses/provides (one only)
Definition at line 47 of file mod_format.h.
Referenced by __ast_read(), ast_filehelper(), ast_playstream(), ast_readaudio_callback(), ast_readvideo_callback(), ast_streamfile(), ast_write(), ast_writestream(), au_seek(), filestream_close(), handle_cli_core_show_file_formats(), load_module(), pcm_read(), pcm_seek(), pcm_write(), unload_module(), wav_open(), wav_rewrite(), and wav_write().
char*(* getcomment)(struct ast_filestream *) |
Retrieve file comment
struct { ... } list |
Link
Referenced by __ast_format_register(), ast_filehelper(), ast_format_str_reduce(), ast_format_unregister(), and handle_cli_core_show_file_formats().
struct ast_module* module [read] |
Definition at line 92 of file mod_format.h.
Referenced by __ast_format_register(), filestream_destructor(), and fn_wrapper().
char name[80] |
Name of format
Definition at line 44 of file mod_format.h.
Referenced by __ast_format_register(), ast_format_unregister(), ast_writestream(), filestream_close(), fn_wrapper(), get_filestream(), handle_cli_core_show_file_formats(), and unload_module().
struct ast_format* next [read] |
Definition at line 79 of file mod_format.h.
int(* open)(struct ast_filestream *s) |
Prepare an input stream for playback.
Referenced by fn_wrapper().
struct ast_frame*(* read)(struct ast_filestream *, int *whennext) [read] |
Read the next frame from the filestream (if available) and report when to get next frame (in samples)
Referenced by read_frame().
int(* rewrite)(struct ast_filestream *s, const char *comment) |
Prepare a stream for output, and comment it appropriately if applicable.
Referenced by fn_wrapper().
int(* seek)(struct ast_filestream *, off_t, int) |
seek num samples into file, whence - like a normal seek but with offset in samples
Referenced by ast_seekstream(), and ast_writefile().
off_t(* tell)(struct ast_filestream *fs) |
tell current position
Referenced by ast_tellstream().
int(* trunc)(struct ast_filestream *fs) |
trunc file to current position
Referenced by ast_truncstream().
int(* write)(struct ast_filestream *, struct ast_frame *) |
Write a frame to a channel
Referenced by ast_writestream().