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

Side by Side Diff: chrome/common/gpu_video_common.cc

Issue 6673003: Move GPU messages to content. I've also switched the IPC structs to use the ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | « chrome/common/gpu_video_common.h ('k') | chrome/common/render_messages.cc » ('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) 2010 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 "chrome/common/gpu_video_common.h"
6
7 const int32 kGpuVideoInvalidFrameId = -1;
8
9 namespace IPC {
10
11 ///////////////////////////////////////////////////////////////////////////////
12
13 void ParamTraits<GpuVideoDecoderInitParam>::Write(
14 Message* m, const GpuVideoDecoderInitParam& p) {
15 WriteParam(m, p.codec_id);
16 WriteParam(m, p.width);
17 WriteParam(m, p.height);
18 }
19
20 bool ParamTraits<GpuVideoDecoderInitParam>::Read(
21 const Message* m, void** iter, GpuVideoDecoderInitParam* r) {
22 if (!ReadParam(m, iter, &r->codec_id) ||
23 !ReadParam(m, iter, &r->width) ||
24 !ReadParam(m, iter, &r->height))
25 return false;
26 return true;
27 }
28
29 void ParamTraits<GpuVideoDecoderInitParam>::Log(
30 const GpuVideoDecoderInitParam& p, std::string* l) {
31 l->append(base::StringPrintf("(%d, %d %d)", p.codec_id, p.width, p.height));
32 }
33
34 ///////////////////////////////////////////////////////////////////////////////
35
36 void ParamTraits<GpuVideoDecoderInitDoneParam>::Write(
37 Message* m, const GpuVideoDecoderInitDoneParam& p) {
38 WriteParam(m, p.success);
39 WriteParam(m, p.input_buffer_size);
40 WriteParam(m, p.input_buffer_handle);
41 }
42
43 bool ParamTraits<GpuVideoDecoderInitDoneParam>::Read(
44 const Message* m, void** iter, GpuVideoDecoderInitDoneParam* r) {
45 if (!ReadParam(m, iter, &r->success) ||
46 !ReadParam(m, iter, &r->input_buffer_size) ||
47 !ReadParam(m, iter, &r->input_buffer_handle))
48 return false;
49 return true;
50 }
51
52 void ParamTraits<GpuVideoDecoderInitDoneParam>::Log(
53 const GpuVideoDecoderInitDoneParam& p, std::string* l) {
54 l->append(base::StringPrintf("(%d %d)", p.success, p.input_buffer_size));
55 }
56
57 ///////////////////////////////////////////////////////////////////////////////
58
59 void ParamTraits<GpuVideoDecoderInputBufferParam>::Write(
60 Message* m, const GpuVideoDecoderInputBufferParam& p) {
61 WriteParam(m, p.timestamp);
62 WriteParam(m, p.offset);
63 WriteParam(m, p.size);
64 }
65
66 bool ParamTraits<GpuVideoDecoderInputBufferParam>::Read(
67 const Message* m, void** iter, GpuVideoDecoderInputBufferParam* r) {
68 if (!ReadParam(m, iter, &r->timestamp) ||
69 !ReadParam(m, iter, &r->offset) ||
70 !ReadParam(m, iter, &r->size))
71 return false;
72 return true;
73 }
74
75 void ParamTraits<GpuVideoDecoderInputBufferParam>::Log(
76 const GpuVideoDecoderInputBufferParam& p, std::string* l) {
77 l->append(base::StringPrintf("(%d %d %d)",
78 static_cast<int>(p.timestamp),
79 p.offset, p.size));
80 }
81
82 ///////////////////////////////////////////////////////////////////////////////
83
84 void ParamTraits<GpuVideoDecoderErrorInfoParam>::Write(
85 Message* m, const GpuVideoDecoderErrorInfoParam& p) {
86 WriteParam(m, p.error_id);
87 }
88
89 bool ParamTraits<GpuVideoDecoderErrorInfoParam>::Read(
90 const Message* m, void** iter, GpuVideoDecoderErrorInfoParam* r) {
91 if (!ReadParam(m, iter, &r->error_id))
92 return false;
93 return true;
94 }
95
96 void ParamTraits<GpuVideoDecoderErrorInfoParam>::Log(
97 const GpuVideoDecoderErrorInfoParam& p, std::string* l) {
98 l->append(base::StringPrintf("(%d)", p.error_id));
99 }
100
101 ///////////////////////////////////////////////////////////////////////////////
102
103 void ParamTraits<GpuVideoDecoderFormatChangeParam>::Write(
104 Message* m, const GpuVideoDecoderFormatChangeParam& p) {
105 WriteParam(m, p.input_buffer_size);
106 }
107
108 bool ParamTraits<GpuVideoDecoderFormatChangeParam>::Read(
109 const Message* m, void** iter, GpuVideoDecoderFormatChangeParam* r) {
110 if (!ReadParam(m, iter, &r->input_buffer_size))
111 return false;
112 return true;
113 }
114
115 void ParamTraits<GpuVideoDecoderFormatChangeParam>::Log(
116 const GpuVideoDecoderFormatChangeParam& p, std::string* l) {
117 l->append(base::StringPrintf("%d", p.input_buffer_size));
118 }
119
120 ///////////////////////////////////////////////////////////////////////////////
121 // Traits for media::VideoFrame::Format
122 void ParamTraits<media::VideoFrame::Format>::Write(
123 Message* m, const param_type& p) {
124 m->WriteInt(p);
125 }
126
127 bool ParamTraits<media::VideoFrame::Format>::Read(
128 const Message* m, void** iter, param_type* p) {
129 int type;
130 if (!m->ReadInt(iter, &type))
131 return false;
132 *p = static_cast<param_type>(type);
133 return true;
134 }
135
136 void ParamTraits<media::VideoFrame::Format>::Log(
137 const param_type& p, std::string* l) {
138 std::string s;
139 switch (p) {
140 case media::VideoFrame::RGB555:
141 s = "RGB555";
142 break;
143 case media::VideoFrame::RGB565:
144 s = "RGB565";
145 break;
146 case media::VideoFrame::RGB24:
147 s = "RGB24";
148 break;
149 case media::VideoFrame::RGB32:
150 s = "RGB32";
151 break;
152 case media::VideoFrame::RGBA:
153 s = "RGBA";
154 break;
155 case media::VideoFrame::YV12:
156 s = "YV12";
157 break;
158 case media::VideoFrame::YV16:
159 s = "YV16";
160 break;
161 case media::VideoFrame::NV12:
162 s = "NV12";
163 break;
164 case media::VideoFrame::EMPTY:
165 s = "EMPTY";
166 break;
167 case media::VideoFrame::ASCII:
168 s = "ASCII";
169 break;
170 case media::VideoFrame::INVALID:
171 s = "INVALID";
172 break;
173 default:
174 NOTIMPLEMENTED();
175 s = "UNKNOWN";
176 break;
177 }
178 LogParam(s, l);
179 }
180
181 } // namespace IPC
OLDNEW
« no previous file with comments | « chrome/common/gpu_video_common.h ('k') | chrome/common/render_messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698