Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in / Register
Toggle navigation
J
jami-daemon
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
118
Issues
118
List
Boards
Labels
Milestones
Security & Compliance
Security & Compliance
Dependency List
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
savoirfairelinux
jami-daemon
Commits
de0678b0
Commit
de0678b0
authored
Mar 25, 2015
by
Éloi Bail
Committed by
Gerrit Code Review
Mar 25, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
daemon: cleanup useless code
Refs #67223 Change-Id: I5c7b46129eedcec668f9e323e0c6a05108800660
parent
ee3e434b
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
29 additions
and
2771 deletions
+29
-2771
src/iax/iaxcall.h
src/iax/iaxcall.h
+26
-0
src/iax/iaxvoiplink.h
src/iax/iaxvoiplink.h
+3
-1
src/media/audio/codecs/Makefile.am
src/media/audio/codecs/Makefile.am
+0
-120
src/media/audio/codecs/README
src/media/audio/codecs/README
+0
-24
src/media/audio/codecs/alaw.cpp
src/media/audio/codecs/alaw.cpp
+0
-97
src/media/audio/codecs/audiocodec.cpp
src/media/audio/codecs/audiocodec.cpp
+0
-153
src/media/audio/codecs/audiocodec.h
src/media/audio/codecs/audiocodec.h
+0
-221
src/media/audio/codecs/g711.h
src/media/audio/codecs/g711.h
+0
-354
src/media/audio/codecs/g722.cpp
src/media/audio/codecs/g722.cpp
+0
-781
src/media/audio/codecs/g722.h
src/media/audio/codecs/g722.h
+0
-97
src/media/audio/codecs/g729.cpp
src/media/audio/codecs/g729.cpp
+0
-119
src/media/audio/codecs/g729.h
src/media/audio/codecs/g729.h
+0
-64
src/media/audio/codecs/gsmcodec.cpp
src/media/audio/codecs/gsmcodec.cpp
+0
-110
src/media/audio/codecs/ilbc.cpp
src/media/audio/codecs/ilbc.cpp
+0
-85
src/media/audio/codecs/opuscodec.cpp
src/media/audio/codecs/opuscodec.cpp
+0
-187
src/media/audio/codecs/opuscodec.h
src/media/audio/codecs/opuscodec.h
+0
-86
src/media/audio/codecs/speexcodec.cpp
src/media/audio/codecs/speexcodec.cpp
+0
-62
src/media/audio/codecs/speexcodec.h
src/media/audio/codecs/speexcodec.h
+0
-112
src/media/audio/codecs/ulaw.cpp
src/media/audio/codecs/ulaw.cpp
+0
-98
No files found.
src/iax/iaxcall.h
View file @
de0678b0
...
...
@@ -47,6 +47,32 @@ class IAXAccount;
class
RingBuffer
;
class
AudioBuffer
;
/** Enumeration that contains known audio payloads */
enum
{
// http://www.iana.org/assignments/rtp-parameters
// http://www.gnu.org/software/ccrtp/doc/refman/html/formats_8h.html#a0
// 0 PCMU A 8000 1 [RFC3551]
PAYLOAD_CODEC_ULAW
=
0
,
// 3 GSM A 8000 1 [RFC3551]
PAYLOAD_CODEC_GSM
=
3
,
// 8 PCMA A 8000 1 [RFC3551]
PAYLOAD_CODEC_ALAW
=
8
,
// 9 G722 A 8000 1 [RFC3551]
PAYLOAD_CODEC_G722
=
9
,
// http://www.ietf.org/rfc/rfc3952.txt
// 97 iLBC/8000
PAYLOAD_CODEC_ILBC_20
=
97
,
PAYLOAD_CODEC_ILBC_30
=
98
,
// http://www.speex.org/drafts/draft-herlein-speex-rtp-profile-00.txt
// 97 speex/8000
// http://support.xten.com/viewtopic.php?p=8684&sid=3367a83d01fdcad16c7459a79859b08e
// 100 speex/16000
PAYLOAD_CODEC_SPEEX_8000
=
110
,
PAYLOAD_CODEC_SPEEX_16000
=
111
,
PAYLOAD_CODEC_SPEEX_32000
=
112
};
/**
* @file: iaxcall.h
* @brief IAXCall are IAX implementation of a normal Call
...
...
src/iax/iaxvoiplink.h
View file @
de0678b0
...
...
@@ -38,7 +38,6 @@
#endif
#include "audio/audiobuffer.h"
#include "audio/codecs/audiocodec.h" // for RAW_BUFFER_SIZE
#include "ring_types.h"
#include <iax/iax-client.h>
...
...
@@ -47,6 +46,9 @@
#include <memory>
#include <random>
#define RAW_BUFFER_SIZE (120 * 48000 / 1000)
namespace
ring
{
class
IAXAccount
;
...
...
src/media/audio/codecs/Makefile.am
deleted
100644 → 0
View file @
ee3e434b
include
$(top_srcdir)/globals.mak
noinst_LTLIBRARIES
=
libcodecdescriptor.la
libcodecdescriptor_la_SOURCES
=
audiocodecfactory.cpp audiocodec.cpp audiocodec.h audiocodecfactory.h
libcodecdescriptor_la_CXXFLAGS
=
-fPIC
if
BUILD_GSM
GSM_LIB
=
libcodec_gsm.so
libcodec_gsm_so_SOURCES
=
gsmcodec.cpp
libcodec_gsm_so_CXXFLAGS
=
-fPIC
-g
-Wall
libcodec_gsm_so_LDFLAGS
=
--shared
-lc
-lgsm
libcodec_gsm_so_LDADD
=
libcodecdescriptor.la
INSTALL_GSM_RULE
=
install-libcodec_gsm_so
endif
if
BUILD_SPEEX
SPEEX_LIB
=
libcodec_speex.so
libcodec_speex_so_SOURCES
=
speexcodec.cpp speexcodec.h
libcodec_speex_so_CXXFLAGS
=
-fPIC
-g
-Wall
@SPEEX_CFLAGS@
libcodec_speex_so_LDFLAGS
=
--shared
-lc
@SPEEX_LIBS@
libcodec_speex_so_LDADD
=
libcodecdescriptor.la
INSTALL_SPEEX_RULE
=
install-libcodec_speex_so
endif
if
BUILD_OPUS
OPUS_LIB
=
libcodec_opus.so
libcodec_opus_so_SOURCES
=
opuscodec.cpp opuscodec.h
libcodec_opus_so_CXXFLAGS
=
-fPIC
-g
-Wall
$(opus_CFLAGS)
libcodec_opus_so_LDFLAGS
=
--shared
-lc
-lstdc
++
$(opus_LIBS)
libcodec_opus_so_LDADD
=
libcodecdescriptor.la
INSTALL_OPUS_RULE
=
install-libcodec_opus_so
endif
if
BUILD_ILBC
ILBC_LIB
=
libcodec_ilbc.so
libcodecdescriptor_la_CXXFLAGS
+=
-DBUILD_ILBC
libcodec_ilbc_so_SOURCES
=
ilbc.cpp
libcodec_ilbc_so_CXXFLAGS
=
-fPIC
-g
-Wall
$(libilbc_CFLAGS)
libcodec_ilbc_so_LDFLAGS
=
--shared
-lc
$(libilbc_LIBS)
libcodec_ilbc_so_LDADD
=
libcodecdescriptor.la
INSTALL_ILBC_RULE
=
install-libcodec_ilbc_so
endif
noinst_PROGRAMS
=
libcodec_ulaw.so libcodec_alaw.so libcodec_g722.so libcodec_g729.so
$(OPUS_LIB)
$(GSM_LIB)
$(SPEEX_LIB)
$(ILBC_LIB)
libcodec_ulaw_so_SOURCES
=
ulaw.cpp g711.h
libcodec_ulaw_so_CXXFLAGS
=
-fPIC
-g
-Wall
libcodec_ulaw_so_LDADD
=
libcodecdescriptor.la
libcodec_ulaw_so_LDFLAGS
=
--shared
-lc
libcodec_alaw_so_SOURCES
=
alaw.cpp g711.h
libcodec_alaw_so_CXXFLAGS
=
-fPIC
-g
-Wall
libcodec_alaw_so_LDADD
=
libcodecdescriptor.la
libcodec_alaw_so_LDFLAGS
=
--shared
-lc
libcodec_g722_so_SOURCES
=
g722.cpp g722.h
libcodec_g722_so_CXXFLAGS
=
-fPIC
-g
-Wall
libcodec_g722_so_LDADD
=
libcodecdescriptor.la
libcodec_g722_so_LDFLAGS
=
--shared
-lc
libcodec_g729_so_SOURCES
=
g729.cpp g729.h
libcodec_g729_so_CXXFLAGS
=
-fPIC
-g
-Wall
libcodec_g729_so_LDADD
=
libcodecdescriptor.la
libcodec_g729_so_LDFLAGS
=
--shared
-lc
-ldl
-lstdc
++
install-exec-local
:
install-libcodec_ulaw_so install-libcodec_alaw_so install-libcodec_g722_so install-libcodec_g729_so $(INSTALL_OPUS_RULE) $(INSTALL_GSM_RULE) $(INSTALL_SPEEX_NB_RULE) $(INSTALL_SPEEX_WB_RULE) $(INSTALL_SPEEX_UB_RULE) $(INSTALL_ILBC_RULE)
uninstall-local
:
uninstall-libcodec_ulaw_so uninstall-libcodec_alaw_so uninstall-libcodec_g722_so uninstall-libcodec_g729_so uninstall-libcodec_opus_so uninstall-libcodec_gsm_so uninstall-libcodec_speex_nb_so uninstall-libcodec_speex_wb_so uninstall-libcodec_speex_ub_so uninstall-libcodec_ilbc_so
install-libcodec_ulaw_so
:
libcodec_ulaw.so
mkdir
-p
$(sflcodecdir)
$(INSTALL_PROGRAM)
libcodec_ulaw.so
$(sflcodecdir)
install-libcodec_alaw_so
:
libcodec_alaw.so
mkdir
-p
$(sflcodecdir)
$(INSTALL_PROGRAM)
libcodec_alaw.so
$(sflcodecdir)
install-libcodec_g722_so
:
libcodec_g722.so
mkdir
-p
$(sflcodecdir)
$(INSTALL_PROGRAM)
libcodec_g722.so
$(sflcodecdir)
install-libcodec_g729_so
:
libcodec_g729.so
mkdir
-p
$(sflcodecdir)
$(INSTALL_PROGRAM)
libcodec_g729.so
$(sflcodecdir)
install-libcodec_opus_so
:
libcodec_opus.so
mkdir
-p
$(sflcodecdir)
$(INSTALL_PROGRAM)
libcodec_opus.so
$(sflcodecdir)
install-libcodec_gsm_so
:
libcodec_gsm.so
mkdir
-p
$(sflcodecdir)
$(INSTALL_PROGRAM)
libcodec_gsm.so
$(sflcodecdir)
install-libcodec_speex_nb_so
:
libcodec_speex_nb.so
mkdir
-p
$(sflcodecdir)
$(INSTALL_PROGRAM)
libcodec_speex_nb.so
$(sflcodecdir)
install-libcodec_speex_wb_so
:
libcodec_speex_wb.so
mkdir
-p
$(sflcodecdir)
$(INSTALL_PROGRAM)
libcodec_speex_wb.so
$(sflcodecdir)
install-libcodec_speex_ub_so
:
libcodec_speex_ub.so
mkdir
-p
$(sflcodecdir)
$(INSTALL_PROGRAM)
libcodec_speex_ub.so
$(sflcodecdir)
install-libcodec_ilbc_so
:
libcodec_ilbc.so
mkdir
-p
$(sflcodecdir)
$(INSTALL_PROGRAM)
libcodec_ilbc.so
$(sflcodecdir)
uninstall-libcodec_ulaw_so
:
rm
-f
$(sflcodecdir)
/libcodec_ulaw.so
uninstall-libcodec_alaw_so
:
rm
-f
$(sflcodecdir)
/libcodec_alaw.so
uninstall-libcodec_g722_so
:
rm
-f
$(sflcodecdir)
/libcodec_g722.so
uninstall-libcodec_g729_so
:
rm
-f
$(sflcodecdir)
/libcodec_g729.so
uninstall-libcodec_opus_so
:
rm
-f
$(sflcodecdir)
/libcodec_opus.so
uninstall-libcodec_gsm_so
:
rm
-f
$(sflcodecdir)
/libcodec_gsm.so
uninstall-libcodec_speex_nb_so
:
rm
-f
$(sflcodecdir)
/libcodec_speex_nb.so
uninstall-libcodec_speex_wb_so
:
rm
-f
$(sflcodecdir)
/libcodec_speex_wb.so
uninstall-libcodec_speex_ub_so
:
rm
-f
$(sflcodecdir)
/libcodec_speex_ub.so
uninstall-libcodec_ilbc_so
:
rm
-f
$(sflcodecdir)
/libcodec_ilbc.so
src/media/audio/codecs/README
deleted
100644 → 0
View file @
ee3e434b
How to build the codec shared libraries
---------------------------------------
CODEC_ALAW:
gcc -fPIC -g -c -Wall ulaw.cpp
-------> gives you the object file ulaw.o.
-------> option -g to include debug information
-------> option -Wall to generate warnings
-------> option -fPIC to enable position independant code generation
gcc -shared -o libcodec_ulaw.so ulaw.o -lc
-------> creates the shared library
CODEC ALAW:
idem
CODEC_GSM:
gcc -fPIC -g -c -Wall gsmcodec.cpp
gcc -shared -o -libcodec_gsm.so gsmcodec.o -lc -lgsm
-------> You need the standard library libgsm1 installed (with dev package).
REFERENCES: http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html
The shared library should be installed in $(libdir)/ring/codecs where libdir=$(PREFIX)/lib.
src/media/audio/codecs/alaw.cpp
deleted
100644 → 0
View file @
ee3e434b
/*
* Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
* Author: Yan Morin <yan.morin@savoirfairelinux.com>
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#include "ring_types.h"
#include "audiocodec.h"
#include "ring_plugin.h"
#include "g711.h"
class
Alaw
:
public
ring
::
AudioCodec
{
public:
// 8 PCMA A 8000 1 [RFC3551]
Alaw
()
:
ring
::
AudioCodec
(
8
,
"PCMA"
,
8000
,
160
,
1
)
{
bitrate_
=
64
;
hasDynamicPayload_
=
false
;
}
private:
AudioCodec
*
clone
()
{
return
new
Alaw
;
}
int
decode
(
ring
::
AudioSample
*
pcm
,
unsigned
char
*
data
,
size_t
len
)
{
for
(
unsigned
char
*
end
=
data
+
len
;
data
<
end
;
++
data
,
++
pcm
)
*
pcm
=
ALawDecode
(
*
data
);
return
len
;
}
int
encode
(
unsigned
char
*
data
,
ring
::
AudioSample
*
pcm
,
size_t
max_data_bytes
)
{
unsigned
char
*
end
=
std
::
min
(
data
+
frameSize_
,
data
+
max_data_bytes
);
unsigned
char
*
tmp
=
data
;
for
(;
tmp
<
end
;
++
pcm
,
++
tmp
)
*
tmp
=
ALawEncode
(
*
pcm
);
return
end
-
data
;
}
static
ring
::
AudioSample
ALawDecode
(
unsigned
char
alaw
)
{
return
alaw_to_linear
(
alaw
);
}
static
unsigned
char
ALawEncode
(
ring
::
AudioSample
pcm16
)
{
return
linear_to_alaw
(
pcm16
);
}
};
// the class factories
// cppcheck-suppress unusedFunction
RING_PLUGIN_EXIT
(
pluginExit
)
{}
// cppcheck-suppress unusedFunction
RING_PLUGIN_INIT_DYNAMIC
(
pluginAPI
)
{
std
::
unique_ptr
<
Alaw
>
codec
(
new
Alaw
);
if
(
!
pluginAPI
->
invokeService
(
pluginAPI
,
"registerAudioCodec"
,
reinterpret_cast
<
void
*>
(
codec
.
get
())))
{
codec
.
release
();
return
pluginExit
;
}
return
nullptr
;
}
src/media/audio/codecs/audiocodec.cpp
deleted
100644 → 0
View file @
ee3e434b
/*
* Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
*
* Mostly borrowed from asterisk's sources (Steve Underwood <steveu@coppice.org>)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#include "audiocodec.h"
#include <cassert>
namespace
ring
{
using
std
::
ptrdiff_t
;
AudioCodec
::
AudioCodec
(
uint8_t
payload
,
const
std
::
string
&
codecName
,
uint32_t
clockRate
,
unsigned
frameSize
,
uint8_t
channels
)
:
codecName_
(
codecName
),
clockRate_
(
clockRate
),
clockRateCur_
(
clockRate
),
channels_
(
channels
),
channelsCur_
(
channels
),
frameSize_
(
frameSize
),
bitrate_
(
0.0
),
payload_
(
payload
),
hasDynamicPayload_
((
payload_
>=
96
and
payload_
<=
127
)
or
payload_
==
9
)
{}
AudioCodec
::
AudioCodec
(
const
AudioCodec
&
c
)
:
codecName_
(
c
.
codecName_
),
clockRate_
(
c
.
clockRate_
),
clockRateCur_
(
c
.
clockRateCur_
),
channels_
(
c
.
channels_
),
channelsCur_
(
c
.
channelsCur_
),
frameSize_
(
c
.
frameSize_
),
bitrate_
(
c
.
bitrate_
),
payload_
(
c
.
payload_
),
hasDynamicPayload_
(
c
.
hasDynamicPayload_
)
{}
int
AudioCodec
::
decode
(
AudioSample
*
,
unsigned
char
*
,
size_t
)
{
// Unimplemented!
assert
(
false
);
return
0
;
}
int
AudioCodec
::
encode
(
unsigned
char
*
,
AudioSample
*
,
size_t
)
{
// Unimplemented!
assert
(
false
);
return
0
;
}
// Mono only, subclasses must implement multichannel support
int
AudioCodec
::
decode
(
std
::
vector
<
std
::
vector
<
AudioSample
>
>
&
pcm
,
const
uint8_t
*
data
,
size_t
len
)
{
return
decode
(
pcm
[
0
].
data
(),
const_cast
<
uint8_t
*>
(
data
),
len
);
}
// Mono only, subclasses must implement multichannel support
size_t
AudioCodec
::
encode
(
const
std
::
vector
<
std
::
vector
<
AudioSample
>
>
&
pcm
,
uint8_t
*
data
,
size_t
len
)
{
return
encode
(
data
,
const_cast
<
AudioSample
*>
(
pcm
[
0
].
data
()),
len
);
}
int
AudioCodec
::
decode
(
std
::
vector
<
std
::
vector
<
AudioSample
>
>
&
pcm
)
{
pcm
.
clear
();
return
frameSize_
;
}
std
::
string
AudioCodec
::
getMimeSubtype
()
const
{
return
codecName_
;
}
uint8_t
AudioCodec
::
getPayloadType
()
const
{
return
payload_
;
}
bool
AudioCodec
::
hasDynamicPayload
()
const
{
return
hasDynamicPayload_
;
}
uint32_t
AudioCodec
::
getClockRate
()
const
{
return
clockRate_
;
}
uint32_t
AudioCodec
::
getCurrentClockRate
()
const
{
return
clockRateCur_
;
}
uint32_t
AudioCodec
::
getSDPClockRate
()
const
{
return
clockRate_
;
}
unsigned
AudioCodec
::
getFrameSize
()
const
{
return
frameSize_
;
}
double
AudioCodec
::
getBitRate
()
const
{
return
bitrate_
;
}
uint8_t
AudioCodec
::
getChannels
()
const
{
return
channels_
;
}
uint8_t
AudioCodec
::
getCurrentChannels
()
const
{
return
channelsCur_
;
}
const
char
*
AudioCodec
::
getSDPChannels
()
const
{
return
""
;
}
}
// namespace ring
src/media/audio/codecs/audiocodec.h
deleted
100644 → 0
View file @
ee3e434b
/*
* Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
*
* Mostly borrowed from asterisk's sources (Steve Underwood <steveu@coppice.org>)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifndef __AUDIO_CODEC_H__
#define __AUDIO_CODEC_H__
#include "ring_types.h"
#include <string>
#include <vector>
// Opus documentation:
// "If this is less than the maximum packet duration (120ms; 5760 for 48kHz),
// opus_decode will not be capable of decoding some packets."
#define RAW_BUFFER_SIZE (120 * 48000 / 1000)
namespace
ring
{
class
AudioCodec
{
public:
AudioCodec
(
uint8_t
payload
,
const
std
::
string
&
codecName
,
uint32_t
clockRate
,
unsigned
frameSize
,
uint8_t
channels
);
/**
* Copy constructor.
*/
AudioCodec
(
const
AudioCodec
&
codec
);
virtual
AudioCodec
*
clone
()
=
0
;
virtual
~
AudioCodec
()
{};
std
::
string
getMimeSubtype
()
const
;
/**
* Multichannel version of decode().
* Default implementation calls mono version
*/
virtual
int
decode
(
std
::
vector
<
std
::
vector
<
AudioSample
>
>
&
pcm
,
const
uint8_t
*
data
,
size_t
len
);
/**
* Inform the codec of a lost packet and perform packet loss concealment.
* Default implementation fills dst with 0.
*/
virtual
int
decode
(
std
::
vector
<
std
::
vector
<
AudioSample
>
>
&
pcm
);
/**
* Multichannel version of encode().
* Default implementation calls encode() on the first channel (assume 1 channel).
* @return the number of bytes encoded
*/
virtual
size_t
encode
(
const
std
::
vector
<
std
::
vector
<
AudioSample
>
>
&
pcm
,
uint8_t
*
data
,
size_t
len
);
uint8_t
getPayloadType
()
const
;
void
setPayloadType
(
uint8_t
pt
)
{
payload_
=
pt
;
}
/**
* @return true if this payload is a dynamic one.
*/
bool
hasDynamicPayload
()
const
;
/**
* Having Packet Loss Concealment (PLC) supported means decode(dst) won't
* fill the buffer with 0 but will rather try to conceal the loss.
* @return true if the codec supports PLC, false otherwise.
*/
virtual
inline
bool
supportsPacketLossConcealment
()
const
{
return
false
;
}
/**
* @returns maximum supported clock rate (sample rate).
*/
uint32_t
getClockRate
()
const
;
/**
* @returns currently configured clock rate (sample rate).
*/
uint32_t
getCurrentClockRate
()
const
;
/**
* Clock-rate in SDP MAY be different than actual clock-rate
* (in derived classes).
* @returns Clock-rate as it should be reported by SDP
* during negociation.
*/
virtual
uint32_t
getSDPClockRate
()
const
;
double
getBitRate
()
const
;
/**
* @returns maximum supported channel number.
*/
uint8_t
getChannels
()
const
;
/**
* @returns currently configured channel number.
*/
uint8_t
getCurrentChannels
()
const
;
/**
* Channels in SDP MAY be different than actual channels.
* Should be an empty string EXCEPT for Opus which returns "2".
* @returns Supported channel number as it should be reported by SDP
* during negociation.
*/
virtual
const
char
*
getSDPChannels
()
const
;
/**
* @return the framing size for this codec.
*/
unsigned
int
getFrameSize
()
const
;
/**
* Set the sampling rate and channel number preferred by the core.
* May or may not be considered by the codec.
* Use getCurrentClockRate() and getCurrentChannels() to get the format
* used by the codec.
*/
virtual
void
setOptimalFormat
(
uint32_t
/* sample_rate */
,
uint8_t
/* channels */
)
{}
protected:
/**
* Decode an input buffer and fill the output buffer with the decoded data
* @param pcm: output signal
* @param data: input buffer to decode
* @param len: length of input buffer
* @return the number of samples decoded
*/
virtual
int
decode
(
AudioSample
*
pcm
,
unsigned
char
*
data
,
size_t
len
);
/**
* Encode an input buffer and fill the output buffer with the encoded data
* @param data: output buffer, must be at least as big as max_data_bytes
* @param pcm: input signal
* @param max_data_bytes: the maximum size of the encoded data buffer (data)
* @return the number of bytes encoded
*/
virtual
int
encode
(
unsigned
char
*
data
,
AudioSample
*
pcm
,
size_t
max_data_bytes
);
/** Holds SDP-compliant codec name */
std
::
string
codecName_
;
// what we put inside sdp
/** Clock rate or sample rate of the codec, in Hz */
uint32_t
clockRate_
,
clockRateCur_
;
/** Number of channels 1 = mono, 2 = stereo */
uint8_t
channels_
,
channelsCur_
;
/** codec frame size in samples*/
unsigned
frameSize_
;
/** Bitrate */
double
bitrate_
;
uint8_t
payload_
;
bool
hasDynamicPayload_
;
private:
AudioCodec
&
operator
=
(
const
AudioCodec
&
);
};
/** Enumeration that contains known audio payloads */
enum
{
// http://www.iana.org/assignments/rtp-parameters
// http://www.gnu.org/software/ccrtp/doc/refman/html/formats_8h.html#a0
// 0 PCMU A 8000 1 [RFC3551]
PAYLOAD_CODEC_ULAW
=
0
,
// 3 GSM A 8000 1 [RFC3551]
PAYLOAD_CODEC_GSM
=
3
,
// 8 PCMA A 8000 1 [RFC3551]
PAYLOAD_CODEC_ALAW
=
8
,
// 9 G722 A 8000 1 [RFC3551]
PAYLOAD_CODEC_G722
=
9
,
// http://www.ietf.org/rfc/rfc3952.txt
// 97 iLBC/8000
PAYLOAD_CODEC_ILBC_20
=
97
,
PAYLOAD_CODEC_ILBC_30
=
98
,
// http://www.speex.org/drafts/draft-herlein-speex-rtp-profile-00.txt
// 97 speex/8000
// http://support.xten.com/viewtopic.php?p=8684&sid=3367a83d01fdcad16c7459a79859b08e
// 100 speex/16000
PAYLOAD_CODEC_SPEEX_8000
=
110
,
PAYLOAD_CODEC_SPEEX_16000
=
111
,
PAYLOAD_CODEC_SPEEX_32000
=
112
};
}
// namespace ring
#endif
src/media/audio/codecs/g711.h
deleted
100644 → 0
View file @
ee3e434b
This diff is collapsed.
Click to expand it.
src/media/audio/codecs/g722.cpp
deleted
100644 → 0
View file @
ee3e434b
This diff is collapsed.
Click to expand it.
src/media/audio/codecs/g722.h
deleted
100644 → 0
View file @
ee3e434b
/*
* Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
*
* Mostly borrowed from asterisk's sources (Steve Underwood <steveu@coppice.org>)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifndef G722_H_
#define G722_H_
/**
The G.722 module is a bit exact implementation of the ITU G.722 specification for all three
specified bit rates - 64000bps, 56000bps and 48000bps. It passes the ITU tests.
To allow fast and flexible interworking with narrow band telephony, the encoder and decoder
support an option for the linear audio to be an 8k samples/second stream. In this mode the
codec is considerably faster, and still fully compatible with wideband terminals using G.722.
*/
#include <stdint.h>
enum
{
G722_SAMPLE_RATE_8000
=
0x0001
,
G722_PACKED
=
0x0002
};
#ifndef INT16_MAX
#define INT16_MAX 32767
#endif
#ifndef INT16_MIN
#define INT16_MIN (-32768)
#endif
struct
g722_state_t
{
/*! TRUE if the operating in the special ITU test mode, with the band split filters
disabled. */
int
itu_test_mode
;
/*! TRUE if the G.722 data is packed */
int
packed
;