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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/media/audio_param_traits.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/common/media/audio_param_traits.h"
6
7 #include "base/stringprintf.h"
8 #include "media/audio/audio_parameters.h"
9
10 namespace IPC {
11
12 void ParamTraits<AudioParameters>::Write(Message* m,
13 const AudioParameters& p) {
14 m->WriteInt(static_cast<int>(p.format()));
15 m->WriteInt(static_cast<int>(p.channel_layout()));
16 m->WriteInt(p.sample_rate());
17 m->WriteInt(p.bits_per_sample());
18 m->WriteInt(p.frames_per_buffer());
19 m->WriteInt(p.channels());
20 }
21
22 bool ParamTraits<AudioParameters>::Read(const Message* m,
23 PickleIterator* iter,
24 AudioParameters* r) {
25 int format, channel_layout, sample_rate, bits_per_sample,
26 frames_per_buffer, channels;
27
28 if (!m->ReadInt(iter, &format) ||
29 !m->ReadInt(iter, &channel_layout) ||
30 !m->ReadInt(iter, &sample_rate) ||
31 !m->ReadInt(iter, &bits_per_sample) ||
32 !m->ReadInt(iter, &frames_per_buffer) ||
33 !m->ReadInt(iter, &channels))
34 return false;
35 r->Reset(static_cast<AudioParameters::Format>(format),
36 static_cast<ChannelLayout>(channel_layout),
37 sample_rate, bits_per_sample, frames_per_buffer);
38 return true;
39 }
40
41 void ParamTraits<AudioParameters>::Log(const AudioParameters& p,
42 std::string* l) {
43 l->append(base::StringPrintf("<AudioParameters>"));
44 }
45
46 }
OLDNEW
« 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