summaryrefslogtreecommitdiffstats
path: root/media/video/capture/linux/video_capture_device_linux.h
diff options
context:
space:
mode:
Diffstat (limited to 'media/video/capture/linux/video_capture_device_linux.h')
-rw-r--r--media/video/capture/linux/video_capture_device_linux.h41
1 files changed, 7 insertions, 34 deletions
diff --git a/media/video/capture/linux/video_capture_device_linux.h b/media/video/capture/linux/video_capture_device_linux.h
index 50825e6..a52db26 100644
--- a/media/video/capture/linux/video_capture_device_linux.h
+++ b/media/video/capture/linux/video_capture_device_linux.h
@@ -20,6 +20,7 @@
namespace media {
+// Linux V4L2 implementation of VideoCaptureDevice.
class VideoCaptureDeviceLinux : public VideoCaptureDevice {
public:
static VideoPixelFormat V4l2FourCcToChromiumPixelFormat(uint32 v4l2_fourcc);
@@ -31,49 +32,21 @@ class VideoCaptureDeviceLinux : public VideoCaptureDevice {
// VideoCaptureDevice implementation.
void AllocateAndStart(const VideoCaptureParams& params,
scoped_ptr<Client> client) override;
-
void StopAndDeAllocate() override;
protected:
void SetRotation(int rotation);
- // Once |v4l2_thread_| is started, only called on that thread.
- void SetRotationOnV4L2Thread(int rotation);
-
private:
- // Buffers used to receive video frames from with v4l2.
- struct Buffer {
- Buffer() : start(0), length(0) {}
- void* start;
- size_t length;
- };
-
- // Called on the v4l2_thread_.
- void OnAllocateAndStart(int width,
- int height,
- float frame_rate,
- scoped_ptr<Client> client);
- void OnStopAndDeAllocate();
- void OnCaptureTask();
-
- bool AllocateVideoBuffers();
- void DeAllocateVideoBuffers();
- void SetErrorState(const std::string& reason);
+ // Internal delegate doing the actual capture setting, buffer allocation and
+ // circulacion with the V4L2 API. Created and deleted in the thread where
+ // VideoCaptureDeviceLinux lives but otherwise operating on |v4l2_thread_|.
+ class V4L2CaptureDelegate;
+ scoped_refptr<V4L2CaptureDelegate> capture_impl_;
- bool is_capturing_;
- scoped_ptr<VideoCaptureDevice::Client> client_;
- Name device_name_;
- base::ScopedFD device_fd_; // File descriptor for the opened camera device.
base::Thread v4l2_thread_; // Thread used for reading data from the device.
- Buffer* buffer_pool_;
- int buffer_pool_size_; // Number of allocated buffers.
- int timeout_count_;
- VideoCaptureFormat capture_format_;
- // Clockwise rotation in degrees. This value should be 0, 90, 180, or 270.
- // This is only used on |v4l2_thread_| when it is running, or the constructor
- // thread otherwise.
- int rotation_;
+ const Name device_name_;
DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceLinux);
};