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

Side by Side Diff: media/capture/video/mac/video_capture_device_avfoundation_mac.h

Issue 2151443003: Revert of RELAND: ImageCapture: Implement takePhoto() for Mac AVFoundation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef MEDIA_CAPTURE_VIDEO_MAC_VIDEO_CAPTURE_DEVICE_AVFOUNDATION_MAC_H_ 5 #ifndef MEDIA_CAPTURE_VIDEO_MAC_VIDEO_CAPTURE_DEVICE_AVFOUNDATION_MAC_H_
6 #define MEDIA_CAPTURE_VIDEO_MAC_VIDEO_CAPTURE_DEVICE_AVFOUNDATION_MAC_H_ 6 #define MEDIA_CAPTURE_VIDEO_MAC_VIDEO_CAPTURE_DEVICE_AVFOUNDATION_MAC_H_
7 7
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 9
10 #import "base/mac/scoped_nsobject.h" 10 #import "base/mac/scoped_nsobject.h"
11 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
12 #include "base/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
13 #import "media/base/mac/avfoundation_glue.h" 13 #import "media/base/mac/avfoundation_glue.h"
14 #include "media/base/video_capture_types.h" 14 #include "media/base/video_capture_types.h"
15 #include "media/capture/video/video_capture_device.h" 15 #include "media/capture/video/video_capture_device.h"
16 16
17 namespace media { 17 namespace media {
18 class VideoCaptureDeviceMac; 18 class VideoCaptureDeviceMac;
19 } 19 }
20 20
21 @class CrAVCaptureDevice; 21 @class CrAVCaptureDevice;
22 @class CrAVCaptureSession; 22 @class CrAVCaptureSession;
23 @class CrAVCaptureVideoDataOutput; 23 @class CrAVCaptureVideoDataOutput;
24 @class CrAVCaptureStillImageOutput;
25 24
26 // Class used by VideoCaptureDeviceMac (VCDM) for video and image capture using 25 // Class used by VideoCaptureDeviceMac (VCDM) for video capture using
27 // AVFoundation API. This class lives inside the thread created by its owner 26 // AVFoundation API. This class lives inside the thread created by its owner
28 // VCDM. 27 // VCDM.
29 // 28 //
30 // * Clients (VCDM) should call +deviceNames to fetch the list of devices 29 // * Clients (VCDM) should call +deviceNames to fetch the list of devices
31 // available in the system; this method returns the list of device names that 30 // available in the system; this method returns the list of device names that
32 // have to be used with -setCaptureDevice:. 31 // have to be used with -setCaptureDevice:.
33 // * Previous to any use, clients (VCDM) must call -initWithFrameReceiver: to 32 // * Previous to any use, clients (VCDM) must call -initWithFrameReceiver: to
34 // initialise an object of this class and register a |frameReceiver_|. 33 // initialise an object of this class and register a |frameReceiver_|.
35 // * Frame receiver registration or removal can also happen via explicit call 34 // * Frame receiver registration or removal can also happen via explicit call
36 // to -setFrameReceiver:. Re-registrations are safe and allowed, even during 35 // to -setFrameReceiver:. Re-registrations are safe and allowed, even during
(...skipping 19 matching lines...) Expand all
56 // 55 //
57 // 56 //
58 @interface VideoCaptureDeviceAVFoundation 57 @interface VideoCaptureDeviceAVFoundation
59 : NSObject<CrAVCaptureVideoDataOutputSampleBufferDelegate> { 58 : NSObject<CrAVCaptureVideoDataOutputSampleBufferDelegate> {
60 @private 59 @private
61 // The following attributes are set via -setCaptureHeight:width:frameRate:. 60 // The following attributes are set via -setCaptureHeight:width:frameRate:.
62 int frameWidth_; 61 int frameWidth_;
63 int frameHeight_; 62 int frameHeight_;
64 float frameRate_; 63 float frameRate_;
65 64
66 base::Lock lock_; // Protects concurrent setting and using |frameReceiver_|. 65 base::Lock lock_; // Protects concurrent setting and using of frameReceiver_.
67 media::VideoCaptureDeviceMac* frameReceiver_; // weak. 66 media::VideoCaptureDeviceMac* frameReceiver_; // weak.
68 67
69 base::scoped_nsobject<CrAVCaptureSession> captureSession_; 68 base::scoped_nsobject<CrAVCaptureSession> captureSession_;
70 69
71 // |captureDevice_| is an object coming from AVFoundation, used only to be 70 // |captureDevice_| is an object coming from AVFoundation, used only to be
72 // plugged in |captureDeviceInput_| and to query for session preset support. 71 // plugged in |captureDeviceInput_| and to query for session preset support.
73 CrAVCaptureDevice* captureDevice_; 72 CrAVCaptureDevice* captureDevice_;
74 // |captureDeviceInput_| is owned by |captureSession_|. 73 // |captureDeviceInput_| is owned by |captureSession_|.
75 CrAVCaptureDeviceInput* captureDeviceInput_; 74 CrAVCaptureDeviceInput* captureDeviceInput_;
76 base::scoped_nsobject<CrAVCaptureVideoDataOutput> captureVideoDataOutput_; 75 base::scoped_nsobject<CrAVCaptureVideoDataOutput> captureVideoDataOutput_;
77 76
78 // An AVDataOutput specialized for taking pictures out of |captureSession_|.
79 base::scoped_nsobject<CrAVCaptureStillImageOutput> stillImageOutput_;
80
81 base::ThreadChecker main_thread_checker_; 77 base::ThreadChecker main_thread_checker_;
82 } 78 }
83 79
84 // Returns a dictionary of capture devices with friendly name and unique id. 80 // Returns a dictionary of capture devices with friendly name and unique id.
85 + (NSDictionary*)deviceNames; 81 + (NSDictionary*)deviceNames;
86 82
87 // Retrieve the capture supported formats for a given device |name|. 83 // Retrieve the capture supported formats for a given device |name|.
88 + (void)getDevice:(const media::VideoCaptureDevice::Name&)name 84 + (void)getDevice:(const media::VideoCaptureDevice::Name&)name
89 supportedFormats:(media::VideoCaptureFormats*)formats; 85 supportedFormats:(media::VideoCaptureFormats*)formats;
90 86
(...skipping 20 matching lines...) Expand all
111 frameRate:(float)frameRate; 107 frameRate:(float)frameRate;
112 108
113 // Starts video capturing and register the notification listeners. Must be 109 // Starts video capturing and register the notification listeners. Must be
114 // called after setCaptureDevice:, and, eventually, also after 110 // called after setCaptureDevice:, and, eventually, also after
115 // setCaptureHeight:width:frameRate:. Returns YES on success, NO otherwise. 111 // setCaptureHeight:width:frameRate:. Returns YES on success, NO otherwise.
116 - (BOOL)startCapture; 112 - (BOOL)startCapture;
117 113
118 // Stops video capturing and stops listening to notifications. 114 // Stops video capturing and stops listening to notifications.
119 - (void)stopCapture; 115 - (void)stopCapture;
120 116
121 // Takes a photo. This method should only be called between -startCapture and
122 // -stopCapture.
123 - (void)takePhoto;
124
125 @end 117 @end
126 118
127 #endif // MEDIA_CAPTURE_VIDEO_MAC_VIDEO_CAPTURE_DEVICE_AVFOUNDATION_MAC_H_ 119 #endif // MEDIA_CAPTURE_VIDEO_MAC_VIDEO_CAPTURE_DEVICE_AVFOUNDATION_MAC_H_
OLDNEW
« no previous file with comments | « media/base/mac/coremedia_glue.h ('k') | media/capture/video/mac/video_capture_device_avfoundation_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698