git-svn-id: http://webrtc.googlecode.com/svn/trunk@156 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/src/modules/utility/source/coder.h b/src/modules/utility/source/coder.h
new file mode 100644
index 0000000..e96f455
--- /dev/null
+++ b/src/modules/utility/source/coder.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_MODULES_UTILITY_SOURCE_CODER_H_
+#define WEBRTC_MODULES_UTILITY_SOURCE_CODER_H_
+
+#include "audio_coding_module.h"
+#include "common_types.h"
+#include "typedefs.h"
+
+namespace webrtc {
+class AudioFrame;
+
+class AudioCoder : public AudioPacketizationCallback
+{
+public:
+ AudioCoder(WebRtc_UWord32 instanceID);
+ ~AudioCoder();
+
+ WebRtc_Word32 SetEncodeCodec(
+ const CodecInst& codecInst,
+ ACMAMRPackingFormat amrFormat = AMRBandwidthEfficient);
+
+ WebRtc_Word32 SetDecodeCodec(
+ const CodecInst& codecInst,
+ ACMAMRPackingFormat amrFormat = AMRBandwidthEfficient);
+
+ WebRtc_Word32 Decode(AudioFrame& decodedAudio, WebRtc_UWord32 sampFreqHz,
+ const WebRtc_Word8* incomingPayload,
+ WebRtc_Word32 payloadLength);
+
+ WebRtc_Word32 PlayoutData(AudioFrame& decodedAudio,
+ WebRtc_UWord16& sampFreqHz);
+
+ WebRtc_Word32 Encode(const AudioFrame& audio,
+ WebRtc_Word8* encodedData,
+ WebRtc_UWord32& encodedLengthInBytes);
+
+protected:
+ virtual WebRtc_Word32 SendData(FrameType frameType,
+ WebRtc_UWord8 payloadType,
+ WebRtc_UWord32 timeStamp,
+ const WebRtc_UWord8* payloadData,
+ WebRtc_UWord16 payloadSize,
+ const RTPFragmentationHeader* fragmentation);
+
+private:
+ WebRtc_UWord32 _instanceID;
+
+ AudioCodingModule* _acm;
+
+ CodecInst _receiveCodec;
+
+ WebRtc_UWord32 _encodeTimestamp;
+ WebRtc_Word8* _encodedData;
+ WebRtc_UWord32 _encodedLengthInBytes;
+
+ WebRtc_UWord32 _decodeTimestamp;
+};
+} // namespace webrtc
+
+#endif // WEBRTC_MODULES_UTILITY_SOURCE_CODER_H_