Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Unified Diff: media/video/capture/mac/video_capture_device_decklink_mac.h

Issue 535983002: Mac Video Capture: Support for Blackmagic DeckLink SDK video capture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@crbug408493__1__Enumerate_blackmagic_devices__2__branched_from_master
Patch Set: tommi@s nits Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/video/capture/mac/video_capture_device_decklink_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b70191a49789da4be51049401fb46ef1afcb56e0 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,38 @@ 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,
+ size_t length,
+ const VideoCaptureFormat& frame_format,
+ int rotation, // Clockwise.
+ base::TimeTicks timestamp);
+
+ // Forwarder to VideoCaptureDevice::Client::OnError().
+ void SendErrorString(const std::string& reason);
+
+ // Forwarder to VideoCaptureDevice::Client::OnLog().
+ void SendLogString(const std::string& message);
+
+ 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, ref counted by
+ // the DeckLink SDK as well.
+ scoped_refptr<DeckLinkCaptureDelegate> decklink_capture_delegate_;
+
+ // Checks for Device (a.k.a. Audio) thread.
+ base::ThreadChecker thread_checker_;
+
DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceDeckLinkMac);
};
« no previous file with comments | « no previous file | media/video/capture/mac/video_capture_device_decklink_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698