2005-07-20 00:25:54 +00:00
|
|
|
/*
|
2005-09-14 20:46:50 +00:00
|
|
|
* Asterisk -- An open source telephony toolkit.
|
|
|
|
*
|
2005-09-15 15:44:26 +00:00
|
|
|
* Copyright (C) 2005, Jeff Ollie
|
|
|
|
*
|
2005-09-14 20:46:50 +00:00
|
|
|
* See http://www.asterisk.org for more information about
|
|
|
|
* the Asterisk project. Please do not directly contact
|
|
|
|
* any of the maintainers of this project for assistance;
|
|
|
|
* the project provides a web site, mailing lists and IRC
|
|
|
|
* channels for your use.
|
|
|
|
*
|
|
|
|
* This program is free software, distributed under the terms of
|
|
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
|
|
* at the top of the source tree.
|
|
|
|
*/
|
|
|
|
|
2005-10-26 13:03:17 +00:00
|
|
|
/*! \file
|
2005-07-20 00:25:54 +00:00
|
|
|
*
|
2005-10-26 13:03:17 +00:00
|
|
|
* \brief OGG/Vorbis streams.
|
2005-11-06 15:09:47 +00:00
|
|
|
* \arg File name extension: ogg
|
|
|
|
* \ingroup formats
|
2005-07-20 00:25:54 +00:00
|
|
|
*/
|
2006-02-12 04:28:58 +00:00
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
/* the order of these dependencies is important... it also specifies
|
|
|
|
the link order of the libraries during linking
|
|
|
|
*/
|
|
|
|
|
2006-04-24 17:11:45 +00:00
|
|
|
/*** MODULEINFO
|
2006-07-05 20:12:29 +00:00
|
|
|
<depend>vorbis</depend>
|
|
|
|
<depend>ogg</depend>
|
2011-07-14 20:28:54 +00:00
|
|
|
<support_level>core</support_level>
|
2006-04-24 17:11:45 +00:00
|
|
|
***/
|
|
|
|
|
2006-06-07 18:54:56 +00:00
|
|
|
#include "asterisk.h"
|
|
|
|
|
2005-07-20 00:25:54 +00:00
|
|
|
#include <vorbis/codec.h>
|
|
|
|
#include <vorbis/vorbisenc.h>
|
2012-02-14 19:29:24 +00:00
|
|
|
#include <vorbis/vorbisfile.h>
|
2005-07-20 00:25:54 +00:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <io.h>
|
|
|
|
#endif
|
|
|
|
|
2007-11-22 00:53:49 +00:00
|
|
|
#include "asterisk/mod_format.h"
|
2005-07-20 00:25:54 +00:00
|
|
|
#include "asterisk/module.h"
|
media formats: re-architect handling of media for performance improvements
In the old times media formats were represented using a bit field. This was
fast but had a few limitations.
1. Asterisk was limited in how many formats it could handle.
2. Formats, being a bit field, could not include any attribute information.
A format was strictly its type, e.g., "this is ulaw".
This was changed in Asterisk 10 (see
https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal for
notes on that work) which led to the creation of the ast_format structure.
This structure allowed Asterisk to handle attributes and bundle information
with a format.
Additionally, ast_format_cap was created to act as a container for multiple
formats that, together, formed the capability of some entity. Another
mechanism was added to allow logic to be registered which performed format
attribute negotiation. Everywhere throughout the codebase Asterisk was
changed to use this strategy.
Unfortunately, in software, there is no free lunch. These new capabilities
came at a cost.
Performance analysis and profiling showed that we spend an inordinate
amount of time comparing, copying, and generally manipulating formats and
their related structures. Basic prototyping has shown that a reasonably
large performance improvement could be made in this area. This patch is the
result of that project, which overhauled the media format architecture
and its usage in Asterisk to improve performance.
Generally, the new philosophy for handling formats is as follows:
* The ast_format structure is reference counted. This removed a large amount
of the memory allocations and copying that was done in prior versions.
* In order to prevent race conditions while keeping things performant, the
ast_format structure is immutable by convention and lock-free. Violate this
tenet at your peril!
* Because formats are reference counted, codecs are also reference counted.
The Asterisk core generally provides built-in codecs and caches the
ast_format structures created to represent them. Generally, to prevent
inordinate amounts of module reference bumping, codecs and formats can be
added at run-time but cannot be removed.
* All compatibility with the bit field representation of codecs/formats has
been moved to a compatibility API. The primary user of this representation
is chan_iax2, which must continue to maintain its bit-field usage of formats
for interoperability concerns.
* When a format is negotiated with attributes, or when a format cannot be
represented by one of the cached formats, a new format object is created or
cloned from an existing format. That format may have the same codec
underlying it, but is a different format than a version of the format with
different attributes or without attributes.
* While formats are reference counted objects, the reference count maintained
on the format should be manipulated with care. Formats are generally cached
and will persist for the lifetime of Asterisk and do not explicitly need
to have their lifetime modified. An exception to this is when the user of a
format does not know where the format came from *and* the user may outlive
the provider of the format. This occurs, for example, when a format is read
from a channel: the channel may have a format with attributes (hence,
non-cached) and the user of the format may last longer than the channel (if
the reference to the channel is released prior to the format's reference).
For more information on this work, see the API design notes:
https://wiki.asterisk.org/wiki/display/AST/Media+Format+Rewrite
Finally, this work was the culmination of a large number of developer's
efforts. Extra thanks goes to Corey Farrell, who took on a large amount of the
work in the Asterisk core, chan_sip, and was an invaluable resource in peer
reviews throughout this project.
There were a substantial number of patches contributed during this work; the
following issues/patch names simply reflect some of the work (and will cause
the release scripts to give attribution to the individuals who work on them).
Reviews:
https://reviewboard.asterisk.org/r/3814
https://reviewboard.asterisk.org/r/3808
https://reviewboard.asterisk.org/r/3805
https://reviewboard.asterisk.org/r/3803
https://reviewboard.asterisk.org/r/3801
https://reviewboard.asterisk.org/r/3798
https://reviewboard.asterisk.org/r/3800
https://reviewboard.asterisk.org/r/3794
https://reviewboard.asterisk.org/r/3793
https://reviewboard.asterisk.org/r/3792
https://reviewboard.asterisk.org/r/3791
https://reviewboard.asterisk.org/r/3790
https://reviewboard.asterisk.org/r/3789
https://reviewboard.asterisk.org/r/3788
https://reviewboard.asterisk.org/r/3787
https://reviewboard.asterisk.org/r/3786
https://reviewboard.asterisk.org/r/3784
https://reviewboard.asterisk.org/r/3783
https://reviewboard.asterisk.org/r/3778
https://reviewboard.asterisk.org/r/3774
https://reviewboard.asterisk.org/r/3775
https://reviewboard.asterisk.org/r/3772
https://reviewboard.asterisk.org/r/3761
https://reviewboard.asterisk.org/r/3754
https://reviewboard.asterisk.org/r/3753
https://reviewboard.asterisk.org/r/3751
https://reviewboard.asterisk.org/r/3750
https://reviewboard.asterisk.org/r/3748
https://reviewboard.asterisk.org/r/3747
https://reviewboard.asterisk.org/r/3746
https://reviewboard.asterisk.org/r/3742
https://reviewboard.asterisk.org/r/3740
https://reviewboard.asterisk.org/r/3739
https://reviewboard.asterisk.org/r/3738
https://reviewboard.asterisk.org/r/3737
https://reviewboard.asterisk.org/r/3736
https://reviewboard.asterisk.org/r/3734
https://reviewboard.asterisk.org/r/3722
https://reviewboard.asterisk.org/r/3713
https://reviewboard.asterisk.org/r/3703
https://reviewboard.asterisk.org/r/3689
https://reviewboard.asterisk.org/r/3687
https://reviewboard.asterisk.org/r/3674
https://reviewboard.asterisk.org/r/3671
https://reviewboard.asterisk.org/r/3667
https://reviewboard.asterisk.org/r/3665
https://reviewboard.asterisk.org/r/3625
https://reviewboard.asterisk.org/r/3602
https://reviewboard.asterisk.org/r/3519
https://reviewboard.asterisk.org/r/3518
https://reviewboard.asterisk.org/r/3516
https://reviewboard.asterisk.org/r/3515
https://reviewboard.asterisk.org/r/3512
https://reviewboard.asterisk.org/r/3506
https://reviewboard.asterisk.org/r/3413
https://reviewboard.asterisk.org/r/3410
https://reviewboard.asterisk.org/r/3387
https://reviewboard.asterisk.org/r/3388
https://reviewboard.asterisk.org/r/3389
https://reviewboard.asterisk.org/r/3390
https://reviewboard.asterisk.org/r/3321
https://reviewboard.asterisk.org/r/3320
https://reviewboard.asterisk.org/r/3319
https://reviewboard.asterisk.org/r/3318
https://reviewboard.asterisk.org/r/3266
https://reviewboard.asterisk.org/r/3265
https://reviewboard.asterisk.org/r/3234
https://reviewboard.asterisk.org/r/3178
ASTERISK-23114 #close
Reported by: mjordan
media_formats_translation_core.diff uploaded by kharwell (License 6464)
rb3506.diff uploaded by mjordan (License 6283)
media_format_app_file.diff uploaded by kharwell (License 6464)
misc-2.diff uploaded by file (License 5000)
chan_mild-3.diff uploaded by file (License 5000)
chan_obscure.diff uploaded by file (License 5000)
jingle.diff uploaded by file (License 5000)
funcs.diff uploaded by file (License 5000)
formats.diff uploaded by file (License 5000)
core.diff uploaded by file (License 5000)
bridges.diff uploaded by file (License 5000)
mf-codecs-2.diff uploaded by file (License 5000)
mf-app_fax.diff uploaded by file (License 5000)
mf-apps-3.diff uploaded by file (License 5000)
media-formats-3.diff uploaded by file (License 5000)
ASTERISK-23715
rb3713.patch uploaded by coreyfarrell (License 5909)
rb3689.patch uploaded by mjordan (License 6283)
ASTERISK-23957
rb3722.patch uploaded by mjordan (License 6283)
mf-attributes-3.diff uploaded by file (License 5000)
ASTERISK-23958
Tested by: jrose
rb3822.patch uploaded by coreyfarrell (License 5909)
rb3800.patch uploaded by jrose (License 6182)
chan_sip.diff uploaded by mjordan (License 6283)
rb3747.patch uploaded by jrose (License 6182)
ASTERISK-23959 #close
Tested by: sgriepentrog, mjordan, coreyfarrell
sip_cleanup.diff uploaded by opticron (License 6273)
chan_sip_caps.diff uploaded by mjordan (License 6283)
rb3751.patch uploaded by coreyfarrell (License 5909)
chan_sip-3.diff uploaded by file (License 5000)
ASTERISK-23960 #close
Tested by: opticron
direct_media.diff uploaded by opticron (License 6273)
pjsip-direct-media.diff uploaded by file (License 5000)
format_cap_remove.diff uploaded by opticron (License 6273)
media_format_fixes.diff uploaded by opticron (License 6273)
chan_pjsip-2.diff uploaded by file (License 5000)
ASTERISK-23966 #close
Tested by: rmudgett
rb3803.patch uploaded by rmudgetti (License 5621)
chan_dahdi.diff uploaded by file (License 5000)
ASTERISK-24064 #close
Tested by: coreyfarrell, mjordan, opticron, file, rmudgett, sgriepentrog, jrose
rb3814.patch uploaded by rmudgett (License 5621)
moh_cleanup.diff uploaded by opticron (License 6273)
bridge_leak.diff uploaded by opticron (License 6273)
translate.diff uploaded by file (License 5000)
rb3795.patch uploaded by rmudgett (License 5621)
tls_fix.diff uploaded by mjordan (License 6283)
fax-mf-fix-2.diff uploaded by file (License 5000)
rtp_transfer_stuff uploaded by mjordan (License 6283)
rb3787.patch uploaded by rmudgett (License 5621)
media-formats-explicit-translate-format-3.diff uploaded by file (License 5000)
format_cache_case_fix.diff uploaded by opticron (License 6273)
rb3774.patch uploaded by rmudgett (License 5621)
rb3775.patch uploaded by rmudgett (License 5621)
rtp_engine_fix.diff uploaded by opticron (License 6273)
rtp_crash_fix.diff uploaded by opticron (License 6273)
rb3753.patch uploaded by mjordan (License 6283)
rb3750.patch uploaded by mjordan (License 6283)
rb3748.patch uploaded by rmudgett (License 5621)
media_format_fixes.diff uploaded by opticron (License 6273)
rb3740.patch uploaded by mjordan (License 6283)
rb3739.patch uploaded by mjordan (License 6283)
rb3734.patch uploaded by mjordan (License 6283)
rb3689.patch uploaded by mjordan (License 6283)
rb3674.patch uploaded by coreyfarrell (License 5909)
rb3671.patch uploaded by coreyfarrell (License 5909)
rb3667.patch uploaded by coreyfarrell (License 5909)
rb3665.patch uploaded by mjordan (License 6283)
rb3625.patch uploaded by coreyfarrell (License 5909)
rb3602.patch uploaded by coreyfarrell (License 5909)
format_compatibility-2.diff uploaded by file (License 5000)
core.diff uploaded by file (License 5000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-20 22:06:33 +00:00
|
|
|
#include "asterisk/format_cache.h"
|
2006-04-04 15:40:47 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* this is the number of samples we deal with. Samples are converted
|
|
|
|
* to SLINEAR so each one uses 2 bytes in the buffer.
|
|
|
|
*/
|
2012-02-14 19:29:24 +00:00
|
|
|
#define SAMPLES_MAX 512
|
2006-04-04 15:40:47 +00:00
|
|
|
#define BUF_SIZE (2*SAMPLES_MAX)
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2006-04-04 15:40:47 +00:00
|
|
|
#define BLOCK_SIZE 4096 /* used internally in the vorbis routines */
|
|
|
|
|
2012-02-14 19:29:24 +00:00
|
|
|
struct ogg_vorbis_desc { /* format specific parameters */
|
|
|
|
/* OggVorbis_File structure for libvorbisfile interface */
|
|
|
|
OggVorbis_File ov_f;
|
|
|
|
|
2005-07-20 00:25:54 +00:00
|
|
|
/* structures for handling the Ogg container */
|
|
|
|
ogg_stream_state os;
|
2006-02-12 04:28:58 +00:00
|
|
|
ogg_page og;
|
|
|
|
ogg_packet op;
|
2017-12-22 14:23:22 +00:00
|
|
|
|
2005-07-20 00:25:54 +00:00
|
|
|
/* structures for handling Vorbis audio data */
|
2006-02-12 04:28:58 +00:00
|
|
|
vorbis_info vi;
|
|
|
|
vorbis_comment vc;
|
2005-07-20 00:25:54 +00:00
|
|
|
vorbis_dsp_state vd;
|
2006-02-12 04:28:58 +00:00
|
|
|
vorbis_block vb;
|
2017-12-22 14:23:22 +00:00
|
|
|
|
2005-07-20 00:25:54 +00:00
|
|
|
/*! \brief Indicates whether this filestream is set up for reading or writing. */
|
|
|
|
int writing;
|
2012-02-14 19:29:24 +00:00
|
|
|
|
|
|
|
/*! \brief Stores the current pcm position to support tell() on writing mode. */
|
|
|
|
off_t writing_pcm_pos;
|
|
|
|
|
2005-07-20 00:25:54 +00:00
|
|
|
/*! \brief Indicates whether an End of Stream condition has been detected. */
|
|
|
|
int eos;
|
|
|
|
};
|
|
|
|
|
2012-02-16 19:51:15 +00:00
|
|
|
#if !defined(HAVE_VORBIS_OPEN_CALLBACKS)
|
|
|
|
/*
|
|
|
|
* Declared for backward compatibility with vorbisfile v1.1.2.
|
|
|
|
* Code taken from vorbisfile.h v1.2.0.
|
|
|
|
*/
|
|
|
|
static int _ov_header_fseek_wrap(FILE *f, ogg_int64_t off, int whence)
|
|
|
|
{
|
|
|
|
if (f == NULL) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return fseek(f, off, whence);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ov_callbacks OV_CALLBACKS_NOCLOSE = {
|
|
|
|
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
|
|
|
(int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
|
|
|
|
(int (*)(void *)) NULL,
|
|
|
|
(long (*)(void *)) ftell
|
|
|
|
};
|
|
|
|
#endif /* !defined(HAVE_VORBIS_OPEN_CALLBACKS) */
|
|
|
|
|
2005-07-20 00:25:54 +00:00
|
|
|
/*!
|
|
|
|
* \brief Create a new OGG/Vorbis filestream and set it up for reading.
|
2006-07-19 22:40:36 +00:00
|
|
|
* \param s File that points to on disk storage of the OGG/Vorbis data.
|
2005-07-20 00:25:54 +00:00
|
|
|
* \return The new filestream.
|
|
|
|
*/
|
2006-04-04 12:59:25 +00:00
|
|
|
static int ogg_vorbis_open(struct ast_filestream *s)
|
2005-07-20 00:25:54 +00:00
|
|
|
{
|
|
|
|
int result;
|
2012-02-14 19:29:24 +00:00
|
|
|
struct ogg_vorbis_desc *desc = (struct ogg_vorbis_desc *) s->_private;
|
2006-02-12 04:28:58 +00:00
|
|
|
|
2012-02-14 19:29:24 +00:00
|
|
|
/* initialize private description block */
|
|
|
|
memset(desc, 0, sizeof(struct ogg_vorbis_desc));
|
|
|
|
desc->writing = 0;
|
2006-02-12 04:28:58 +00:00
|
|
|
|
2012-02-14 19:29:24 +00:00
|
|
|
/* actually open file */
|
|
|
|
result = ov_open_callbacks(s->f, &desc->ov_f, NULL, 0, OV_CALLBACKS_NOCLOSE);
|
|
|
|
if (result != 0) {
|
|
|
|
ast_log(LOG_ERROR, "Error opening Ogg/Vorbis file stream.\n");
|
2006-04-04 12:59:25 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-02-14 19:29:24 +00:00
|
|
|
/* check stream(s) type */
|
|
|
|
if (desc->ov_f.vi->channels != 1) {
|
|
|
|
ast_log(LOG_ERROR, "Only monophonic OGG/Vorbis files are currently supported!\n");
|
|
|
|
ov_clear(&desc->ov_f);
|
2006-04-04 12:59:25 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2012-02-14 19:29:24 +00:00
|
|
|
if (desc->ov_f.vi->rate != DEFAULT_SAMPLE_RATE) {
|
2006-04-04 12:59:25 +00:00
|
|
|
ast_log(LOG_ERROR, "Only 8000Hz OGG/Vorbis files are currently supported!\n");
|
2012-02-14 19:29:24 +00:00
|
|
|
ov_clear(&desc->ov_f);
|
|
|
|
return -1;
|
2006-04-04 12:59:25 +00:00
|
|
|
}
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2006-04-04 15:40:47 +00:00
|
|
|
return 0;
|
2005-07-20 00:25:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Create a new OGG/Vorbis filestream and set it up for writing.
|
2006-07-19 22:40:36 +00:00
|
|
|
* \param s File pointer that points to on-disk storage.
|
2005-07-20 00:25:54 +00:00
|
|
|
* \param comment Comment that should be embedded in the OGG/Vorbis file.
|
|
|
|
* \return A new filestream.
|
|
|
|
*/
|
2006-04-04 15:40:47 +00:00
|
|
|
static int ogg_vorbis_rewrite(struct ast_filestream *s,
|
2006-02-12 04:28:58 +00:00
|
|
|
const char *comment)
|
2005-07-20 00:25:54 +00:00
|
|
|
{
|
|
|
|
ogg_packet header;
|
|
|
|
ogg_packet header_comm;
|
|
|
|
ogg_packet header_code;
|
2012-02-14 19:29:24 +00:00
|
|
|
struct ogg_vorbis_desc *tmp = (struct ogg_vorbis_desc *) s->_private;
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2006-04-04 15:40:47 +00:00
|
|
|
tmp->writing = 1;
|
2012-02-14 19:29:24 +00:00
|
|
|
tmp->writing_pcm_pos = 0;
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2006-04-04 15:40:47 +00:00
|
|
|
vorbis_info_init(&tmp->vi);
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2006-04-04 15:40:47 +00:00
|
|
|
if (vorbis_encode_init_vbr(&tmp->vi, 1, DEFAULT_SAMPLE_RATE, 0.4)) {
|
|
|
|
ast_log(LOG_ERROR, "Unable to initialize Vorbis encoder!\n");
|
2017-04-14 17:51:31 +00:00
|
|
|
vorbis_info_clear(&tmp->vi);
|
2006-04-04 15:40:47 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2006-04-04 15:40:47 +00:00
|
|
|
vorbis_comment_init(&tmp->vc);
|
|
|
|
vorbis_comment_add_tag(&tmp->vc, "ENCODER", "Asterisk PBX");
|
|
|
|
if (comment)
|
|
|
|
vorbis_comment_add_tag(&tmp->vc, "COMMENT", (char *) comment);
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2006-04-04 15:40:47 +00:00
|
|
|
vorbis_analysis_init(&tmp->vd, &tmp->vi);
|
|
|
|
vorbis_block_init(&tmp->vd, &tmp->vb);
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2006-04-05 17:44:44 +00:00
|
|
|
ogg_stream_init(&tmp->os, ast_random());
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2006-04-04 15:40:47 +00:00
|
|
|
vorbis_analysis_headerout(&tmp->vd, &tmp->vc, &header, &header_comm,
|
|
|
|
&header_code);
|
|
|
|
ogg_stream_packetin(&tmp->os, &header);
|
|
|
|
ogg_stream_packetin(&tmp->os, &header_comm);
|
|
|
|
ogg_stream_packetin(&tmp->os, &header_code);
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2006-04-04 15:40:47 +00:00
|
|
|
while (!tmp->eos) {
|
|
|
|
if (ogg_stream_flush(&tmp->os, &tmp->og) == 0)
|
|
|
|
break;
|
2017-04-21 17:04:44 +00:00
|
|
|
if (fwrite(tmp->og.header, 1, tmp->og.header_len, s->f) != tmp->og.header_len) {
|
2008-11-02 18:52:13 +00:00
|
|
|
ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
|
|
|
|
}
|
2017-04-21 17:04:44 +00:00
|
|
|
if (fwrite(tmp->og.body, 1, tmp->og.body_len, s->f) != tmp->og.body_len) {
|
2008-11-02 18:52:13 +00:00
|
|
|
ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
|
|
|
|
}
|
2006-04-04 15:40:47 +00:00
|
|
|
if (ogg_page_eos(&tmp->og))
|
|
|
|
tmp->eos = 1;
|
2005-07-20 00:25:54 +00:00
|
|
|
}
|
2006-04-04 15:40:47 +00:00
|
|
|
|
|
|
|
return 0;
|
2005-07-20 00:25:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Write out any pending encoded data.
|
2006-10-30 16:33:02 +00:00
|
|
|
* \param s An OGG/Vorbis filestream.
|
|
|
|
* \param f The file to write to.
|
2005-07-20 00:25:54 +00:00
|
|
|
*/
|
2012-02-14 19:29:24 +00:00
|
|
|
static void write_stream(struct ogg_vorbis_desc *s, FILE *f)
|
2005-07-20 00:25:54 +00:00
|
|
|
{
|
|
|
|
while (vorbis_analysis_blockout(&s->vd, &s->vb) == 1) {
|
|
|
|
vorbis_analysis(&s->vb, NULL);
|
|
|
|
vorbis_bitrate_addblock(&s->vb);
|
2006-02-12 04:28:58 +00:00
|
|
|
|
2005-07-20 00:25:54 +00:00
|
|
|
while (vorbis_bitrate_flushpacket(&s->vd, &s->op)) {
|
|
|
|
ogg_stream_packetin(&s->os, &s->op);
|
|
|
|
while (!s->eos) {
|
2006-02-12 04:28:58 +00:00
|
|
|
if (ogg_stream_pageout(&s->os, &s->og) == 0) {
|
2005-07-20 00:25:54 +00:00
|
|
|
break;
|
|
|
|
}
|
2017-04-21 17:04:44 +00:00
|
|
|
if (fwrite(s->og.header, 1, s->og.header_len, f) != s->og.header_len) {
|
|
|
|
ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
|
2008-11-02 18:52:13 +00:00
|
|
|
}
|
2017-04-21 17:04:44 +00:00
|
|
|
if (fwrite(s->og.body, 1, s->og.body_len, f) != s->og.body_len) {
|
2008-11-02 18:52:13 +00:00
|
|
|
ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
|
|
|
|
}
|
2006-02-12 04:28:58 +00:00
|
|
|
if (ogg_page_eos(&s->og)) {
|
2005-07-20 00:25:54 +00:00
|
|
|
s->eos = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Write audio data from a frame to an OGG/Vorbis filestream.
|
2006-10-30 16:33:02 +00:00
|
|
|
* \param fs An OGG/Vorbis filestream.
|
|
|
|
* \param f A frame containing audio to be written to the filestream.
|
|
|
|
* \return -1 if there was an error, 0 on success.
|
2005-07-20 00:25:54 +00:00
|
|
|
*/
|
2006-04-04 15:40:47 +00:00
|
|
|
static int ogg_vorbis_write(struct ast_filestream *fs, struct ast_frame *f)
|
2005-07-20 00:25:54 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
float **buffer;
|
|
|
|
short *data;
|
2012-02-14 19:29:24 +00:00
|
|
|
struct ogg_vorbis_desc *s = (struct ogg_vorbis_desc *) fs->_private;
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2006-02-12 04:28:58 +00:00
|
|
|
if (!s->writing) {
|
2005-07-20 00:25:54 +00:00
|
|
|
ast_log(LOG_ERROR, "This stream is not set up for writing!\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2006-02-12 04:28:58 +00:00
|
|
|
if (!f->datalen)
|
2005-07-20 00:25:54 +00:00
|
|
|
return -1;
|
|
|
|
|
2008-05-22 17:10:53 +00:00
|
|
|
data = (short *) f->data.ptr;
|
2005-07-20 00:25:54 +00:00
|
|
|
|
|
|
|
buffer = vorbis_analysis_buffer(&s->vd, f->samples);
|
|
|
|
|
2006-04-04 15:40:47 +00:00
|
|
|
for (i = 0; i < f->samples; i++)
|
|
|
|
buffer[0][i] = (double)data[i] / 32768.0;
|
2005-07-20 00:25:54 +00:00
|
|
|
|
|
|
|
vorbis_analysis_wrote(&s->vd, f->samples);
|
|
|
|
|
2006-04-04 15:40:47 +00:00
|
|
|
write_stream(s, fs->f);
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2012-02-14 19:29:24 +00:00
|
|
|
s->writing_pcm_pos += f->samples;
|
|
|
|
|
2005-07-20 00:25:54 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Close a OGG/Vorbis filestream.
|
2006-07-19 22:40:36 +00:00
|
|
|
* \param fs A OGG/Vorbis filestream.
|
2005-07-20 00:25:54 +00:00
|
|
|
*/
|
2006-04-04 15:40:47 +00:00
|
|
|
static void ogg_vorbis_close(struct ast_filestream *fs)
|
2005-07-20 00:25:54 +00:00
|
|
|
{
|
2012-02-14 19:29:24 +00:00
|
|
|
struct ogg_vorbis_desc *s = (struct ogg_vorbis_desc *) fs->_private;
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2006-02-12 04:28:58 +00:00
|
|
|
if (s->writing) {
|
2005-07-20 00:25:54 +00:00
|
|
|
/* Tell the Vorbis encoder that the stream is finished
|
|
|
|
* and write out the rest of the data */
|
|
|
|
vorbis_analysis_wrote(&s->vd, 0);
|
2006-04-04 15:40:47 +00:00
|
|
|
write_stream(s, fs->f);
|
2017-04-14 17:51:31 +00:00
|
|
|
|
|
|
|
/* Cleanup */
|
|
|
|
ogg_stream_clear(&s->os);
|
|
|
|
vorbis_block_clear(&s->vb);
|
|
|
|
vorbis_dsp_clear(&s->vd);
|
|
|
|
vorbis_comment_clear(&s->vc);
|
|
|
|
vorbis_info_clear(&s->vi);
|
2012-02-14 19:29:24 +00:00
|
|
|
} else {
|
|
|
|
/* clear OggVorbis_File handle */
|
|
|
|
ov_clear(&s->ov_f);
|
2005-07-20 00:25:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Read a frame full of audio data from the filestream.
|
2006-07-19 22:40:36 +00:00
|
|
|
* \param fs The filestream.
|
2005-07-20 00:25:54 +00:00
|
|
|
* \param whennext Number of sample times to schedule the next call.
|
|
|
|
* \return A pointer to a frame containing audio data or NULL ifthere is no more audio data.
|
|
|
|
*/
|
2006-04-04 15:40:47 +00:00
|
|
|
static struct ast_frame *ogg_vorbis_read(struct ast_filestream *fs,
|
2006-02-12 04:28:58 +00:00
|
|
|
int *whennext)
|
2005-07-20 00:25:54 +00:00
|
|
|
{
|
2012-02-14 19:29:24 +00:00
|
|
|
struct ogg_vorbis_desc *desc = (struct ogg_vorbis_desc *) fs->_private;
|
|
|
|
int current_bitstream = -10;
|
|
|
|
char *out_buf;
|
|
|
|
long bytes_read;
|
|
|
|
|
|
|
|
if (desc->writing) {
|
2012-06-07 20:00:29 +00:00
|
|
|
ast_log(LOG_WARNING, "Reading is not supported on OGG/Vorbis on write files.\n");
|
2012-02-14 19:29:24 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2012-02-14 19:29:24 +00:00
|
|
|
/* initialize frame */
|
2006-04-09 22:31:38 +00:00
|
|
|
AST_FRAME_SET_BUFFER(&fs->fr, fs->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
2012-02-14 19:29:24 +00:00
|
|
|
out_buf = (char *) (fs->fr.data.ptr); /* SLIN data buffer */
|
|
|
|
|
|
|
|
/* read samples from OV interface */
|
|
|
|
bytes_read = ov_read(
|
|
|
|
&desc->ov_f,
|
|
|
|
out_buf, /* Buffer to write data */
|
|
|
|
BUF_SIZE, /* Size of buffer */
|
|
|
|
(__BYTE_ORDER == __BIG_ENDIAN), /* Endianes (0 for little) */
|
|
|
|
2, /* 1 = 8bit, 2 = 16bit */
|
|
|
|
1, /* 0 = unsigned, 1 = signed */
|
|
|
|
¤t_bitstream /* Returns the current bitstream section */
|
|
|
|
);
|
|
|
|
|
|
|
|
/* check returned data */
|
|
|
|
if (bytes_read <= 0) {
|
|
|
|
/* End of stream */
|
2005-07-20 00:25:54 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2012-02-14 19:29:24 +00:00
|
|
|
|
|
|
|
/* Return decoded bytes */
|
|
|
|
fs->fr.datalen = bytes_read;
|
|
|
|
fs->fr.samples = bytes_read / 2;
|
|
|
|
*whennext = fs->fr.samples;
|
|
|
|
return &fs->fr;
|
2005-07-20 00:25:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Trucate an OGG/Vorbis filestream.
|
2012-08-30 14:23:28 +00:00
|
|
|
* \param fs The filestream to truncate.
|
2005-07-20 00:25:54 +00:00
|
|
|
* \return 0 on success, -1 on failure.
|
|
|
|
*/
|
|
|
|
|
2012-02-14 19:29:24 +00:00
|
|
|
static int ogg_vorbis_trunc(struct ast_filestream *fs)
|
2005-07-20 00:25:54 +00:00
|
|
|
{
|
|
|
|
ast_log(LOG_WARNING, "Truncation is not supported on OGG/Vorbis streams!\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-02-14 19:29:24 +00:00
|
|
|
/*!
|
|
|
|
* \brief Tell the current position in OGG/Vorbis filestream measured in pcms.
|
2012-08-30 14:23:28 +00:00
|
|
|
* \param fs The filestream to take action on.
|
2012-02-14 19:29:24 +00:00
|
|
|
* \return 0 or greater with the position measured in samples, or -1 for false.
|
|
|
|
*/
|
|
|
|
static off_t ogg_vorbis_tell(struct ast_filestream *fs)
|
|
|
|
{
|
|
|
|
off_t pos;
|
|
|
|
struct ogg_vorbis_desc *desc = (struct ogg_vorbis_desc *) fs->_private;
|
|
|
|
|
|
|
|
if (desc->writing) {
|
|
|
|
return desc->writing_pcm_pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((pos = ov_pcm_tell(&desc->ov_f)) < 0) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
|
2005-07-20 00:25:54 +00:00
|
|
|
/*!
|
|
|
|
* \brief Seek to a specific position in an OGG/Vorbis filestream.
|
2012-08-30 14:23:28 +00:00
|
|
|
* \param fs The filestream to take action on.
|
2005-07-20 00:25:54 +00:00
|
|
|
* \param sample_offset New position for the filestream, measured in 8KHz samples.
|
2017-12-22 14:23:22 +00:00
|
|
|
* \param whence Location to measure
|
2005-07-20 00:25:54 +00:00
|
|
|
* \return 0 on success, -1 on failure.
|
|
|
|
*/
|
2012-02-14 19:29:24 +00:00
|
|
|
static int ogg_vorbis_seek(struct ast_filestream *fs, off_t sample_offset, int whence)
|
2006-04-04 15:40:47 +00:00
|
|
|
{
|
2012-02-14 19:29:24 +00:00
|
|
|
int seek_result = -1;
|
|
|
|
off_t relative_pcm_pos;
|
|
|
|
struct ogg_vorbis_desc *desc = (struct ogg_vorbis_desc *) fs->_private;
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2012-02-14 19:29:24 +00:00
|
|
|
if (desc->writing) {
|
|
|
|
ast_log(LOG_WARNING, "Seeking is not supported on OGG/Vorbis streams in writing mode!\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ov_pcm_seek support seeking only from begining (SEEK_SET), the rest must be emulated */
|
|
|
|
switch (whence) {
|
|
|
|
case SEEK_SET:
|
|
|
|
seek_result = ov_pcm_seek(&desc->ov_f, sample_offset);
|
|
|
|
break;
|
|
|
|
case SEEK_CUR:
|
|
|
|
if ((relative_pcm_pos = ogg_vorbis_tell(fs)) < 0) {
|
|
|
|
seek_result = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
seek_result = ov_pcm_seek(&desc->ov_f, relative_pcm_pos + sample_offset);
|
|
|
|
break;
|
|
|
|
case SEEK_END:
|
|
|
|
if ((relative_pcm_pos = ov_pcm_total(&desc->ov_f, -1)) < 0) {
|
|
|
|
seek_result = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
seek_result = ov_pcm_seek(&desc->ov_f, relative_pcm_pos - sample_offset);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ast_log(LOG_WARNING, "Unknown *whence* to seek on OGG/Vorbis streams!\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* normalize error value to -1,0 */
|
|
|
|
return (seek_result == 0) ? 0 : -1;
|
2005-07-20 00:25:54 +00:00
|
|
|
}
|
|
|
|
|
2011-02-03 16:22:10 +00:00
|
|
|
static struct ast_format_def vorbis_f = {
|
2006-04-04 15:40:47 +00:00
|
|
|
.name = "ogg_vorbis",
|
|
|
|
.exts = "ogg",
|
2006-04-04 12:59:25 +00:00
|
|
|
.open = ogg_vorbis_open,
|
|
|
|
.rewrite = ogg_vorbis_rewrite,
|
|
|
|
.write = ogg_vorbis_write,
|
|
|
|
.seek = ogg_vorbis_seek,
|
|
|
|
.trunc = ogg_vorbis_trunc,
|
|
|
|
.tell = ogg_vorbis_tell,
|
|
|
|
.read = ogg_vorbis_read,
|
|
|
|
.close = ogg_vorbis_close,
|
2006-04-04 15:40:47 +00:00
|
|
|
.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
|
2012-02-14 19:29:24 +00:00
|
|
|
.desc_size = sizeof(struct ogg_vorbis_desc),
|
2006-04-04 12:59:25 +00:00
|
|
|
};
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
static int load_module(void)
|
2005-07-20 00:25:54 +00:00
|
|
|
{
|
media formats: re-architect handling of media for performance improvements
In the old times media formats were represented using a bit field. This was
fast but had a few limitations.
1. Asterisk was limited in how many formats it could handle.
2. Formats, being a bit field, could not include any attribute information.
A format was strictly its type, e.g., "this is ulaw".
This was changed in Asterisk 10 (see
https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal for
notes on that work) which led to the creation of the ast_format structure.
This structure allowed Asterisk to handle attributes and bundle information
with a format.
Additionally, ast_format_cap was created to act as a container for multiple
formats that, together, formed the capability of some entity. Another
mechanism was added to allow logic to be registered which performed format
attribute negotiation. Everywhere throughout the codebase Asterisk was
changed to use this strategy.
Unfortunately, in software, there is no free lunch. These new capabilities
came at a cost.
Performance analysis and profiling showed that we spend an inordinate
amount of time comparing, copying, and generally manipulating formats and
their related structures. Basic prototyping has shown that a reasonably
large performance improvement could be made in this area. This patch is the
result of that project, which overhauled the media format architecture
and its usage in Asterisk to improve performance.
Generally, the new philosophy for handling formats is as follows:
* The ast_format structure is reference counted. This removed a large amount
of the memory allocations and copying that was done in prior versions.
* In order to prevent race conditions while keeping things performant, the
ast_format structure is immutable by convention and lock-free. Violate this
tenet at your peril!
* Because formats are reference counted, codecs are also reference counted.
The Asterisk core generally provides built-in codecs and caches the
ast_format structures created to represent them. Generally, to prevent
inordinate amounts of module reference bumping, codecs and formats can be
added at run-time but cannot be removed.
* All compatibility with the bit field representation of codecs/formats has
been moved to a compatibility API. The primary user of this representation
is chan_iax2, which must continue to maintain its bit-field usage of formats
for interoperability concerns.
* When a format is negotiated with attributes, or when a format cannot be
represented by one of the cached formats, a new format object is created or
cloned from an existing format. That format may have the same codec
underlying it, but is a different format than a version of the format with
different attributes or without attributes.
* While formats are reference counted objects, the reference count maintained
on the format should be manipulated with care. Formats are generally cached
and will persist for the lifetime of Asterisk and do not explicitly need
to have their lifetime modified. An exception to this is when the user of a
format does not know where the format came from *and* the user may outlive
the provider of the format. This occurs, for example, when a format is read
from a channel: the channel may have a format with attributes (hence,
non-cached) and the user of the format may last longer than the channel (if
the reference to the channel is released prior to the format's reference).
For more information on this work, see the API design notes:
https://wiki.asterisk.org/wiki/display/AST/Media+Format+Rewrite
Finally, this work was the culmination of a large number of developer's
efforts. Extra thanks goes to Corey Farrell, who took on a large amount of the
work in the Asterisk core, chan_sip, and was an invaluable resource in peer
reviews throughout this project.
There were a substantial number of patches contributed during this work; the
following issues/patch names simply reflect some of the work (and will cause
the release scripts to give attribution to the individuals who work on them).
Reviews:
https://reviewboard.asterisk.org/r/3814
https://reviewboard.asterisk.org/r/3808
https://reviewboard.asterisk.org/r/3805
https://reviewboard.asterisk.org/r/3803
https://reviewboard.asterisk.org/r/3801
https://reviewboard.asterisk.org/r/3798
https://reviewboard.asterisk.org/r/3800
https://reviewboard.asterisk.org/r/3794
https://reviewboard.asterisk.org/r/3793
https://reviewboard.asterisk.org/r/3792
https://reviewboard.asterisk.org/r/3791
https://reviewboard.asterisk.org/r/3790
https://reviewboard.asterisk.org/r/3789
https://reviewboard.asterisk.org/r/3788
https://reviewboard.asterisk.org/r/3787
https://reviewboard.asterisk.org/r/3786
https://reviewboard.asterisk.org/r/3784
https://reviewboard.asterisk.org/r/3783
https://reviewboard.asterisk.org/r/3778
https://reviewboard.asterisk.org/r/3774
https://reviewboard.asterisk.org/r/3775
https://reviewboard.asterisk.org/r/3772
https://reviewboard.asterisk.org/r/3761
https://reviewboard.asterisk.org/r/3754
https://reviewboard.asterisk.org/r/3753
https://reviewboard.asterisk.org/r/3751
https://reviewboard.asterisk.org/r/3750
https://reviewboard.asterisk.org/r/3748
https://reviewboard.asterisk.org/r/3747
https://reviewboard.asterisk.org/r/3746
https://reviewboard.asterisk.org/r/3742
https://reviewboard.asterisk.org/r/3740
https://reviewboard.asterisk.org/r/3739
https://reviewboard.asterisk.org/r/3738
https://reviewboard.asterisk.org/r/3737
https://reviewboard.asterisk.org/r/3736
https://reviewboard.asterisk.org/r/3734
https://reviewboard.asterisk.org/r/3722
https://reviewboard.asterisk.org/r/3713
https://reviewboard.asterisk.org/r/3703
https://reviewboard.asterisk.org/r/3689
https://reviewboard.asterisk.org/r/3687
https://reviewboard.asterisk.org/r/3674
https://reviewboard.asterisk.org/r/3671
https://reviewboard.asterisk.org/r/3667
https://reviewboard.asterisk.org/r/3665
https://reviewboard.asterisk.org/r/3625
https://reviewboard.asterisk.org/r/3602
https://reviewboard.asterisk.org/r/3519
https://reviewboard.asterisk.org/r/3518
https://reviewboard.asterisk.org/r/3516
https://reviewboard.asterisk.org/r/3515
https://reviewboard.asterisk.org/r/3512
https://reviewboard.asterisk.org/r/3506
https://reviewboard.asterisk.org/r/3413
https://reviewboard.asterisk.org/r/3410
https://reviewboard.asterisk.org/r/3387
https://reviewboard.asterisk.org/r/3388
https://reviewboard.asterisk.org/r/3389
https://reviewboard.asterisk.org/r/3390
https://reviewboard.asterisk.org/r/3321
https://reviewboard.asterisk.org/r/3320
https://reviewboard.asterisk.org/r/3319
https://reviewboard.asterisk.org/r/3318
https://reviewboard.asterisk.org/r/3266
https://reviewboard.asterisk.org/r/3265
https://reviewboard.asterisk.org/r/3234
https://reviewboard.asterisk.org/r/3178
ASTERISK-23114 #close
Reported by: mjordan
media_formats_translation_core.diff uploaded by kharwell (License 6464)
rb3506.diff uploaded by mjordan (License 6283)
media_format_app_file.diff uploaded by kharwell (License 6464)
misc-2.diff uploaded by file (License 5000)
chan_mild-3.diff uploaded by file (License 5000)
chan_obscure.diff uploaded by file (License 5000)
jingle.diff uploaded by file (License 5000)
funcs.diff uploaded by file (License 5000)
formats.diff uploaded by file (License 5000)
core.diff uploaded by file (License 5000)
bridges.diff uploaded by file (License 5000)
mf-codecs-2.diff uploaded by file (License 5000)
mf-app_fax.diff uploaded by file (License 5000)
mf-apps-3.diff uploaded by file (License 5000)
media-formats-3.diff uploaded by file (License 5000)
ASTERISK-23715
rb3713.patch uploaded by coreyfarrell (License 5909)
rb3689.patch uploaded by mjordan (License 6283)
ASTERISK-23957
rb3722.patch uploaded by mjordan (License 6283)
mf-attributes-3.diff uploaded by file (License 5000)
ASTERISK-23958
Tested by: jrose
rb3822.patch uploaded by coreyfarrell (License 5909)
rb3800.patch uploaded by jrose (License 6182)
chan_sip.diff uploaded by mjordan (License 6283)
rb3747.patch uploaded by jrose (License 6182)
ASTERISK-23959 #close
Tested by: sgriepentrog, mjordan, coreyfarrell
sip_cleanup.diff uploaded by opticron (License 6273)
chan_sip_caps.diff uploaded by mjordan (License 6283)
rb3751.patch uploaded by coreyfarrell (License 5909)
chan_sip-3.diff uploaded by file (License 5000)
ASTERISK-23960 #close
Tested by: opticron
direct_media.diff uploaded by opticron (License 6273)
pjsip-direct-media.diff uploaded by file (License 5000)
format_cap_remove.diff uploaded by opticron (License 6273)
media_format_fixes.diff uploaded by opticron (License 6273)
chan_pjsip-2.diff uploaded by file (License 5000)
ASTERISK-23966 #close
Tested by: rmudgett
rb3803.patch uploaded by rmudgetti (License 5621)
chan_dahdi.diff uploaded by file (License 5000)
ASTERISK-24064 #close
Tested by: coreyfarrell, mjordan, opticron, file, rmudgett, sgriepentrog, jrose
rb3814.patch uploaded by rmudgett (License 5621)
moh_cleanup.diff uploaded by opticron (License 6273)
bridge_leak.diff uploaded by opticron (License 6273)
translate.diff uploaded by file (License 5000)
rb3795.patch uploaded by rmudgett (License 5621)
tls_fix.diff uploaded by mjordan (License 6283)
fax-mf-fix-2.diff uploaded by file (License 5000)
rtp_transfer_stuff uploaded by mjordan (License 6283)
rb3787.patch uploaded by rmudgett (License 5621)
media-formats-explicit-translate-format-3.diff uploaded by file (License 5000)
format_cache_case_fix.diff uploaded by opticron (License 6273)
rb3774.patch uploaded by rmudgett (License 5621)
rb3775.patch uploaded by rmudgett (License 5621)
rtp_engine_fix.diff uploaded by opticron (License 6273)
rtp_crash_fix.diff uploaded by opticron (License 6273)
rb3753.patch uploaded by mjordan (License 6283)
rb3750.patch uploaded by mjordan (License 6283)
rb3748.patch uploaded by rmudgett (License 5621)
media_format_fixes.diff uploaded by opticron (License 6273)
rb3740.patch uploaded by mjordan (License 6283)
rb3739.patch uploaded by mjordan (License 6283)
rb3734.patch uploaded by mjordan (License 6283)
rb3689.patch uploaded by mjordan (License 6283)
rb3674.patch uploaded by coreyfarrell (License 5909)
rb3671.patch uploaded by coreyfarrell (License 5909)
rb3667.patch uploaded by coreyfarrell (License 5909)
rb3665.patch uploaded by mjordan (License 6283)
rb3625.patch uploaded by coreyfarrell (License 5909)
rb3602.patch uploaded by coreyfarrell (License 5909)
format_compatibility-2.diff uploaded by file (License 5000)
core.diff uploaded by file (License 5000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-20 22:06:33 +00:00
|
|
|
vorbis_f.format = ast_format_slin;
|
2011-02-03 16:22:10 +00:00
|
|
|
if (ast_format_def_register(&vorbis_f))
|
2017-04-11 16:07:39 +00:00
|
|
|
return AST_MODULE_LOAD_DECLINE;
|
2007-10-31 19:24:29 +00:00
|
|
|
return AST_MODULE_LOAD_SUCCESS;
|
2005-07-20 00:25:54 +00:00
|
|
|
}
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
static int unload_module(void)
|
2005-07-20 00:25:54 +00:00
|
|
|
{
|
2011-02-03 16:22:10 +00:00
|
|
|
return ast_format_def_unregister(vorbis_f.name);
|
2006-02-12 04:28:58 +00:00
|
|
|
}
|
2005-07-20 00:25:54 +00:00
|
|
|
|
2010-07-26 03:28:02 +00:00
|
|
|
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "OGG/Vorbis audio",
|
2014-07-25 16:47:17 +00:00
|
|
|
.support_level = AST_MODULE_SUPPORT_CORE,
|
2010-07-26 03:28:02 +00:00
|
|
|
.load = load_module,
|
|
|
|
.unload = unload_module,
|
|
|
|
.load_pri = AST_MODPRI_APP_DEPEND
|
|
|
|
);
|