[mac]Separate file for VideoCaptureDeviceAVFoundationFrameReceiver
The CL changes nothing, it only moves the class declaration of
`VideoCaptureDeviceAVFoundationFrameReceiver` into a separate
file.
Bug: 1430702
Change-Id: Iff1310ffa19959cb990498b57ea4a371ac5f97f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4558144
Commit-Queue: Abhijeet Kandalkar <abhijeet@igalia.com>
Reviewed-by: Markus Handell <handellm@google.com>
Cr-Commit-Position: refs/heads/main@{#1151782}
diff --git a/media/capture/BUILD.gn b/media/capture/BUILD.gn
index 6478c1f..75b8a0c 100644
--- a/media/capture/BUILD.gn
+++ b/media/capture/BUILD.gn
@@ -191,6 +191,7 @@
"video/mac/video_capture_device_decklink_mac.mm",
"video/mac/video_capture_device_factory_mac.h",
"video/mac/video_capture_device_factory_mac.mm",
+ "video/mac/video_capture_device_frame_receiver.h",
"video/mac/video_capture_device_mac.h",
"video/mac/video_capture_device_mac.mm",
"video/mac/video_capture_metrics_mac.h",
diff --git a/media/capture/video/mac/test/mock_video_capture_device_avfoundation_frame_receiver_mac.h b/media/capture/video/mac/test/mock_video_capture_device_avfoundation_frame_receiver_mac.h
index ef76e32..1735580 100644
--- a/media/capture/video/mac/test/mock_video_capture_device_avfoundation_frame_receiver_mac.h
+++ b/media/capture/video/mac/test/mock_video_capture_device_avfoundation_frame_receiver_mac.h
@@ -5,7 +5,7 @@
#ifndef MEDIA_CAPTURE_VIDEO_MAC_TEST_MOCK_VIDEO_CAPTURE_DEVICE_AVFOUNDATION_FRAME_RECEIVER_MAC_H_
#define MEDIA_CAPTURE_VIDEO_MAC_TEST_MOCK_VIDEO_CAPTURE_DEVICE_AVFOUNDATION_FRAME_RECEIVER_MAC_H_
-#include "media/capture/video/mac/video_capture_device_avfoundation_mac.h"
+#include "media/capture/video/mac/video_capture_device_frame_receiver.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace media {
diff --git a/media/capture/video/mac/video_capture_device_avfoundation_mac.h b/media/capture/video/mac/video_capture_device_avfoundation_mac.h
index b7981ec6..db968b1 100644
--- a/media/capture/video/mac/video_capture_device_avfoundation_mac.h
+++ b/media/capture/video/mac/video_capture_device_avfoundation_mac.h
@@ -14,6 +14,7 @@
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
#include "media/capture/video/mac/sample_buffer_transformer_mac.h"
+#include "media/capture/video/mac/video_capture_device_frame_receiver.h"
#include "media/capture/video/video_capture_device.h"
#include "media/capture/video_capture_types.h"
@@ -23,45 +24,6 @@
namespace media {
-class CAPTURE_EXPORT VideoCaptureDeviceAVFoundationFrameReceiver {
- public:
- virtual ~VideoCaptureDeviceAVFoundationFrameReceiver() = default;
-
- // Called to deliver captured video frames. It's safe to call this method
- // from any thread, including those controlled by AVFoundation.
- virtual void ReceiveFrame(const uint8_t* video_frame,
- int video_frame_length,
- const VideoCaptureFormat& frame_format,
- const gfx::ColorSpace color_space,
- int aspect_numerator,
- int aspect_denominator,
- base::TimeDelta timestamp) = 0;
-
- // Called to deliver GpuMemoryBuffer-wrapped captured video frames. This
- // function may be called from any thread, including those controlled by
- // AVFoundation.
- virtual void ReceiveExternalGpuMemoryBufferFrame(
- CapturedExternalVideoBuffer frame,
- base::TimeDelta timestamp) = 0;
-
- // Callbacks with the result of a still image capture, or in case of error,
- // respectively. It's safe to call these methods from any thread.
- virtual void OnPhotoTaken(const uint8_t* image_data,
- size_t image_length,
- const std::string& mime_type) = 0;
-
- // Callback when a call to takePhoto fails.
- virtual void OnPhotoError() = 0;
-
- // Forwarder to VideoCaptureDevice::Client::OnError().
- virtual void ReceiveError(VideoCaptureError error,
- const base::Location& from_here,
- const std::string& reason) = 0;
-
- // Forwarder to VideoCaptureDevice::Client::OnCaptureConfigurationChanged().
- virtual void ReceiveCaptureConfigurationChanged() = 0;
-};
-
// Find the best capture format from |formats| for the specified dimensions and
// frame rate. Returns an element of |formats|, or nil.
AVCaptureDeviceFormat* CAPTURE_EXPORT
diff --git a/media/capture/video/mac/video_capture_device_frame_receiver.h b/media/capture/video/mac/video_capture_device_frame_receiver.h
new file mode 100644
index 0000000..795cd10
--- /dev/null
+++ b/media/capture/video/mac/video_capture_device_frame_receiver.h
@@ -0,0 +1,59 @@
+// Copyright 2023 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_CAPTURE_VIDEO_MAC_VIDEO_CAPTURE_DEVICE_FRAME_RECEIVER_H_
+#define MEDIA_CAPTURE_VIDEO_MAC_VIDEO_CAPTURE_DEVICE_FRAME_RECEIVER_H_
+
+#include "base/time/time.h"
+#include "media/capture/video/video_capture_device.h"
+#include "media/capture/video_capture_types.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+namespace media {
+
+class CAPTURE_EXPORT VideoCaptureDeviceAVFoundationFrameReceiver {
+ public:
+ virtual ~VideoCaptureDeviceAVFoundationFrameReceiver() = default;
+
+ // Called to deliver captured video frames. It's safe to call this method
+ // from any thread, including those controlled by AVFoundation.
+ virtual void ReceiveFrame(const uint8_t* video_frame,
+ int video_frame_length,
+ const VideoCaptureFormat& frame_format,
+ const gfx::ColorSpace color_space,
+ int aspect_numerator,
+ int aspect_denominator,
+ base::TimeDelta timestamp) = 0;
+
+ // Called to deliver GpuMemoryBuffer-wrapped captured video frames. This
+ // function may be called from any thread, including those controlled by
+ // AVFoundation.
+ virtual void ReceiveExternalGpuMemoryBufferFrame(
+ CapturedExternalVideoBuffer frame,
+ base::TimeDelta timestamp) = 0;
+
+ // Callbacks with the result of a still image capture, or in case of error,
+ // respectively. It's safe to call these methods from any thread.
+ virtual void OnPhotoTaken(const uint8_t* image_data,
+ size_t image_length,
+ const std::string& mime_type) = 0;
+
+ // Callback when a call to takePhoto fails.
+ virtual void OnPhotoError() = 0;
+
+ // Forwarder to VideoCaptureDevice::Client::OnError().
+ virtual void ReceiveError(VideoCaptureError error,
+ const base::Location& from_here,
+ const std::string& reason) = 0;
+
+ // Forwarder to VideoCaptureDevice::Client::OnCaptureConfigurationChanged().
+ virtual void ReceiveCaptureConfigurationChanged() = 0;
+};
+
+} // namespace media
+
+#endif // MEDIA_CAPTURE_VIDEO_MAC_VIDEO_CAPTURE_DEVICE_FRAME_RECEIVER_H_
diff --git a/media/capture/video/mac/video_capture_device_mac_unittest.mm b/media/capture/video/mac/video_capture_device_mac_unittest.mm
index c1c8c6a4c..9c24d3b2 100644
--- a/media/capture/video/mac/video_capture_device_mac_unittest.mm
+++ b/media/capture/video/mac/video_capture_device_mac_unittest.mm
@@ -10,9 +10,9 @@
#include "base/test/gmock_callback_support.h"
#include "media/capture/video/mac/test/fake_av_capture_device_format.h"
#import "media/capture/video/mac/test/video_capture_test_utils_mac.h"
-#include "media/capture/video/mac/video_capture_device_avfoundation_mac.h"
#include "media/capture/video/mac/video_capture_device_avfoundation_utils_mac.h"
#include "media/capture/video/mac/video_capture_device_factory_mac.h"
+#include "media/capture/video/mac/video_capture_device_frame_receiver.h"
#include "media/capture/video/mock_video_capture_device_client.h"
#include "testing/gtest/include/gtest/gtest.h"