summaryrefslogtreecommitdiffstats
path: root/remoting/codec
diff options
context:
space:
mode:
authorkxing@chromium.org <kxing@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-04 01:15:20 +0000
committerkxing@chromium.org <kxing@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-04 01:15:20 +0000
commit22d7f3b7dd0f70efe089a6e823739040d42b1690 (patch)
tree22fadac51d4d7b61d507606a0bfcd4a0485cf5e5 /remoting/codec
parentf6d9518588d2acd4719dbdcebf0b0156d75385c3 (diff)
downloadchromium_src-22d7f3b7dd0f70efe089a6e823739040d42b1690.zip
chromium_src-22d7f3b7dd0f70efe089a6e823739040d42b1690.tar.gz
chromium_src-22d7f3b7dd0f70efe089a6e823739040d42b1690.tar.bz2
Piping for audio decoding.
Review URL: https://chromiumcodereview.appspot.com/10843031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149990 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/codec')
-rw-r--r--remoting/codec/DEPS1
-rw-r--r--remoting/codec/audio_decoder.cc25
-rw-r--r--remoting/codec/audio_decoder.h30
-rw-r--r--remoting/codec/audio_decoder_verbatim.cc24
-rw-r--r--remoting/codec/audio_decoder_verbatim.h31
5 files changed, 111 insertions, 0 deletions
diff --git a/remoting/codec/DEPS b/remoting/codec/DEPS
index 9e5dc3c..6076cf2 100644
--- a/remoting/codec/DEPS
+++ b/remoting/codec/DEPS
@@ -1,3 +1,4 @@
include_rules = [
"+google/protobuf",
+ "+remoting/protocol",
]
diff --git a/remoting/codec/audio_decoder.cc b/remoting/codec/audio_decoder.cc
new file mode 100644
index 0000000..57a6e1c
--- /dev/null
+++ b/remoting/codec/audio_decoder.cc
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/codec/audio_decoder.h"
+
+#include "base/logging.h"
+#include "remoting/codec/audio_decoder_verbatim.h"
+#include "remoting/protocol/session_config.h"
+
+namespace remoting {
+
+scoped_ptr<AudioDecoder> AudioDecoder::CreateAudioDecoder(
+ const protocol::SessionConfig& config) {
+ const protocol::ChannelConfig& audio_config = config.audio_config();
+
+ if (audio_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) {
+ return scoped_ptr<AudioDecoder>(new AudioDecoderVerbatim());
+ }
+
+ NOTIMPLEMENTED();
+ return scoped_ptr<AudioDecoder>(NULL);
+}
+
+} // namespace remoting
diff --git a/remoting/codec/audio_decoder.h b/remoting/codec/audio_decoder.h
new file mode 100644
index 0000000..72eedf2
--- /dev/null
+++ b/remoting/codec/audio_decoder.h
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_CODEC_AUDIO_DECODER_H_
+#define REMOTING_CODEC_AUDIO_DECODER_H_
+
+#include "base/memory/scoped_ptr.h"
+
+namespace remoting {
+
+namespace protocol {
+class SessionConfig;
+} // namespace protocol
+
+class AudioPacket;
+
+class AudioDecoder {
+ public:
+ static scoped_ptr<AudioDecoder> CreateAudioDecoder(
+ const protocol::SessionConfig& config);
+
+ virtual ~AudioDecoder() {}
+
+ virtual scoped_ptr<AudioPacket> Decode(scoped_ptr<AudioPacket> packet) = 0;
+};
+
+} // namespace remoting
+
+#endif // REMOTING_CODEC_AUDIO_DECODER_H_
diff --git a/remoting/codec/audio_decoder_verbatim.cc b/remoting/codec/audio_decoder_verbatim.cc
new file mode 100644
index 0000000..8a69705
--- /dev/null
+++ b/remoting/codec/audio_decoder_verbatim.cc
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/codec/audio_decoder_verbatim.h"
+
+#include "base/logging.h"
+#include "remoting/proto/audio.pb.h"
+
+namespace remoting {
+
+AudioDecoderVerbatim::AudioDecoderVerbatim() {
+}
+
+AudioDecoderVerbatim::~AudioDecoderVerbatim() {
+}
+
+scoped_ptr<AudioPacket> AudioDecoderVerbatim::Decode(
+ scoped_ptr<AudioPacket> packet) {
+ DCHECK_EQ(AudioPacket::ENCODING_RAW, packet->encoding());
+ return packet.Pass();
+}
+
+} // namespace remoting
diff --git a/remoting/codec/audio_decoder_verbatim.h b/remoting/codec/audio_decoder_verbatim.h
new file mode 100644
index 0000000..b2d967e
--- /dev/null
+++ b/remoting/codec/audio_decoder_verbatim.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_CODEC_AUDIO_DECODER_VERBATIM_H_
+#define REMOTING_CODEC_AUDIO_DECODER_VERBATIM_H_
+
+#include "remoting/codec/audio_decoder.h"
+
+#include "base/memory/scoped_ptr.h"
+
+namespace remoting {
+
+class AudioPacket;
+
+// The decoder for raw audio streams.
+class AudioDecoderVerbatim : public AudioDecoder {
+ public:
+ AudioDecoderVerbatim();
+ virtual ~AudioDecoderVerbatim();
+
+ virtual scoped_ptr<AudioPacket> Decode(
+ scoped_ptr<AudioPacket> packet) OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AudioDecoderVerbatim);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_CODEC_AUDIO_DECODER_VERBATIM_H_