blob: 9dd2566b881fa4a55100cb2d172ce4252c7df1d8 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_MODULES_UTILITY_SOURCE_CODER_H_
12#define WEBRTC_MODULES_UTILITY_SOURCE_CODER_H_
13
14#include "audio_coding_module.h"
15#include "common_types.h"
16#include "typedefs.h"
17
18namespace webrtc {
19class AudioFrame;
20
21class AudioCoder : public AudioPacketizationCallback
22{
23public:
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000024 AudioCoder(uint32_t instanceID);
niklase@google.com470e71d2011-07-07 08:21:25 +000025 ~AudioCoder();
26
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000027 int32_t SetEncodeCodec(
niklase@google.com470e71d2011-07-07 08:21:25 +000028 const CodecInst& codecInst,
29 ACMAMRPackingFormat amrFormat = AMRBandwidthEfficient);
30
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000031 int32_t SetDecodeCodec(
niklase@google.com470e71d2011-07-07 08:21:25 +000032 const CodecInst& codecInst,
33 ACMAMRPackingFormat amrFormat = AMRBandwidthEfficient);
34
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000035 int32_t Decode(AudioFrame& decodedAudio, uint32_t sampFreqHz,
36 const int8_t* incomingPayload, int32_t payloadLength);
niklase@google.com470e71d2011-07-07 08:21:25 +000037
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000038 int32_t PlayoutData(AudioFrame& decodedAudio, uint16_t& sampFreqHz);
niklase@google.com470e71d2011-07-07 08:21:25 +000039
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000040 int32_t Encode(const AudioFrame& audio, int8_t* encodedData,
41 uint32_t& encodedLengthInBytes);
niklase@google.com470e71d2011-07-07 08:21:25 +000042
43protected:
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000044 virtual int32_t SendData(FrameType frameType,
45 uint8_t payloadType,
46 uint32_t timeStamp,
47 const uint8_t* payloadData,
48 uint16_t payloadSize,
49 const RTPFragmentationHeader* fragmentation);
niklase@google.com470e71d2011-07-07 08:21:25 +000050
51private:
niklase@google.com470e71d2011-07-07 08:21:25 +000052 AudioCodingModule* _acm;
53
54 CodecInst _receiveCodec;
55
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000056 uint32_t _encodeTimestamp;
57 int8_t* _encodedData;
58 uint32_t _encodedLengthInBytes;
niklase@google.com470e71d2011-07-07 08:21:25 +000059
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000060 uint32_t _decodeTimestamp;
niklase@google.com470e71d2011-07-07 08:21:25 +000061};
62} // namespace webrtc
63
64#endif // WEBRTC_MODULES_UTILITY_SOURCE_CODER_H_