| 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 "services/video_capture/public/interfaces/device_descriptor_struct_trai
ts.h" | |
| 6 | |
| 7 namespace mojo { | |
| 8 | |
| 9 // static | |
| 10 video_capture::mojom::VideoCaptureApi | |
| 11 EnumTraits<video_capture::mojom::VideoCaptureApi, | |
| 12 media::VideoCaptureApi>::ToMojom(media::VideoCaptureApi input) { | |
| 13 switch (input) { | |
| 14 case media::VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE: | |
| 15 return video_capture::mojom::VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE; | |
| 16 case media::VideoCaptureApi::WIN_MEDIA_FOUNDATION: | |
| 17 return video_capture::mojom::VideoCaptureApi::WIN_MEDIA_FOUNDATION; | |
| 18 case media::VideoCaptureApi::WIN_DIRECT_SHOW: | |
| 19 return video_capture::mojom::VideoCaptureApi::WIN_DIRECT_SHOW; | |
| 20 case media::VideoCaptureApi::MACOSX_AVFOUNDATION: | |
| 21 return video_capture::mojom::VideoCaptureApi::MACOSX_AVFOUNDATION; | |
| 22 case media::VideoCaptureApi::MACOSX_DECKLINK: | |
| 23 return video_capture::mojom::VideoCaptureApi::MACOSX_DECKLINK; | |
| 24 case media::VideoCaptureApi::ANDROID_API1: | |
| 25 return video_capture::mojom::VideoCaptureApi::ANDROID_API1; | |
| 26 case media::VideoCaptureApi::ANDROID_API2_LEGACY: | |
| 27 return video_capture::mojom::VideoCaptureApi::ANDROID_API2_LEGACY; | |
| 28 case media::VideoCaptureApi::ANDROID_API2_FULL: | |
| 29 return video_capture::mojom::VideoCaptureApi::ANDROID_API2_FULL; | |
| 30 case media::VideoCaptureApi::ANDROID_API2_LIMITED: | |
| 31 return video_capture::mojom::VideoCaptureApi::ANDROID_API2_LIMITED; | |
| 32 case media::VideoCaptureApi::ANDROID_TANGO: | |
| 33 return video_capture::mojom::VideoCaptureApi::ANDROID_TANGO; | |
| 34 case media::VideoCaptureApi::UNKNOWN: | |
| 35 return video_capture::mojom::VideoCaptureApi::UNKNOWN; | |
| 36 } | |
| 37 NOTREACHED(); | |
| 38 return video_capture::mojom::VideoCaptureApi::UNKNOWN; | |
| 39 } | |
| 40 | |
| 41 // static | |
| 42 bool EnumTraits<video_capture::mojom::VideoCaptureApi, media::VideoCaptureApi>:: | |
| 43 FromMojom(video_capture::mojom::VideoCaptureApi input, | |
| 44 media::VideoCaptureApi* output) { | |
| 45 switch (input) { | |
| 46 case video_capture::mojom::VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE: | |
| 47 *output = media::VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE; | |
| 48 return true; | |
| 49 case video_capture::mojom::VideoCaptureApi::WIN_MEDIA_FOUNDATION: | |
| 50 *output = media::VideoCaptureApi::WIN_MEDIA_FOUNDATION; | |
| 51 return true; | |
| 52 case video_capture::mojom::VideoCaptureApi::WIN_DIRECT_SHOW: | |
| 53 *output = media::VideoCaptureApi::WIN_DIRECT_SHOW; | |
| 54 return true; | |
| 55 case video_capture::mojom::VideoCaptureApi::MACOSX_AVFOUNDATION: | |
| 56 *output = media::VideoCaptureApi::MACOSX_AVFOUNDATION; | |
| 57 return true; | |
| 58 case video_capture::mojom::VideoCaptureApi::MACOSX_DECKLINK: | |
| 59 *output = media::VideoCaptureApi::MACOSX_DECKLINK; | |
| 60 return true; | |
| 61 case video_capture::mojom::VideoCaptureApi::ANDROID_API1: | |
| 62 *output = media::VideoCaptureApi::ANDROID_API1; | |
| 63 return true; | |
| 64 case video_capture::mojom::VideoCaptureApi::ANDROID_API2_LEGACY: | |
| 65 *output = media::VideoCaptureApi::ANDROID_API2_LEGACY; | |
| 66 return true; | |
| 67 case video_capture::mojom::VideoCaptureApi::ANDROID_API2_FULL: | |
| 68 *output = media::VideoCaptureApi::ANDROID_API2_FULL; | |
| 69 return true; | |
| 70 case video_capture::mojom::VideoCaptureApi::ANDROID_API2_LIMITED: | |
| 71 *output = media::VideoCaptureApi::ANDROID_API2_LIMITED; | |
| 72 return true; | |
| 73 case video_capture::mojom::VideoCaptureApi::ANDROID_TANGO: | |
| 74 *output = media::VideoCaptureApi::ANDROID_TANGO; | |
| 75 return true; | |
| 76 case video_capture::mojom::VideoCaptureApi::UNKNOWN: | |
| 77 *output = media::VideoCaptureApi::UNKNOWN; | |
| 78 return true; | |
| 79 } | |
| 80 NOTREACHED(); | |
| 81 return false; | |
| 82 } | |
| 83 | |
| 84 // static | |
| 85 video_capture::mojom::VideoCaptureTransportType EnumTraits< | |
| 86 video_capture::mojom::VideoCaptureTransportType, | |
| 87 media::VideoCaptureTransportType>::ToMojom(media::VideoCaptureTransportType | |
| 88 input) { | |
| 89 switch (input) { | |
| 90 case media::VideoCaptureTransportType::MACOSX_USB_OR_BUILT_IN: | |
| 91 return video_capture::mojom::VideoCaptureTransportType:: | |
| 92 MACOSX_USB_OR_BUILT_IN; | |
| 93 case media::VideoCaptureTransportType::OTHER_TRANSPORT: | |
| 94 return video_capture::mojom::VideoCaptureTransportType::OTHER_TRANSPORT; | |
| 95 } | |
| 96 NOTREACHED(); | |
| 97 return video_capture::mojom::VideoCaptureTransportType::OTHER_TRANSPORT; | |
| 98 } | |
| 99 | |
| 100 // static | |
| 101 bool EnumTraits<video_capture::mojom::VideoCaptureTransportType, | |
| 102 media::VideoCaptureTransportType>:: | |
| 103 FromMojom(video_capture::mojom::VideoCaptureTransportType input, | |
| 104 media::VideoCaptureTransportType* output) { | |
| 105 switch (input) { | |
| 106 case video_capture::mojom::VideoCaptureTransportType:: | |
| 107 MACOSX_USB_OR_BUILT_IN: | |
| 108 *output = media::VideoCaptureTransportType::MACOSX_USB_OR_BUILT_IN; | |
| 109 return true; | |
| 110 case video_capture::mojom::VideoCaptureTransportType::OTHER_TRANSPORT: | |
| 111 *output = media::VideoCaptureTransportType::OTHER_TRANSPORT; | |
| 112 return true; | |
| 113 } | |
| 114 NOTREACHED(); | |
| 115 return false; | |
| 116 } | |
| 117 | |
| 118 // static | |
| 119 bool StructTraits<video_capture::mojom::DeviceDescriptorDataView, | |
| 120 media::VideoCaptureDeviceDescriptor>:: | |
| 121 Read(video_capture::mojom::DeviceDescriptorDataView data, | |
| 122 media::VideoCaptureDeviceDescriptor* output) { | |
| 123 if (!data.ReadDisplayName(&(output->display_name))) | |
| 124 return false; | |
| 125 | |
| 126 if (!data.ReadDeviceId(&(output->device_id))) | |
| 127 return false; | |
| 128 | |
| 129 if (!data.ReadModelId(&(output->model_id))) | |
| 130 return false; | |
| 131 | |
| 132 if (!data.ReadCaptureApi(&(output->capture_api))) | |
| 133 return false; | |
| 134 | |
| 135 if (!data.ReadTransportType(&(output->transport_type))) | |
| 136 return false; | |
| 137 | |
| 138 return true; | |
| 139 } | |
| 140 | |
| 141 } // namespace mojo | |
| OLD | NEW |