Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1618)

Unified Diff: content/common/media/audio_param_traits.cc

Issue 9655018: Make AudioParameters a class instead of a struct (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright years Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/media/audio_param_traits.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/media/audio_param_traits.cc
diff --git a/content/common/media/audio_param_traits.cc b/content/common/media/audio_param_traits.cc
new file mode 100644
index 0000000000000000000000000000000000000000..049037f4dc41f250802ecdb861c57b25eeee1603
--- /dev/null
+++ b/content/common/media/audio_param_traits.cc
@@ -0,0 +1,46 @@
+// 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 "content/common/media/audio_param_traits.h"
+
+#include "base/stringprintf.h"
+#include "media/audio/audio_parameters.h"
+
+namespace IPC {
+
+void ParamTraits<AudioParameters>::Write(Message* m,
+ const AudioParameters& p) {
+ m->WriteInt(static_cast<int>(p.format()));
+ m->WriteInt(static_cast<int>(p.channel_layout()));
+ m->WriteInt(p.sample_rate());
+ m->WriteInt(p.bits_per_sample());
+ m->WriteInt(p.frames_per_buffer());
+ m->WriteInt(p.channels());
+}
+
+bool ParamTraits<AudioParameters>::Read(const Message* m,
+ PickleIterator* iter,
+ AudioParameters* r) {
+ int format, channel_layout, sample_rate, bits_per_sample,
+ frames_per_buffer, channels;
+
+ if (!m->ReadInt(iter, &format) ||
+ !m->ReadInt(iter, &channel_layout) ||
+ !m->ReadInt(iter, &sample_rate) ||
+ !m->ReadInt(iter, &bits_per_sample) ||
+ !m->ReadInt(iter, &frames_per_buffer) ||
+ !m->ReadInt(iter, &channels))
+ return false;
+ r->Reset(static_cast<AudioParameters::Format>(format),
+ static_cast<ChannelLayout>(channel_layout),
+ sample_rate, bits_per_sample, frames_per_buffer);
+ return true;
+}
+
+void ParamTraits<AudioParameters>::Log(const AudioParameters& p,
+ std::string* l) {
+ l->append(base::StringPrintf("<AudioParameters>"));
+}
+
+}
« no previous file with comments | « content/common/media/audio_param_traits.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698