| OLD | NEW |
| 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" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 int sample_rate, bits_per_sample, frames_per_buffer, channels, effects; | 37 int sample_rate, bits_per_sample, frames_per_buffer, channels, effects; |
| 38 | 38 |
| 39 if (!ReadParam(m, iter, &format) || !ReadParam(m, iter, &channel_layout) || | 39 if (!ReadParam(m, iter, &format) || !ReadParam(m, iter, &channel_layout) || |
| 40 !ReadParam(m, iter, &sample_rate) || | 40 !ReadParam(m, iter, &sample_rate) || |
| 41 !ReadParam(m, iter, &bits_per_sample) || | 41 !ReadParam(m, iter, &bits_per_sample) || |
| 42 !ReadParam(m, iter, &frames_per_buffer) || | 42 !ReadParam(m, iter, &frames_per_buffer) || |
| 43 !ReadParam(m, iter, &channels) || !ReadParam(m, iter, &effects)) { | 43 !ReadParam(m, iter, &channels) || !ReadParam(m, iter, &effects)) { |
| 44 return false; | 44 return false; |
| 45 } | 45 } |
| 46 | 46 |
| 47 AudioParameters params(format, channel_layout, channels, sample_rate, | 47 AudioParameters params(format, channel_layout, sample_rate, bits_per_sample, |
| 48 bits_per_sample, frames_per_buffer, effects); | 48 frames_per_buffer); |
| 49 params.set_channels_for_discrete(channels); |
| 50 params.set_effects(effects); |
| 51 |
| 49 *r = params; | 52 *r = params; |
| 50 return r->IsValid(); | 53 return r->IsValid(); |
| 51 } | 54 } |
| 52 | 55 |
| 53 void ParamTraits<AudioParameters>::Log(const AudioParameters& p, | 56 void ParamTraits<AudioParameters>::Log(const AudioParameters& p, |
| 54 std::string* l) { | 57 std::string* l) { |
| 55 l->append(base::StringPrintf("<AudioParameters>")); | 58 l->append(base::StringPrintf("<AudioParameters>")); |
| 56 } | 59 } |
| 57 | 60 |
| 58 void ParamTraits<VideoCaptureFormat>::Write(Message* m, | 61 void ParamTraits<VideoCaptureFormat>::Write(Message* m, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 74 } | 77 } |
| 75 return r->IsValid(); | 78 return r->IsValid(); |
| 76 } | 79 } |
| 77 | 80 |
| 78 void ParamTraits<VideoCaptureFormat>::Log(const VideoCaptureFormat& p, | 81 void ParamTraits<VideoCaptureFormat>::Log(const VideoCaptureFormat& p, |
| 79 std::string* l) { | 82 std::string* l) { |
| 80 l->append(base::StringPrintf("<VideoCaptureFormat> %s", | 83 l->append(base::StringPrintf("<VideoCaptureFormat> %s", |
| 81 media::VideoCaptureFormat::ToString(p).c_str())); | 84 media::VideoCaptureFormat::ToString(p).c_str())); |
| 82 } | 85 } |
| 83 | 86 |
| 84 } | 87 } // namespace IPC |
| OLD | NEW |