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& display_name, |
| 17 const std::string& device_id, |
| 18 VideoCaptureApi capture_api, |
| 19 VideoCaptureTransportType transport_type) |
| 20 : display_name(display_name), |
| 21 device_id(device_id), |
| 22 capture_api(capture_api), |
| 23 transport_type(transport_type) {} |
| 24 |
| 25 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor( |
| 26 const std::string& display_name, |
| 27 const std::string& device_id, |
| 28 const std::string& model_id, |
| 29 VideoCaptureApi capture_api, |
| 30 VideoCaptureTransportType transport_type) |
| 31 : display_name(display_name), |
| 32 device_id(device_id), |
| 33 model_id(model_id), |
| 34 capture_api(capture_api), |
| 35 transport_type(transport_type) {} |
| 36 |
| 37 VideoCaptureDeviceDescriptor::~VideoCaptureDeviceDescriptor() {} |
| 38 |
| 39 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor( |
| 40 const VideoCaptureDeviceDescriptor& other) = default; |
| 41 |
| 42 const char* VideoCaptureDeviceDescriptor::GetCaptureApiTypeString() const { |
| 43 switch (capture_api) { |
| 44 case VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE: |
| 45 return "V4L2 SPLANE"; |
| 46 case VideoCaptureApi::WIN_MEDIA_FOUNDATION: |
| 47 return "Media Foundation"; |
| 48 case VideoCaptureApi::WIN_DIRECT_SHOW: |
| 49 return "Direct Show"; |
| 50 case VideoCaptureApi::MACOSX_AVFOUNDATION: |
| 51 return "AV Foundation"; |
| 52 case VideoCaptureApi::MACOSX_DECKLINK: |
| 53 return "DeckLink"; |
| 54 case VideoCaptureApi::ANDROID_API1: |
| 55 return "Camera API1"; |
| 56 case VideoCaptureApi::ANDROID_API2_LEGACY: |
| 57 return "Camera API2 Legacy"; |
| 58 case VideoCaptureApi::ANDROID_API2_FULL: |
| 59 return "Camera API2 Full"; |
| 60 case VideoCaptureApi::ANDROID_API2_LIMITED: |
| 61 return "Camera API2 Limited"; |
| 62 case VideoCaptureApi::ANDROID_TANGO: |
| 63 return "Tango API"; |
| 64 default: |
| 65 NOTREACHED() << "Unknown Video Capture API type: " |
| 66 << static_cast<int>(capture_api); |
| 67 return "Unknown API"; |
| 68 } |
| 69 } |
| 70 |
| 71 std::string VideoCaptureDeviceDescriptor::GetNameAndModel() const { |
| 72 if (model_id.empty()) |
| 73 return display_name; |
| 74 return display_name + " (" + model_id + ")"; |
| 75 } |
| 76 |
| 77 } // namespace media |
OLD | NEW |