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

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

Issue 1204843004: Revert of Video Capture: extract storage info from pixel format in VideoCaptureFormat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
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/base/video_capture_types.h" 10 #include "media/base/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; 14 using media::VideoCaptureFormat;
15 using media::VideoPixelFormat; 15 using media::VideoPixelFormat;
16 using media::VideoPixelStorage;
17 16
18 namespace IPC { 17 namespace IPC {
19 18
20 void ParamTraits<AudioParameters>::Write(Message* m, 19 void ParamTraits<AudioParameters>::Write(Message* m,
21 const AudioParameters& p) { 20 const AudioParameters& p) {
22 m->WriteInt(static_cast<int>(p.format())); 21 m->WriteInt(static_cast<int>(p.format()));
23 m->WriteInt(static_cast<int>(p.channel_layout())); 22 m->WriteInt(static_cast<int>(p.channel_layout()));
24 m->WriteInt(p.sample_rate()); 23 m->WriteInt(p.sample_rate());
25 m->WriteInt(p.bits_per_sample()); 24 m->WriteInt(p.bits_per_sample());
26 m->WriteInt(p.frames_per_buffer()); 25 m->WriteInt(p.frames_per_buffer());
(...skipping 30 matching lines...) Expand all
57 l->append(base::StringPrintf("<AudioParameters>")); 56 l->append(base::StringPrintf("<AudioParameters>"));
58 } 57 }
59 58
60 void ParamTraits<VideoCaptureFormat>::Write(Message* m, 59 void ParamTraits<VideoCaptureFormat>::Write(Message* m,
61 const VideoCaptureFormat& p) { 60 const VideoCaptureFormat& p) {
62 // Crash during Send rather than have a failure at the message handler. 61 // Crash during Send rather than have a failure at the message handler.
63 m->WriteInt(p.frame_size.width()); 62 m->WriteInt(p.frame_size.width());
64 m->WriteInt(p.frame_size.height()); 63 m->WriteInt(p.frame_size.height());
65 m->WriteFloat(p.frame_rate); 64 m->WriteFloat(p.frame_rate);
66 m->WriteInt(static_cast<int>(p.pixel_format)); 65 m->WriteInt(static_cast<int>(p.pixel_format));
67 m->WriteInt(static_cast<int>(p.pixel_storage));
68 } 66 }
69 67
70 bool ParamTraits<VideoCaptureFormat>::Read(const Message* m, 68 bool ParamTraits<VideoCaptureFormat>::Read(const Message* m,
71 base::PickleIterator* iter, 69 base::PickleIterator* iter,
72 VideoCaptureFormat* r) { 70 VideoCaptureFormat* r) {
73 int frame_size_width, frame_size_height, pixel_format, pixel_storage; 71 int frame_size_width, frame_size_height, pixel_format;
74 if (!iter->ReadInt(&frame_size_width) || 72 if (!iter->ReadInt(&frame_size_width) ||
75 !iter->ReadInt(&frame_size_height) || 73 !iter->ReadInt(&frame_size_height) ||
76 !iter->ReadFloat(&r->frame_rate) || 74 !iter->ReadFloat(&r->frame_rate) ||
77 !iter->ReadInt(&pixel_format) || 75 !iter->ReadInt(&pixel_format))
78 !iter->ReadInt(&pixel_storage))
79 return false; 76 return false;
80 77
81 r->frame_size.SetSize(frame_size_width, frame_size_height); 78 r->frame_size.SetSize(frame_size_width, frame_size_height);
82 r->pixel_format = static_cast<VideoPixelFormat>(pixel_format); 79 r->pixel_format = static_cast<VideoPixelFormat>(pixel_format);
83 r->pixel_storage = static_cast<VideoPixelStorage>(pixel_storage); 80 if (!r->IsValid())
84 return r->IsValid(); 81 return false;
82 return true;
85 } 83 }
86 84
87 void ParamTraits<VideoCaptureFormat>::Log(const VideoCaptureFormat& p, 85 void ParamTraits<VideoCaptureFormat>::Log(const VideoCaptureFormat& p,
88 std::string* l) { 86 std::string* l) {
89 l->append(base::StringPrintf("<VideoCaptureFormat>")); 87 l->append(base::StringPrintf("<VideoCaptureFormat>"));
90 } 88 }
91 89
92 } 90 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_device_client.cc ('k') | media/base/video_capture_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698