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

Side by Side Diff: content/common/media/media_param_traits.cc

Issue 1659003003: IPC::Message -> base::Pickle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more mac fix Created 4 years, 10 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
« no previous file with comments | « content/common/media/media_param_traits.h ('k') | content/common/resource_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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/media/media_param_traits.h" 5 #include "content/common/media/media_param_traits.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "content/common/media/audio_messages.h" 8 #include "content/common/media/audio_messages.h"
9 #include "content/common/media/video_capture_messages.h" 9 #include "content/common/media/video_capture_messages.h"
10 #include "ipc/ipc_message_utils.h" 10 #include "ipc/ipc_message_utils.h"
11 #include "media/audio/audio_parameters.h" 11 #include "media/audio/audio_parameters.h"
12 #include "media/audio/point.h" 12 #include "media/audio/point.h"
13 #include "media/base/limits.h" 13 #include "media/base/limits.h"
14 #include "ui/gfx/ipc/gfx_param_traits.h" 14 #include "ui/gfx/ipc/gfx_param_traits.h"
15 15
16 using media::AudioParameters; 16 using media::AudioParameters;
17 using media::ChannelLayout; 17 using media::ChannelLayout;
18 using media::VideoCaptureFormat; 18 using media::VideoCaptureFormat;
19 19
20 namespace IPC { 20 namespace IPC {
21 21
22 void ParamTraits<AudioParameters>::Write(Message* m, 22 void ParamTraits<AudioParameters>::Write(base::Pickle* m,
23 const AudioParameters& p) { 23 const AudioParameters& p) {
24 WriteParam(m, p.format()); 24 WriteParam(m, p.format());
25 WriteParam(m, p.channel_layout()); 25 WriteParam(m, p.channel_layout());
26 WriteParam(m, p.sample_rate()); 26 WriteParam(m, p.sample_rate());
27 WriteParam(m, p.bits_per_sample()); 27 WriteParam(m, p.bits_per_sample());
28 WriteParam(m, p.frames_per_buffer()); 28 WriteParam(m, p.frames_per_buffer());
29 WriteParam(m, p.channels()); 29 WriteParam(m, p.channels());
30 WriteParam(m, p.effects()); 30 WriteParam(m, p.effects());
31 WriteParam(m, p.mic_positions()); 31 WriteParam(m, p.mic_positions());
32 } 32 }
33 33
34 bool ParamTraits<AudioParameters>::Read(const Message* m, 34 bool ParamTraits<AudioParameters>::Read(const base::Pickle* m,
35 base::PickleIterator* iter, 35 base::PickleIterator* iter,
36 AudioParameters* r) { 36 AudioParameters* r) {
37 AudioParameters::Format format; 37 AudioParameters::Format format;
38 ChannelLayout channel_layout; 38 ChannelLayout channel_layout;
39 int sample_rate, bits_per_sample, frames_per_buffer, channels, effects; 39 int sample_rate, bits_per_sample, frames_per_buffer, channels, effects;
40 std::vector<media::Point> mic_positions; 40 std::vector<media::Point> mic_positions;
41 41
42 if (!ReadParam(m, iter, &format) || !ReadParam(m, iter, &channel_layout) || 42 if (!ReadParam(m, iter, &format) || !ReadParam(m, iter, &channel_layout) ||
43 !ReadParam(m, iter, &sample_rate) || 43 !ReadParam(m, iter, &sample_rate) ||
44 !ReadParam(m, iter, &bits_per_sample) || 44 !ReadParam(m, iter, &bits_per_sample) ||
(...skipping 11 matching lines...) Expand all
56 56
57 *r = params; 57 *r = params;
58 return r->IsValid(); 58 return r->IsValid();
59 } 59 }
60 60
61 void ParamTraits<AudioParameters>::Log(const AudioParameters& p, 61 void ParamTraits<AudioParameters>::Log(const AudioParameters& p,
62 std::string* l) { 62 std::string* l) {
63 l->append(base::StringPrintf("<AudioParameters>")); 63 l->append(base::StringPrintf("<AudioParameters>"));
64 } 64 }
65 65
66 void ParamTraits<VideoCaptureFormat>::Write(Message* m, 66 void ParamTraits<VideoCaptureFormat>::Write(base::Pickle* m,
67 const VideoCaptureFormat& p) { 67 const VideoCaptureFormat& p) {
68 WriteParam(m, p.frame_size); 68 WriteParam(m, p.frame_size);
69 WriteParam(m, p.frame_rate); 69 WriteParam(m, p.frame_rate);
70 WriteParam(m, p.pixel_format); 70 WriteParam(m, p.pixel_format);
71 WriteParam(m, p.pixel_storage); 71 WriteParam(m, p.pixel_storage);
72 } 72 }
73 73
74 bool ParamTraits<VideoCaptureFormat>::Read(const Message* m, 74 bool ParamTraits<VideoCaptureFormat>::Read(const base::Pickle* m,
75 base::PickleIterator* iter, 75 base::PickleIterator* iter,
76 VideoCaptureFormat* r) { 76 VideoCaptureFormat* r) {
77 if (!ReadParam(m, iter, &r->frame_size) || 77 if (!ReadParam(m, iter, &r->frame_size) ||
78 !ReadParam(m, iter, &r->frame_rate) || 78 !ReadParam(m, iter, &r->frame_rate) ||
79 !ReadParam(m, iter, &r->pixel_format) || 79 !ReadParam(m, iter, &r->pixel_format) ||
80 !ReadParam(m, iter, &r->pixel_storage)) { 80 !ReadParam(m, iter, &r->pixel_storage)) {
81 return false; 81 return false;
82 } 82 }
83 return r->IsValid(); 83 return r->IsValid();
84 } 84 }
85 85
86 void ParamTraits<VideoCaptureFormat>::Log(const VideoCaptureFormat& p, 86 void ParamTraits<VideoCaptureFormat>::Log(const VideoCaptureFormat& p,
87 std::string* l) { 87 std::string* l) {
88 l->append(base::StringPrintf("<VideoCaptureFormat> %s", 88 l->append(base::StringPrintf("<VideoCaptureFormat> %s",
89 media::VideoCaptureFormat::ToString(p).c_str())); 89 media::VideoCaptureFormat::ToString(p).c_str()));
90 } 90 }
91 91
92 } // namespace IPC 92 } // namespace IPC
OLDNEW
« no previous file with comments | « content/common/media/media_param_traits.h ('k') | content/common/resource_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698