| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_DEVICE_CLIENT_H_ | 5 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_DEVICE_CLIENT_H_ | 6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "content/common/content_export.h" | 16 #include "media/capture/capture_export.h" |
| 17 #include "media/capture/video/video_capture_device.h" | 17 #include "media/capture/video/video_capture_device.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace media { |
| 20 class VideoCaptureBufferPool; | 20 class VideoCaptureBufferPool; |
| 21 class VideoFrameReceiver; | 21 class VideoFrameReceiver; |
| 22 class VideoCaptureJpegDecoder; | 22 class VideoCaptureJpegDecoder; |
| 23 | 23 |
| 24 using VideoCaptureJpegDecoderFactoryCB = | 24 using VideoCaptureJpegDecoderFactoryCB = |
| 25 base::Callback<std::unique_ptr<VideoCaptureJpegDecoder>()>; | 25 base::Callback<std::unique_ptr<VideoCaptureJpegDecoder>()>; |
| 26 | 26 |
| 27 // Implementation of media::VideoCaptureDevice::Client that uses a buffer pool | 27 // Implementation of media::VideoCaptureDevice::Client that uses a buffer pool |
| 28 // to provide buffers and converts incoming data to the I420 format for | 28 // to provide buffers and converts incoming data to the I420 format for |
| 29 // consumption by a given VideoFrameReceiver. | 29 // consumption by a given VideoFrameReceiver. |
| 30 // | 30 // |
| 31 // Methods of this class may be called from any thread, and in practice will | 31 // Methods of this class may be called from any thread, and in practice will |
| 32 // often be called on some auxiliary thread depending on the platform and the | 32 // often be called on some auxiliary thread depending on the platform and the |
| 33 // device type; including, for example, the DirectShow thread on Windows, the | 33 // device type; including, for example, the DirectShow thread on Windows, the |
| 34 // v4l2_thread on Linux, and the UI thread for tab capture. | 34 // v4l2_thread on Linux, and the UI thread for tab capture. |
| 35 // The owner is responsible for making sure that the instance outlives these | 35 // The owner is responsible for making sure that the instance outlives these |
| 36 // calls. | 36 // calls. |
| 37 // | 37 // |
| 38 // It has an internal ref counted TextureWrapHelper class used to wrap incoming | 38 // It has an internal ref counted TextureWrapHelper class used to wrap incoming |
| 39 // GpuMemoryBuffers into Texture backed VideoFrames. This class creates and | 39 // GpuMemoryBuffers into Texture backed VideoFrames. This class creates and |
| 40 // manages the necessary entities to interact with the GPU process, notably an | 40 // manages the necessary entities to interact with the GPU process, notably an |
| 41 // offscreen Context to avoid janking the UI thread. | 41 // offscreen Context to avoid janking the UI thread. |
| 42 class CONTENT_EXPORT VideoCaptureDeviceClient | 42 class CAPTURE_EXPORT VideoCaptureDeviceClient |
| 43 : public media::VideoCaptureDevice::Client, | 43 : public media::VideoCaptureDevice::Client, |
| 44 public base::SupportsWeakPtr<VideoCaptureDeviceClient> { | 44 public base::SupportsWeakPtr<VideoCaptureDeviceClient> { |
| 45 public: | 45 public: |
| 46 VideoCaptureDeviceClient( | 46 VideoCaptureDeviceClient( |
| 47 std::unique_ptr<VideoFrameReceiver> receiver, | 47 std::unique_ptr<VideoFrameReceiver> receiver, |
| 48 const scoped_refptr<VideoCaptureBufferPool>& buffer_pool, | 48 const scoped_refptr<VideoCaptureBufferPool>& buffer_pool, |
| 49 const VideoCaptureJpegDecoderFactoryCB& jpeg_decoder_factory); | 49 const VideoCaptureJpegDecoderFactoryCB& jpeg_decoder_factory); |
| 50 ~VideoCaptureDeviceClient() override; | 50 ~VideoCaptureDeviceClient() override; |
| 51 | 51 |
| 52 // VideoCaptureDevice::Client implementation. | 52 // VideoCaptureDevice::Client implementation. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 // Indication to the Client to copy-transform the incoming data into | 119 // Indication to the Client to copy-transform the incoming data into |
| 120 // GpuMemoryBuffers. | 120 // GpuMemoryBuffers. |
| 121 const bool use_gpu_memory_buffers_; | 121 const bool use_gpu_memory_buffers_; |
| 122 | 122 |
| 123 media::VideoPixelFormat last_captured_pixel_format_; | 123 media::VideoPixelFormat last_captured_pixel_format_; |
| 124 | 124 |
| 125 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); | 125 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 } // namespace media |
| 128 | 129 |
| 129 } // namespace content | 130 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
| 130 | |
| 131 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_DEVICE_CLIENT_H_ | |
| OLD | NEW |