| 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 #ifndef SERVICES_VIDEO_CAPTURE_DEVICE_FACTORY_MEDIA_TO_MOJO_ADAPTER_H_ | 5 #ifndef SERVICES_VIDEO_CAPTURE_DEVICE_FACTORY_MEDIA_TO_MOJO_ADAPTER_H_ |
| 6 #define SERVICES_VIDEO_CAPTURE_DEVICE_FACTORY_MEDIA_TO_MOJO_ADAPTER_H_ | 6 #define SERVICES_VIDEO_CAPTURE_DEVICE_FACTORY_MEDIA_TO_MOJO_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "media/capture/video/video_capture_device_client.h" | 10 #include "media/capture/video/video_capture_device_client.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 DeviceFactoryMediaToMojoAdapter( | 27 DeviceFactoryMediaToMojoAdapter( |
| 28 std::unique_ptr<media::VideoCaptureDeviceFactory> device_factory, | 28 std::unique_ptr<media::VideoCaptureDeviceFactory> device_factory, |
| 29 const media::VideoCaptureJpegDecoderFactoryCB& | 29 const media::VideoCaptureJpegDecoderFactoryCB& |
| 30 jpeg_decoder_factory_callback); | 30 jpeg_decoder_factory_callback); |
| 31 ~DeviceFactoryMediaToMojoAdapter() override; | 31 ~DeviceFactoryMediaToMojoAdapter() override; |
| 32 | 32 |
| 33 // mojom::VideoCaptureDeviceFactory: | 33 // mojom::VideoCaptureDeviceFactory: |
| 34 void EnumerateDeviceDescriptors( | 34 void EnumerateDeviceDescriptors( |
| 35 const EnumerateDeviceDescriptorsCallback& callback) override; | 35 const EnumerateDeviceDescriptorsCallback& callback) override; |
| 36 void GetSupportedFormats( | 36 void GetSupportedFormats( |
| 37 const media::VideoCaptureDeviceDescriptor& device_descriptor, | 37 const std::string& device_id, |
| 38 const GetSupportedFormatsCallback& callback) override; | 38 const GetSupportedFormatsCallback& callback) override; |
| 39 void CreateDeviceProxy( | 39 void CreateDeviceProxy(const std::string& device_id, |
| 40 const media::VideoCaptureDeviceDescriptor& device_descriptor, | 40 mojom::VideoCaptureDeviceProxyRequest proxy_request, |
| 41 mojom::VideoCaptureDeviceProxyRequest proxy_request, | 41 const CreateDeviceProxyCallback& callback) override; |
| 42 const CreateDeviceProxyCallback& callback) override; | |
| 43 | 42 |
| 44 private: | 43 private: |
| 45 struct ActiveDeviceEntry { | 44 struct ActiveDeviceEntry { |
| 46 ActiveDeviceEntry(); | 45 ActiveDeviceEntry(); |
| 47 ~ActiveDeviceEntry(); | 46 ~ActiveDeviceEntry(); |
| 48 ActiveDeviceEntry(ActiveDeviceEntry&& other); | 47 ActiveDeviceEntry(ActiveDeviceEntry&& other); |
| 49 ActiveDeviceEntry& operator=(ActiveDeviceEntry&& other); | 48 ActiveDeviceEntry& operator=(ActiveDeviceEntry&& other); |
| 50 | 49 |
| 51 std::unique_ptr<VideoCaptureDeviceProxyImpl> device_proxy; | 50 std::unique_ptr<VideoCaptureDeviceProxyImpl> device_proxy; |
| 52 // TODO(chfremer) Use mojo::Binding<> directly instead of unique_ptr<> when | 51 // TODO(chfremer) Use mojo::Binding<> directly instead of unique_ptr<> when |
| 53 // mojo::Binding<> supports move operators. | 52 // mojo::Binding<> supports move operators. |
| 54 // https://crbug.com/644314 | 53 // https://crbug.com/644314 |
| 55 std::unique_ptr<mojo::Binding<mojom::VideoCaptureDeviceProxy>> binding; | 54 std::unique_ptr<mojo::Binding<mojom::VideoCaptureDeviceProxy>> binding; |
| 56 }; | 55 }; |
| 57 | 56 |
| 58 void OnClientConnectionErrorOrClose( | 57 void OnClientConnectionErrorOrClose(const std::string& device_id); |
| 59 const media::VideoCaptureDeviceDescriptor& descriptor); | 58 |
| 59 // Returns false if no descriptor found. |
| 60 bool LookupDescriptorFromId(const std::string& device_id, |
| 61 media::VideoCaptureDeviceDescriptor* descriptor); |
| 60 | 62 |
| 61 const std::unique_ptr<media::VideoCaptureDeviceFactory> device_factory_; | 63 const std::unique_ptr<media::VideoCaptureDeviceFactory> device_factory_; |
| 62 const media::VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_; | 64 const media::VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_; |
| 63 std::map<media::VideoCaptureDeviceDescriptor, ActiveDeviceEntry> | 65 std::map<std::string, ActiveDeviceEntry> active_devices_by_id_; |
| 64 active_devices_; | |
| 65 }; | 66 }; |
| 66 | 67 |
| 67 } // namespace video_capture | 68 } // namespace video_capture |
| 68 | 69 |
| 69 #endif // SERVICES_VIDEO_CAPTURE_DEVICE_FACTORY_MEDIA_TO_MOJO_ADAPTER_H_ | 70 #endif // SERVICES_VIDEO_CAPTURE_DEVICE_FACTORY_MEDIA_TO_MOJO_ADAPTER_H_ |
| OLD | NEW |