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

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

Issue 68503005: Reorganize media::VideoCapture* types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 51b76b9a Rebase, comments. Review this please. Created 7 years, 1 month 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
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 "media/audio/audio_parameters.h" 8 #include "media/audio/audio_parameters.h"
9 #include "media/base/limits.h" 9 #include "media/base/limits.h"
10 #include "media/video/capture/video_capture_types.h" 10 #include "media/video/capture/video_capture_types.h"
11 11
12 using media::AudioParameters; 12 using media::AudioParameters;
13 using media::ChannelLayout; 13 using media::ChannelLayout;
14 using media::VideoCaptureFormat;
15 using media::VideoCaptureSessionId;
16 14
17 namespace IPC { 15 namespace IPC {
18 16
19 void ParamTraits<AudioParameters>::Write(Message* m, 17 void ParamTraits<AudioParameters>::Write(Message* m,
20 const AudioParameters& p) { 18 const AudioParameters& p) {
21 m->WriteInt(static_cast<int>(p.format())); 19 m->WriteInt(static_cast<int>(p.format()));
22 m->WriteInt(static_cast<int>(p.channel_layout())); 20 m->WriteInt(static_cast<int>(p.channel_layout()));
23 m->WriteInt(p.sample_rate()); 21 m->WriteInt(p.sample_rate());
24 m->WriteInt(p.bits_per_sample()); 22 m->WriteInt(p.bits_per_sample());
25 m->WriteInt(p.frames_per_buffer()); 23 m->WriteInt(p.frames_per_buffer());
(...skipping 21 matching lines...) Expand all
47 if (!r->IsValid()) 45 if (!r->IsValid())
48 return false; 46 return false;
49 return true; 47 return true;
50 } 48 }
51 49
52 void ParamTraits<AudioParameters>::Log(const AudioParameters& p, 50 void ParamTraits<AudioParameters>::Log(const AudioParameters& p,
53 std::string* l) { 51 std::string* l) {
54 l->append(base::StringPrintf("<AudioParameters>")); 52 l->append(base::StringPrintf("<AudioParameters>"));
55 } 53 }
56 54
57 void ParamTraits<VideoCaptureFormat>::Write(Message* m,
58 const VideoCaptureFormat& p) {
59 m->WriteInt(p.width);
60 m->WriteInt(p.height);
61 m->WriteInt(p.frame_rate);
62 m->WriteInt(static_cast<int>(p.frame_size_type));
63 } 55 }
64
65 bool ParamTraits<VideoCaptureFormat>::Read(const Message* m,
66 PickleIterator* iter,
67 VideoCaptureFormat* r) {
68 int frame_size_type;
69 if (!m->ReadInt(iter, &r->width) ||
70 !m->ReadInt(iter, &r->height) ||
71 !m->ReadInt(iter, &r->frame_rate) ||
72 !m->ReadInt(iter, &frame_size_type))
73 return false;
74
75 r->frame_size_type =
76 static_cast<media::VideoCaptureResolutionType>(
77 frame_size_type);
78 if (!r->IsValid())
ncarter (slow) 2013/11/21 20:15:45 Where did this validation go? If we fail to valid
79 return false;
80 return true;
81 }
82
83 void ParamTraits<VideoCaptureFormat>::Log(const VideoCaptureFormat& p,
84 std::string* l) {
85 l->append(base::StringPrintf("<VideoCaptureFormat>"));
86 }
87
88 }
OLDNEW
« no previous file with comments | « content/common/media/media_param_traits.h ('k') | content/common/media/video_capture_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698