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

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

Issue 2529493002: mac: Remove more media/base/mac glue unneeded now that we target 10.9 (Closed)
Patch Set: . Created 4 years 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 <AVFoundation/AVFoundation.h>
8 #import <Foundation/Foundation.h> 9 #import <Foundation/Foundation.h>
9 10
10 #import "base/mac/scoped_nsobject.h" 11 #import "base/mac/scoped_nsobject.h"
11 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
12 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
13 #import "media/base/mac/avfoundation_glue.h"
14 #include "media/capture/video/video_capture_device.h" 14 #include "media/capture/video/video_capture_device.h"
15 #include "media/capture/video_capture_types.h" 15 #include "media/capture/video_capture_types.h"
16 16
17 namespace media { 17 namespace media {
18 class VideoCaptureDeviceMac; 18 class VideoCaptureDeviceMac;
19 } 19 }
20 20
21 @class CrAVCaptureDevice;
22 @class CrAVCaptureSession;
23 @class CrAVCaptureVideoDataOutput;
24 @class CrAVCaptureStillImageOutput;
25
26 // Class used by VideoCaptureDeviceMac (VCDM) for video and image capture using 21 // Class used by VideoCaptureDeviceMac (VCDM) for video and image capture using
27 // AVFoundation API. This class lives inside the thread created by its owner 22 // AVFoundation API. This class lives inside the thread created by its owner
28 // VCDM. 23 // VCDM.
29 // 24 //
30 // * Clients (VCDM) should call +deviceNames to fetch the list of devices 25 // * 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 26 // available in the system; this method returns the list of device names that
32 // have to be used with -setCaptureDevice:. 27 // have to be used with -setCaptureDevice:.
33 // * Previous to any use, clients (VCDM) must call -initWithFrameReceiver: to 28 // * Previous to any use, clients (VCDM) must call -initWithFrameReceiver: to
34 // initialise an object of this class and register a |frameReceiver_|. 29 // initialise an object of this class and register a |frameReceiver_|.
35 // * Frame receiver registration or removal can also happen via explicit call 30 // * Frame receiver registration or removal can also happen via explicit call
(...skipping 13 matching lines...) Expand all
49 // restarted and restoped multiple times, reconfiguring or not the device in 44 // restarted and restoped multiple times, reconfiguring or not the device in
50 // between. 45 // between.
51 // * -setCaptureDevice can be called with a |nil| value, case in which it stops 46 // * -setCaptureDevice can be called with a |nil| value, case in which it stops
52 // the capture and disconnects the library objects. This step is not 47 // the capture and disconnects the library objects. This step is not
53 // necessary. 48 // necessary.
54 // * Deallocation of the library objects happens gracefully on destruction of 49 // * Deallocation of the library objects happens gracefully on destruction of
55 // the VideoCaptureDeviceAVFoundation object. 50 // the VideoCaptureDeviceAVFoundation object.
56 // 51 //
57 // 52 //
58 @interface VideoCaptureDeviceAVFoundation 53 @interface VideoCaptureDeviceAVFoundation
59 : NSObject<CrAVCaptureVideoDataOutputSampleBufferDelegate> { 54 : NSObject<AVCaptureVideoDataOutputSampleBufferDelegate> {
60 @private 55 @private
61 // The following attributes are set via -setCaptureHeight:width:frameRate:. 56 // The following attributes are set via -setCaptureHeight:width:frameRate:.
62 int frameWidth_; 57 int frameWidth_;
63 int frameHeight_; 58 int frameHeight_;
64 float frameRate_; 59 float frameRate_;
65 60
66 base::Lock lock_; // Protects concurrent setting and using |frameReceiver_|. 61 base::Lock lock_; // Protects concurrent setting and using |frameReceiver_|.
67 media::VideoCaptureDeviceMac* frameReceiver_; // weak. 62 media::VideoCaptureDeviceMac* frameReceiver_; // weak.
68 63
69 base::scoped_nsobject<CrAVCaptureSession> captureSession_; 64 base::scoped_nsobject<AVCaptureSession> captureSession_;
70 65
71 // |captureDevice_| is an object coming from AVFoundation, used only to be 66 // |captureDevice_| is an object coming from AVFoundation, used only to be
72 // plugged in |captureDeviceInput_| and to query for session preset support. 67 // plugged in |captureDeviceInput_| and to query for session preset support.
73 CrAVCaptureDevice* captureDevice_; 68 AVCaptureDevice* captureDevice_;
74 // |captureDeviceInput_| is owned by |captureSession_|. 69 // |captureDeviceInput_| is owned by |captureSession_|.
75 CrAVCaptureDeviceInput* captureDeviceInput_; 70 AVCaptureDeviceInput* captureDeviceInput_;
76 base::scoped_nsobject<CrAVCaptureVideoDataOutput> captureVideoDataOutput_; 71 base::scoped_nsobject<AVCaptureVideoDataOutput> captureVideoDataOutput_;
77 72
78 // An AVDataOutput specialized for taking pictures out of |captureSession_|. 73 // An AVDataOutput specialized for taking pictures out of |captureSession_|.
79 base::scoped_nsobject<CrAVCaptureStillImageOutput> stillImageOutput_; 74 base::scoped_nsobject<AVCaptureStillImageOutput> stillImageOutput_;
80 75
81 base::ThreadChecker main_thread_checker_; 76 base::ThreadChecker main_thread_checker_;
82 } 77 }
83 78
84 // Returns a dictionary of capture devices with friendly name and unique id. 79 // Returns a dictionary of capture devices with friendly name and unique id.
85 + (NSDictionary*)deviceNames; 80 + (NSDictionary*)deviceNames;
86 81
87 // Retrieve the capture supported formats for a given device |descriptor|. 82 // Retrieve the capture supported formats for a given device |descriptor|.
88 + (void)getDevice:(const media::VideoCaptureDeviceDescriptor&)descriptor 83 + (void)getDevice:(const media::VideoCaptureDeviceDescriptor&)descriptor
89 supportedFormats:(media::VideoCaptureFormats*)formats; 84 supportedFormats:(media::VideoCaptureFormats*)formats;
(...skipping 28 matching lines...) Expand all
118 // Stops video capturing and stops listening to notifications. 113 // Stops video capturing and stops listening to notifications.
119 - (void)stopCapture; 114 - (void)stopCapture;
120 115
121 // Takes a photo. This method should only be called between -startCapture and 116 // Takes a photo. This method should only be called between -startCapture and
122 // -stopCapture. 117 // -stopCapture.
123 - (void)takePhoto; 118 - (void)takePhoto;
124 119
125 @end 120 @end
126 121
127 #endif // MEDIA_CAPTURE_VIDEO_MAC_VIDEO_CAPTURE_DEVICE_AVFOUNDATION_MAC_H_ 122 #endif // MEDIA_CAPTURE_VIDEO_MAC_VIDEO_CAPTURE_DEVICE_AVFOUNDATION_MAC_H_
OLDNEW
« no previous file with comments | « media/capture/BUILD.gn ('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