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/video/video_capture_device_descriptor.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 |
| 9 namespace media { |
| 10 |
| 11 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor() |
| 12 : capture_api(VideoCaptureApi::UNKNOWN), |
| 13 transport_type(VideoCaptureTransportType::OTHER_TRANSPORT) {} |
| 14 |
| 15 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor( |
| 16 const std::string friendly_name, |
| 17 const std::string device_id, |
| 18 VideoCaptureApi capture_api) |
| 19 : friendly_name(friendly_name), |
| 20 device_id(device_id), |
| 21 capture_api(capture_api) {} |
| 22 |
| 23 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor( |
| 24 const std::string friendly_name, |
| 25 const std::string device_id, |
| 26 const std::string model_id, |
| 27 VideoCaptureApi capture_api) |
| 28 : friendly_name(friendly_name), |
| 29 device_id(device_id), |
| 30 model_id(model_id), |
| 31 capture_api(capture_api) {} |
| 32 |
| 33 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor( |
| 34 const std::string friendly_name, |
| 35 const std::string device_id, |
| 36 VideoCaptureApi capture_api, |
| 37 VideoCaptureTransportType transport_type) |
| 38 : friendly_name(friendly_name), |
| 39 device_id(device_id), |
| 40 capture_api(capture_api), |
| 41 transport_type(transport_type) {} |
| 42 |
| 43 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor( |
| 44 const std::string friendly_name, |
| 45 const std::string device_id, |
| 46 const std::string model_id, |
| 47 VideoCaptureApi capture_api, |
| 48 VideoCaptureTransportType transport_type) |
| 49 : friendly_name(friendly_name), |
| 50 device_id(device_id), |
| 51 model_id(model_id), |
| 52 capture_api(capture_api), |
| 53 transport_type(transport_type) {} |
| 54 |
| 55 VideoCaptureDeviceDescriptor::~VideoCaptureDeviceDescriptor() {} |
| 56 |
| 57 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor( |
| 58 const VideoCaptureDeviceDescriptor& other) = default; |
| 59 |
| 60 const char* VideoCaptureDeviceDescriptor::GetCaptureApiTypeString() const { |
| 61 switch (capture_api) { |
| 62 case VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE: |
| 63 return "V4L2 SPLANE"; |
| 64 case VideoCaptureApi::WINDOWS_MEDIA_FOUNDATION: |
| 65 return "Media Foundation"; |
| 66 case VideoCaptureApi::WINDOWS_DIRECT_SHOW: |
| 67 return "Direct Show"; |
| 68 case VideoCaptureApi::MACOSX_AVFOUNDATION: |
| 69 return "AV Foundation"; |
| 70 case VideoCaptureApi::MACOSX_DECKLINK: |
| 71 return "DeckLink"; |
| 72 case VideoCaptureApi::ANDROID_API1: |
| 73 return "Camera API1"; |
| 74 case VideoCaptureApi::ANDROID_API2_LEGACY: |
| 75 return "Camera API2 Legacy"; |
| 76 case VideoCaptureApi::ANDROID_API2_FULL: |
| 77 return "Camera API2 Full"; |
| 78 case VideoCaptureApi::ANDROID_API2_LIMITED: |
| 79 return "Camera API2 Limited"; |
| 80 case VideoCaptureApi::ANDROID_TANGO: |
| 81 return "Tango API"; |
| 82 default: |
| 83 NOTREACHED() << "Unknown Video Capture API type: " |
| 84 << static_cast<int>(capture_api); |
| 85 return "Unknown API"; |
| 86 } |
| 87 } |
| 88 |
| 89 std::string VideoCaptureDeviceDescriptor::GetNameAndModel() const { |
| 90 if (model_id.empty()) |
| 91 return friendly_name; |
| 92 return friendly_name + " (" + model_id + ")"; |
| 93 } |
| 94 |
| 95 } // namespace media |
OLD | NEW |