Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // VideoCaptureDevice is the abstract base class for realizing video capture | 5 // VideoCaptureDevice is the abstract base class for realizing video capture |
| 6 // device support in Chromium. It provides the interface for OS dependent | 6 // device support in Chromium. It provides the interface for OS dependent |
| 7 // implementations. | 7 // implementations. |
| 8 // The class is created and functions are invoked on a thread owned by | 8 // The class is created and functions are invoked on a thread owned by |
| 9 // VideoCaptureManager. Capturing is done on other threads depended on the OS | 9 // VideoCaptureManager. Capturing is done on other threads depended on the OS |
| 10 // specific implementation. | 10 // specific implementation. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 std::string device_name; | 29 std::string device_name; |
| 30 | 30 |
| 31 // Unique name of a device. Even if there are multiple devices with the same | 31 // Unique name of a device. Even if there are multiple devices with the same |
| 32 // friendly name connected to the computer this will be unique. | 32 // friendly name connected to the computer this will be unique. |
| 33 std::string unique_id; | 33 std::string unique_id; |
| 34 }; | 34 }; |
| 35 typedef std::list<Name> Names; | 35 typedef std::list<Name> Names; |
| 36 | 36 |
| 37 class MEDIA_EXPORT EventHandler { | 37 class MEDIA_EXPORT EventHandler { |
| 38 public: | 38 public: |
| 39 // Captured a new video frame. | 39 // Captured a new video frame as a raw buffer. The size, color format, and |
| 40 // layout are taken from the parameters specified by an earlier call to | |
| 41 // OnFrameInfo. |data| must be packed, with no padding between rows and/or | |
|
scherkus (not reviewing)
2013/02/05 22:40:44
pedantic nit: similar to using || around variable
ncarter (slow)
2013/02/06 23:54:44
Done.
| |
| 42 // color planes. | |
| 40 virtual void OnIncomingCapturedFrame(const uint8* data, | 43 virtual void OnIncomingCapturedFrame(const uint8* data, |
| 41 int length, | 44 int length, |
| 42 base::Time timestamp) = 0; | 45 base::Time timestamp) = 0; |
| 46 // Captured a new video frame, held in a VideoFrame container. |frame| must | |
| 47 // be allocated as RGB32, YV12 or I420, and the size must match that | |
| 48 // specified by an earlier call to OnFrameInfo. | |
|
scherkus (not reviewing)
2013/02/05 22:40:44
s/OnFrameInfo/OnFrameInfo()/
ncarter (slow)
2013/02/06 23:54:44
Done.
| |
| 49 virtual void OnIncomingCapturedVideoFrame(media::VideoFrame* frame, | |
|
scherkus (not reviewing)
2013/02/05 22:40:44
I'm firmly in the camp that likes uses const scope
ncarter (slow)
2013/02/06 23:54:44
Changing T*'s to const scoped_refptr<T>&'s would b
scherkus (not reviewing)
2013/02/07 18:25:03
SGTM
| |
| 50 base::Time timestamp) = 0; | |
|
scherkus (not reviewing)
2013/02/05 22:40:44
FYI VideoFrame has a Get/SetTimestamp() field, alt
ncarter (slow)
2013/02/06 23:54:44
Yeah, I'm aware of that and I think it would be ni
scherkus (not reviewing)
2013/02/07 18:25:03
Agreed -- I believe VF (and other media buffer-ish
| |
| 43 // An error has occurred that can not be handled | 51 // An error has occurred that can not be handled |
| 44 // and VideoCaptureDevice must be DeAllocated. | 52 // and VideoCaptureDevice must be DeAllocated. |
| 45 virtual void OnError() = 0; | 53 virtual void OnError() = 0; |
| 46 // Called when VideoCaptureDevice::Allocate has been called | 54 // Called when VideoCaptureDevice::Allocate has been called |
| 47 // to inform of the resulting frame size and color format. | 55 // to inform of the resulting frame size. |
| 48 virtual void OnFrameInfo(const VideoCaptureCapability& info) = 0; | 56 virtual void OnFrameInfo(const VideoCaptureCapability& info) = 0; |
| 49 | 57 |
| 50 protected: | 58 protected: |
| 51 virtual ~EventHandler() {} | 59 virtual ~EventHandler() {} |
| 52 }; | 60 }; |
| 53 // Creates a VideoCaptureDevice object. | 61 // Creates a VideoCaptureDevice object. |
| 54 // Return NULL if the hardware is not available. | 62 // Return NULL if the hardware is not available. |
| 55 static VideoCaptureDevice* Create(const Name& device_name); | 63 static VideoCaptureDevice* Create(const Name& device_name); |
| 56 virtual ~VideoCaptureDevice() {} | 64 virtual ~VideoCaptureDevice() {} |
| 57 | 65 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 79 // state it was when created. | 87 // state it was when created. |
| 80 virtual void DeAllocate() = 0; | 88 virtual void DeAllocate() = 0; |
| 81 | 89 |
| 82 // Get the name of the capture device. | 90 // Get the name of the capture device. |
| 83 virtual const Name& device_name() = 0; | 91 virtual const Name& device_name() = 0; |
| 84 }; | 92 }; |
| 85 | 93 |
| 86 } // namespace media | 94 } // namespace media |
| 87 | 95 |
| 88 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 96 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
| OLD | NEW |