Chromium Code Reviews| Index: media/video/capture/mac/video_capture_device_decklink_mac.h |
| diff --git a/media/video/capture/mac/video_capture_device_decklink_mac.h b/media/video/capture/mac/video_capture_device_decklink_mac.h |
| index 8fadc188bee68ef063951f0283a149c39c576af8..82ce14baa5bfaac1ecff875b840838f2b399e193 100644 |
| --- a/media/video/capture/mac/video_capture_device_decklink_mac.h |
| +++ b/media/video/capture/mac/video_capture_device_decklink_mac.h |
| @@ -12,18 +12,30 @@ |
| #import <Foundation/Foundation.h> |
| +#include "base/synchronization/lock.h" |
| +#include "base/threading/thread_checker.h" |
| + |
| +namespace { |
| +class DeckLinkCaptureDelegate; |
| +} // namespace |
| + |
| namespace media { |
| -// Extension of VideoCaptureDevice to create and manipulate Blackmagic devices |
| -// via DeckLink SDK. |
| +// Extension of VideoCaptureDevice to create and manipulate Blackmagic devices. |
| +// Creates a reference counted |decklink_capture_delegate_| that does all the |
| +// DeckLink SDK configuration and capture work while holding a weak reference to |
| +// us for sending back frames, logs and error messages. |
| class MEDIA_EXPORT VideoCaptureDeviceDeckLinkMac : public VideoCaptureDevice { |
| public: |
| // Gets the names of all DeckLink video capture devices connected to this |
| - // computer, as enumerated by the DeckLink SDK. |
| + // computer, as enumerated by the DeckLink SDK. To allow the user to choose |
| + // exactly which capture format she wants, we enumerate as many cameras as |
| + // capture formats. |
| static void EnumerateDevices(VideoCaptureDevice::Names* device_names); |
| // Gets the supported formats of a particular device attached to the system, |
| // identified by |device|. Formats are retrieved from the DeckLink SDK. |
| + // Following the enumeration, each camera will have only one capability. |
| static void EnumerateDeviceCapabilities( |
| const VideoCaptureDevice::Name& device, |
| VideoCaptureFormats* supported_formats); |
| @@ -31,13 +43,36 @@ class MEDIA_EXPORT VideoCaptureDeviceDeckLinkMac : public VideoCaptureDevice { |
| explicit VideoCaptureDeviceDeckLinkMac(const Name& device_name); |
| virtual ~VideoCaptureDeviceDeckLinkMac(); |
| + // Copy of VideoCaptureDevice::Client::OnIncomingCapturedData(). Used by |
| + // |decklink_capture_delegate_| to forward captured frames. |
| + void OnIncomingCapturedData(const uint8* data, |
| + int length, |
| + const VideoCaptureFormat& frame_format, |
| + int rotation, // Clockwise. |
| + base::TimeTicks timestamp); |
| + |
| + // Forwarder to VideoCaptureDevice::Client::OnError(). |
| + void sendErrorString(const std::string& reason); |
|
tommi (sloooow) - chröme
2014/09/22 20:26:38
SendErrorString? (fix capitalization)
mcasas
2014/09/23 08:54:53
Done.
Was confused with Obj-C.
|
| + |
| + // Forwarder to VideoCaptureDevice::Client::OnLog(). |
| + void sendLogString(const std::string& message); |
|
tommi (sloooow) - chröme
2014/09/22 20:26:38
ditto.
also, do these need to be public?
mcasas
2014/09/23 08:54:54
Done.
|
| + |
| + private: |
| // VideoCaptureDevice implementation. |
| virtual void AllocateAndStart( |
| const VideoCaptureParams& params, |
| scoped_ptr<VideoCaptureDevice::Client> client) OVERRIDE; |
| virtual void StopAndDeAllocate() OVERRIDE; |
| - private: |
| + // Protects concurrent setting and using of |client_|. |
| + base::Lock lock_; |
| + scoped_ptr<VideoCaptureDevice::Client> client_; |
| + // Reference counted handle to the DeckLink capture delegate, also ref counted |
| + // by the DeckLink SDK as well. |
| + scoped_refptr<DeckLinkCaptureDelegate> decklink_capture_delegate_; |
| + |
| + base::ThreadChecker thread_checker_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceDeckLinkMac); |
| }; |