| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 "services/video_capture/public/interfaces/video_capture_format_traits.h
" | 5 #include "services/video_capture/public/interfaces/video_capture_format_traits.h
" |
| 6 | 6 |
| 7 #include "ui/gfx/geometry/mojo/geometry.mojom.h" | 7 #include "ui/gfx/geometry/mojo/geometry.mojom.h" |
| 8 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" | 8 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" |
| 9 | 9 |
| 10 namespace mojo { | 10 namespace mojo { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 static_cast<media::VideoPixelFormat>(data.pixel_format()); | 26 static_cast<media::VideoPixelFormat>(data.pixel_format()); |
| 27 if (!data.ReadPixelStorage(&out->pixel_storage)) | 27 if (!data.ReadPixelStorage(&out->pixel_storage)) |
| 28 return false; | 28 return false; |
| 29 return true; | 29 return true; |
| 30 } | 30 } |
| 31 | 31 |
| 32 // static | 32 // static |
| 33 video_capture::mojom::VideoPixelStorage | 33 video_capture::mojom::VideoPixelStorage |
| 34 EnumTraits<video_capture::mojom::VideoPixelStorage, media::VideoPixelStorage>:: | 34 EnumTraits<video_capture::mojom::VideoPixelStorage, media::VideoPixelStorage>:: |
| 35 ToMojom(media::VideoPixelStorage video_pixel_storage) { | 35 ToMojom(media::VideoPixelStorage video_pixel_storage) { |
| 36 switch (video_pixel_storage) { | 36 DCHECK_EQ(media::PIXEL_STORAGE_CPU, video_pixel_storage); |
| 37 case media::PIXEL_STORAGE_CPU: | |
| 38 return video_capture::mojom::VideoPixelStorage::CPU; | |
| 39 case media::PIXEL_STORAGE_GPUMEMORYBUFFER: | |
| 40 return video_capture::mojom::VideoPixelStorage::GPUMEMORYBUFFER; | |
| 41 } | |
| 42 NOTREACHED(); | |
| 43 return video_capture::mojom::VideoPixelStorage::CPU; | 37 return video_capture::mojom::VideoPixelStorage::CPU; |
| 44 } | 38 } |
| 45 | 39 |
| 46 // static | 40 // static |
| 47 bool EnumTraits<video_capture::mojom::VideoPixelStorage, | 41 bool EnumTraits<video_capture::mojom::VideoPixelStorage, |
| 48 media::VideoPixelStorage>:: | 42 media::VideoPixelStorage>:: |
| 49 FromMojom(video_capture::mojom::VideoPixelStorage input, | 43 FromMojom(video_capture::mojom::VideoPixelStorage input, |
| 50 media::VideoPixelStorage* out) { | 44 media::VideoPixelStorage* out) { |
| 51 switch (input) { | 45 DCHECK_EQ(video_capture::mojom::VideoPixelStorage::CPU, input); |
| 52 case video_capture::mojom::VideoPixelStorage::CPU: | 46 *out = media::PIXEL_STORAGE_CPU; |
| 53 *out = media::PIXEL_STORAGE_CPU; | 47 return true; |
| 54 return true; | |
| 55 case video_capture::mojom::VideoPixelStorage::GPUMEMORYBUFFER: | |
| 56 *out = media::PIXEL_STORAGE_GPUMEMORYBUFFER; | |
| 57 return true; | |
| 58 } | |
| 59 NOTREACHED(); | |
| 60 return false; | |
| 61 } | 48 } |
| 62 | 49 |
| 63 } // namespace mojo | 50 } // namespace mojo |
| OLD | NEW |