~ubuntu-branches/ubuntu/utopic/sflphone/utopic-proposed

« back to all changes in this revision

Viewing changes to daemon/src/audio/codecs/alaw.cpp

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2013-06-30 11:40:56 UTC
  • mfrom: (4.1.18 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130630114056-0np50jkyqo6vnmii
Tags: 1.2.3-2
* changeset_r92d62cfc54732bbbcfff2b1d36c096b120b981a5.diff 
  - fixes automatic endian detection 
* Update Vcs: fixes vcs-field-not-canonical

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
 
2
 *  Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
3
3
 *  Author:  Yan Morin <yan.morin@savoirfairelinux.com>
4
4
 *  Author:  Laurielle Lea <laurielle.lea@savoirfairelinux.com>
5
5
 *
15
15
 *
16
16
 *  You should have received a copy of the GNU General Public License
17
17
 *  along with this program; if not, write to the Free Software
18
 
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
18
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
19
19
 *
20
20
 *  Additional permission under GNU GPL version 3 section 7:
21
21
 *
42
42
        }
43
43
 
44
44
    private:
45
 
        virtual int decode(SFLDataFormat *dst, unsigned char *src, size_t buf_size)
 
45
        int decode(SFLDataFormat *dst, unsigned char *src, size_t buf_size)
46
46
        {
47
47
            for (unsigned char* end = src + buf_size; src < end; ++src, ++dst)
48
48
                *dst = ALawDecode(*src);
49
49
 
50
 
            return frameSize_;
 
50
            return buf_size;
51
51
        }
52
52
 
53
 
        virtual int encode(unsigned char *dst, SFLDataFormat *src, size_t /*buf_size*/)
 
53
        int encode(unsigned char *dst, SFLDataFormat *src, size_t buf_size)
54
54
        {
55
 
            for (unsigned char *end = dst + frameSize_; dst < end; ++src, ++dst)
 
55
            for (unsigned char *end = dst + buf_size; dst < end; ++src, ++dst)
56
56
                *dst = ALawEncode(*src);
57
57
 
58
 
            return frameSize_ / 2 /* compression factor = 2:1 */ * sizeof(SFLDataFormat);
 
58
            return buf_size;
59
59
        }
60
60
 
61
61
        int ALawDecode(uint8 alaw)
123
123
 
124
124
// the class factories
125
125
// cppcheck-suppress unusedFunction
126
 
extern "C" sfl::Codec* create()
 
126
extern "C" sfl::AudioCodec* AUDIO_CODEC_ENTRY()
127
127
{
128
128
    return new Alaw;
129
129
}
130
130
 
131
131
// cppcheck-suppress unusedFunction
132
 
extern "C" void destroy(sfl::Codec* a)
 
132
extern "C" void destroy(sfl::AudioCodec* a)
133
133
{
134
134
    delete a;
135
135
}