OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // Implementation of VideoCaptureDevice class for Blackmagic video capture | 5 // Implementation of VideoCaptureDevice class for Blackmagic video capture |
6 // devices by using the DeckLink SDK. | 6 // devices by using the DeckLink SDK. |
7 | 7 |
8 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_DECKLINK_MAC_H_ | 8 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_DECKLINK_MAC_H_ |
9 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_DECKLINK_MAC_H_ | 9 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_DECKLINK_MAC_H_ |
10 | 10 |
11 #include "media/capture/video/video_capture_device.h" | 11 #include "media/capture/video/video_capture_device.h" |
12 | 12 |
13 #import <Foundation/Foundation.h> | 13 #import <Foundation/Foundation.h> |
14 | 14 |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 class DeckLinkCaptureDelegate; | 19 class DeckLinkCaptureDelegate; |
20 } // namespace | 20 } // namespace |
21 | 21 |
| 22 namespace tracked_objects { |
| 23 class Location; |
| 24 } // namespace tracked_objects |
| 25 |
22 namespace media { | 26 namespace media { |
23 | 27 |
24 // Extension of VideoCaptureDevice to create and manipulate Blackmagic devices. | 28 // Extension of VideoCaptureDevice to create and manipulate Blackmagic devices. |
25 // Creates a reference counted |decklink_capture_delegate_| that does all the | 29 // Creates a reference counted |decklink_capture_delegate_| that does all the |
26 // DeckLink SDK configuration and capture work while holding a weak reference to | 30 // DeckLink SDK configuration and capture work while holding a weak reference to |
27 // us for sending back frames, logs and error messages. | 31 // us for sending back frames, logs and error messages. |
28 class MEDIA_EXPORT VideoCaptureDeviceDeckLinkMac : public VideoCaptureDevice { | 32 class MEDIA_EXPORT VideoCaptureDeviceDeckLinkMac : public VideoCaptureDevice { |
29 public: | 33 public: |
30 // Gets the names of all DeckLink video capture devices connected to this | 34 // Gets the names of all DeckLink video capture devices connected to this |
31 // computer, as enumerated by the DeckLink SDK. To allow the user to choose | 35 // computer, as enumerated by the DeckLink SDK. To allow the user to choose |
(...skipping 13 matching lines...) Expand all Loading... |
45 | 49 |
46 // Copy of VideoCaptureDevice::Client::OnIncomingCapturedData(). Used by | 50 // Copy of VideoCaptureDevice::Client::OnIncomingCapturedData(). Used by |
47 // |decklink_capture_delegate_| to forward captured frames. | 51 // |decklink_capture_delegate_| to forward captured frames. |
48 void OnIncomingCapturedData(const uint8* data, | 52 void OnIncomingCapturedData(const uint8* data, |
49 size_t length, | 53 size_t length, |
50 const VideoCaptureFormat& frame_format, | 54 const VideoCaptureFormat& frame_format, |
51 int rotation, // Clockwise. | 55 int rotation, // Clockwise. |
52 base::TimeTicks timestamp); | 56 base::TimeTicks timestamp); |
53 | 57 |
54 // Forwarder to VideoCaptureDevice::Client::OnError(). | 58 // Forwarder to VideoCaptureDevice::Client::OnError(). |
55 void SendErrorString(const std::string& reason); | 59 void SendErrorString(const tracked_objects::Location& from_here, |
| 60 const std::string& reason); |
56 | 61 |
57 // Forwarder to VideoCaptureDevice::Client::OnLog(). | 62 // Forwarder to VideoCaptureDevice::Client::OnLog(). |
58 void SendLogString(const std::string& message); | 63 void SendLogString(const std::string& message); |
59 | 64 |
60 private: | 65 private: |
61 // VideoCaptureDevice implementation. | 66 // VideoCaptureDevice implementation. |
62 void AllocateAndStart(const VideoCaptureParams& params, | 67 void AllocateAndStart(const VideoCaptureParams& params, |
63 scoped_ptr<VideoCaptureDevice::Client> client) override; | 68 scoped_ptr<VideoCaptureDevice::Client> client) override; |
64 void StopAndDeAllocate() override; | 69 void StopAndDeAllocate() override; |
65 | 70 |
66 // Protects concurrent setting and using of |client_|. | 71 // Protects concurrent setting and using of |client_|. |
67 base::Lock lock_; | 72 base::Lock lock_; |
68 scoped_ptr<VideoCaptureDevice::Client> client_; | 73 scoped_ptr<VideoCaptureDevice::Client> client_; |
69 | 74 |
70 // Reference counted handle to the DeckLink capture delegate, ref counted by | 75 // Reference counted handle to the DeckLink capture delegate, ref counted by |
71 // the DeckLink SDK as well. | 76 // the DeckLink SDK as well. |
72 scoped_refptr<DeckLinkCaptureDelegate> decklink_capture_delegate_; | 77 scoped_refptr<DeckLinkCaptureDelegate> decklink_capture_delegate_; |
73 | 78 |
74 // Checks for Device (a.k.a. Audio) thread. | 79 // Checks for Device (a.k.a. Audio) thread. |
75 base::ThreadChecker thread_checker_; | 80 base::ThreadChecker thread_checker_; |
76 | 81 |
77 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceDeckLinkMac); | 82 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceDeckLinkMac); |
78 }; | 83 }; |
79 | 84 |
80 } // namespace media | 85 } // namespace media |
81 | 86 |
82 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_DECKLINK_MAC_H_ | 87 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_DECKLINK_MAC_H_ |
OLD | NEW |