OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 "media/capture/ipc/capture_param_traits.h" |
| 6 |
| 7 #include "base/strings/stringprintf.h" |
| 8 #include "ipc/ipc_message_utils.h" |
| 9 #include "media/base/limits.h" |
| 10 #include "media/capture/video_capture_types.h" |
| 11 #include "ui/gfx/ipc/geometry/gfx_param_traits.h" |
| 12 #include "ui/gfx/ipc/gfx_param_traits.h" |
| 13 #include "ui/gfx/ipc/skia/gfx_skia_param_traits.h" |
| 14 |
| 15 using media::VideoCaptureFormat; |
| 16 |
| 17 namespace IPC { |
| 18 |
| 19 void ParamTraits<VideoCaptureFormat>::GetSize(base::PickleSizer* s, |
| 20 const VideoCaptureFormat& p) { |
| 21 GetParamSize(s, p.frame_size); |
| 22 GetParamSize(s, p.frame_rate); |
| 23 GetParamSize(s, p.pixel_format); |
| 24 GetParamSize(s, p.pixel_storage); |
| 25 } |
| 26 |
| 27 void ParamTraits<VideoCaptureFormat>::Write(base::Pickle* m, |
| 28 const VideoCaptureFormat& p) { |
| 29 WriteParam(m, p.frame_size); |
| 30 WriteParam(m, p.frame_rate); |
| 31 WriteParam(m, p.pixel_format); |
| 32 WriteParam(m, p.pixel_storage); |
| 33 } |
| 34 |
| 35 bool ParamTraits<VideoCaptureFormat>::Read(const base::Pickle* m, |
| 36 base::PickleIterator* iter, |
| 37 VideoCaptureFormat* r) { |
| 38 if (!ReadParam(m, iter, &r->frame_size) || |
| 39 !ReadParam(m, iter, &r->frame_rate) || |
| 40 !ReadParam(m, iter, &r->pixel_format) || |
| 41 !ReadParam(m, iter, &r->pixel_storage)) { |
| 42 return false; |
| 43 } |
| 44 return r->IsValid(); |
| 45 } |
| 46 |
| 47 void ParamTraits<VideoCaptureFormat>::Log(const VideoCaptureFormat& p, |
| 48 std::string* l) { |
| 49 l->append(base::StringPrintf("<VideoCaptureFormat> %s", |
| 50 media::VideoCaptureFormat::ToString(p).c_str())); |
| 51 } |
| 52 |
| 53 } // namespace IPC |
| 54 |
| 55 // Generate param traits size methods. |
| 56 #include "ipc/param_traits_size_macros.h" |
| 57 namespace IPC { |
| 58 #undef MEDIA_CAPTURE_IPC_CAPTURE_PARAM_TRAITS_MACROS_H_ |
| 59 #include "media/capture/ipc/capture_param_traits_macros.h" |
| 60 } |
| 61 |
| 62 // Generate param traits write methods. |
| 63 #include "ipc/param_traits_write_macros.h" |
| 64 namespace IPC { |
| 65 #undef MEDIA_CAPTURE_IPC_CAPTURE_PARAM_TRAITS_MACROS_H_ |
| 66 #include "media/capture/ipc/capture_param_traits_macros.h" |
| 67 } // namespace IPC |
| 68 |
| 69 // Generate param traits read methods. |
| 70 #include "ipc/param_traits_read_macros.h" |
| 71 namespace IPC { |
| 72 #undef MEDIA_CAPTURE_IPC_CAPTURE_PARAM_TRAITS_MACROS_H_ |
| 73 #include "media/capture/ipc/capture_param_traits_macros.h" |
| 74 } // namespace IPC |
| 75 |
| 76 // Generate param traits log methods. |
| 77 #include "ipc/param_traits_log_macros.h" |
| 78 namespace IPC { |
| 79 #undef MEDIA_CAPTURE_IPC_CAPTURE_PARAM_TRAITS_MACROS_H_ |
| 80 #include "media/capture/ipc/capture_param_traits_macros.h" |
| 81 } // namespace IPC |
OLD | NEW |