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