Asterisk - The Open Source Telephony Project
18.5.0
|
OGG/Vorbis streams. More...
#include "asterisk.h"
#include <ogg/ogg.h>
#include <vorbis/codec.h>
#include <vorbis/vorbisenc.h>
#include <vorbis/vorbisfile.h>
#include "asterisk/mod_format.h"
#include "asterisk/module.h"
#include "asterisk/format_cache.h"
Go to the source code of this file.
Data Structures | |
struct | ogg_vorbis_desc |
Macros | |
#define | BLOCK_SIZE 4096 /* used internally in the vorbis routines */ |
#define | BUF_SIZE (2*SAMPLES_MAX) |
#define | SAMPLES_MAX 512 |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static int | load_module (void) |
static void | ogg_vorbis_close (struct ast_filestream *fs) |
Close a OGG/Vorbis filestream. More... | |
static int | ogg_vorbis_open (struct ast_filestream *s) |
Create a new OGG/Vorbis filestream and set it up for reading. More... | |
static struct ast_frame * | ogg_vorbis_read (struct ast_filestream *fs, int *whennext) |
Read a frame full of audio data from the filestream. More... | |
static int | ogg_vorbis_rewrite (struct ast_filestream *s, const char *comment) |
Create a new OGG/Vorbis filestream and set it up for writing. More... | |
static int | ogg_vorbis_seek (struct ast_filestream *fs, off_t sample_offset, int whence) |
Seek to a specific position in an OGG/Vorbis filestream. More... | |
static off_t | ogg_vorbis_tell (struct ast_filestream *fs) |
Tell the current position in OGG/Vorbis filestream measured in pcms. More... | |
static int | ogg_vorbis_trunc (struct ast_filestream *fs) |
Trucate an OGG/Vorbis filestream. More... | |
static int | ogg_vorbis_write (struct ast_filestream *fs, struct ast_frame *f) |
Write audio data from a frame to an OGG/Vorbis filestream. More... | |
static int | unload_module (void) |
static void | write_stream (struct ogg_vorbis_desc *s, FILE *f) |
Write out any pending encoded data. More... | |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "OGG/Vorbis audio" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_format_def | vorbis_f |
#define BLOCK_SIZE 4096 /* used internally in the vorbis routines */ |
Definition at line 56 of file format_ogg_vorbis.c.
#define BUF_SIZE (2*SAMPLES_MAX) |
Definition at line 54 of file format_ogg_vorbis.c.
Referenced by ogg_vorbis_read().
#define SAMPLES_MAX 512 |
Definition at line 53 of file format_ogg_vorbis.c.
|
static |
Definition at line 449 of file format_ogg_vorbis.c.
|
static |
Definition at line 449 of file format_ogg_vorbis.c.
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 449 of file format_ogg_vorbis.c.
|
static |
Definition at line 431 of file format_ogg_vorbis.c.
References ast_format_def_register, ast_format_slin, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, and ast_format_def::format.
Referenced by unload_module().
|
static |
Close a OGG/Vorbis filestream.
fs | A OGG/Vorbis filestream. |
Definition at line 269 of file format_ogg_vorbis.c.
References ast_filestream::_private, ast_filestream::f, if(), ogg_vorbis_desc::os, ogg_vorbis_desc::ov_f, ogg_vorbis_desc::vb, ogg_vorbis_desc::vc, ogg_vorbis_desc::vd, ogg_vorbis_desc::vi, write_stream(), and ogg_vorbis_desc::writing.
|
static |
Create a new OGG/Vorbis filestream and set it up for reading.
s | File that points to on disk storage of the OGG/Vorbis data. |
Definition at line 109 of file format_ogg_vorbis.c.
References ast_filestream::_private, ast_log, DEFAULT_SAMPLE_RATE, desc, ast_filestream::f, LOG_ERROR, NULL, ogg_vorbis_desc::ov_f, result, and ogg_vorbis_desc::writing.
|
static |
Read a frame full of audio data from the filestream.
fs | The filestream. |
whennext | Number of sample times to schedule the next call. |
Definition at line 297 of file format_ogg_vorbis.c.
References __BIG_ENDIAN, __BYTE_ORDER, ast_filestream::_private, AST_FRAME_SET_BUFFER, AST_FRIENDLY_OFFSET, ast_log, ast_filestream::buf, BUF_SIZE, ast_frame::data, ast_frame::datalen, desc, ast_filestream::fr, if(), LOG_WARNING, NULL, ogg_vorbis_desc::ov_f, ast_frame::ptr, ast_frame::samples, and ogg_vorbis_desc::writing.
|
static |
Create a new OGG/Vorbis filestream and set it up for writing.
s | File pointer that points to on-disk storage. |
comment | Comment that should be embedded in the OGG/Vorbis file. |
Definition at line 147 of file format_ogg_vorbis.c.
References ast_filestream::_private, ast_log, ast_random(), DEFAULT_SAMPLE_RATE, ogg_vorbis_desc::eos, errno, ast_filestream::f, LOG_ERROR, LOG_WARNING, ogg_vorbis_desc::og, ogg_vorbis_desc::os, tmp(), ogg_vorbis_desc::vb, ogg_vorbis_desc::vc, ogg_vorbis_desc::vd, ogg_vorbis_desc::vi, ogg_vorbis_desc::writing, and ogg_vorbis_desc::writing_pcm_pos.
|
static |
Seek to a specific position in an OGG/Vorbis filestream.
fs | The filestream to take action on. |
sample_offset | New position for the filestream, measured in 8KHz samples. |
whence | Location to measure |
Definition at line 377 of file format_ogg_vorbis.c.
References ast_filestream::_private, ast_log, desc, if(), LOG_WARNING, ogg_vorbis_tell(), ogg_vorbis_desc::ov_f, and ogg_vorbis_desc::writing.
|
static |
Tell the current position in OGG/Vorbis filestream measured in pcms.
fs | The filestream to take action on. |
Definition at line 355 of file format_ogg_vorbis.c.
References ast_filestream::_private, desc, if(), ogg_vorbis_desc::ov_f, ogg_vorbis_desc::writing, and ogg_vorbis_desc::writing_pcm_pos.
Referenced by ogg_vorbis_seek().
|
static |
Trucate an OGG/Vorbis filestream.
fs | The filestream to truncate. |
Definition at line 344 of file format_ogg_vorbis.c.
References ast_log, and LOG_WARNING.
|
static |
Write audio data from a frame to an OGG/Vorbis filestream.
fs | An OGG/Vorbis filestream. |
f | A frame containing audio to be written to the filestream. |
Definition at line 235 of file format_ogg_vorbis.c.
References ast_filestream::_private, ast_log, ast_frame::data, ast_frame::datalen, ast_filestream::f, if(), LOG_ERROR, ast_frame::ptr, ast_frame::samples, ogg_vorbis_desc::vd, write_stream(), ogg_vorbis_desc::writing, and ogg_vorbis_desc::writing_pcm_pos.
|
static |
Definition at line 439 of file format_ogg_vorbis.c.
References ast_format_def_unregister(), AST_MODFLAG_LOAD_ORDER, AST_MODPRI_APP_DEPEND, AST_MODULE_INFO(), AST_MODULE_SUPPORT_CORE, ASTERISK_GPL_KEY, load_module(), and ast_format_def::name.
|
static |
Write out any pending encoded data.
s | An OGG/Vorbis filestream. |
f | The file to write to. |
Definition at line 203 of file format_ogg_vorbis.c.
References ast_log, ogg_vorbis_desc::eos, errno, LOG_WARNING, NULL, ogg_vorbis_desc::og, ogg_vorbis_desc::op, ogg_vorbis_desc::os, ogg_vorbis_desc::vb, and ogg_vorbis_desc::vd.
Referenced by ast_monitor_stop(), ast_write_stream(), ogg_vorbis_close(), ogg_vorbis_write(), and tech_write().
|
static |
Definition at line 449 of file format_ogg_vorbis.c.
|
static |
Definition at line 449 of file format_ogg_vorbis.c.
|
static |
Definition at line 416 of file format_ogg_vorbis.c.