OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/common/media/cma_param_traits.h" | 5 #include "chromecast/common/media/cma_param_traits.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "chromecast/common/media/cma_param_traits_macros.h" | 9 #include "chromecast/common/media/cma_param_traits_macros.h" |
10 #include "content/public/common/common_param_traits.h" | 10 #include "content/public/common/common_param_traits.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 void ParamTraits<media::AudioDecoderConfig>::Log( | 72 void ParamTraits<media::AudioDecoderConfig>::Log( |
73 const media::AudioDecoderConfig& p, std::string* l) { | 73 const media::AudioDecoderConfig& p, std::string* l) { |
74 l->append(base::StringPrintf("<AudioDecoderConfig>")); | 74 l->append(base::StringPrintf("<AudioDecoderConfig>")); |
75 } | 75 } |
76 | 76 |
77 void ParamTraits<media::VideoDecoderConfig>::Write( | 77 void ParamTraits<media::VideoDecoderConfig>::Write( |
78 Message* m, const media::VideoDecoderConfig& p) { | 78 Message* m, const media::VideoDecoderConfig& p) { |
79 WriteParam(m, p.codec()); | 79 WriteParam(m, p.codec()); |
80 WriteParam(m, p.profile()); | 80 WriteParam(m, p.profile()); |
81 WriteParam(m, p.format()); | 81 WriteParam(m, p.format()); |
| 82 WriteParam(m, p.color_space()); |
82 WriteParam(m, p.coded_size()); | 83 WriteParam(m, p.coded_size()); |
83 WriteParam(m, p.visible_rect()); | 84 WriteParam(m, p.visible_rect()); |
84 WriteParam(m, p.natural_size()); | 85 WriteParam(m, p.natural_size()); |
85 WriteParam(m, p.is_encrypted()); | 86 WriteParam(m, p.is_encrypted()); |
86 std::vector<uint8> extra_data; | 87 std::vector<uint8> extra_data; |
87 if (p.extra_data_size() > 0) { | 88 if (p.extra_data_size() > 0) { |
88 extra_data = | 89 extra_data = |
89 std::vector<uint8>(p.extra_data(), | 90 std::vector<uint8>(p.extra_data(), |
90 p.extra_data() + p.extra_data_size()); | 91 p.extra_data() + p.extra_data_size()); |
91 } | 92 } |
92 WriteParam(m, extra_data); | 93 WriteParam(m, extra_data); |
93 } | 94 } |
94 | 95 |
95 bool ParamTraits<media::VideoDecoderConfig>::Read( | 96 bool ParamTraits<media::VideoDecoderConfig>::Read( |
96 const Message* m, | 97 const Message* m, |
97 base::PickleIterator* iter, | 98 base::PickleIterator* iter, |
98 media::VideoDecoderConfig* r) { | 99 media::VideoDecoderConfig* r) { |
99 media::VideoCodec codec; | 100 media::VideoCodec codec; |
100 media::VideoCodecProfile profile; | 101 media::VideoCodecProfile profile; |
101 media::VideoFrame::Format format; | 102 media::VideoFrame::Format format; |
| 103 media::VideoFrame::ColorSpace color_space; |
102 gfx::Size coded_size; | 104 gfx::Size coded_size; |
103 gfx::Rect visible_rect; | 105 gfx::Rect visible_rect; |
104 gfx::Size natural_size; | 106 gfx::Size natural_size; |
105 bool is_encrypted; | 107 bool is_encrypted; |
106 std::vector<uint8> extra_data; | 108 std::vector<uint8> extra_data; |
107 if (!ReadParam(m, iter, &codec) || !ReadParam(m, iter, &profile) || | 109 if (!ReadParam(m, iter, &codec) || !ReadParam(m, iter, &profile) || |
108 !ReadParam(m, iter, &format) || !ReadParam(m, iter, &coded_size) || | 110 !ReadParam(m, iter, &format) || !ReadParam(m, iter, &color_space) || |
109 !ReadParam(m, iter, &visible_rect) || | 111 !ReadParam(m, iter, &coded_size) || !ReadParam(m, iter, &visible_rect) || |
110 !ReadParam(m, iter, &natural_size) || | 112 !ReadParam(m, iter, &natural_size) || |
111 !ReadParam(m, iter, &is_encrypted) || !ReadParam(m, iter, &extra_data)) | 113 !ReadParam(m, iter, &is_encrypted) || !ReadParam(m, iter, &extra_data)) |
112 return false; | 114 return false; |
113 const uint8* extra_data_ptr = nullptr; | 115 const uint8* extra_data_ptr = nullptr; |
114 if (!extra_data.empty()) | 116 if (!extra_data.empty()) |
115 extra_data_ptr = &extra_data[0]; | 117 extra_data_ptr = &extra_data[0]; |
116 *r = media::VideoDecoderConfig(codec, profile, format, | 118 *r = media::VideoDecoderConfig(codec, profile, format, color_space, |
117 coded_size, visible_rect, natural_size, | 119 coded_size, visible_rect, natural_size, |
118 extra_data_ptr, extra_data.size(), | 120 extra_data_ptr, extra_data.size(), |
119 is_encrypted); | 121 is_encrypted); |
120 return true; | 122 return true; |
121 } | 123 } |
122 | 124 |
123 void ParamTraits<media::VideoDecoderConfig>::Log( | 125 void ParamTraits<media::VideoDecoderConfig>::Log( |
124 const media::VideoDecoderConfig& p, std::string* l) { | 126 const media::VideoDecoderConfig& p, std::string* l) { |
125 l->append(base::StringPrintf("<VideoDecoderConfig>")); | 127 l->append(base::StringPrintf("<VideoDecoderConfig>")); |
126 } | 128 } |
127 | 129 |
128 } // namespace IPC | 130 } // namespace IPC |
OLD | NEW |