platform_video_capturing_mac.h revision 03b57e008b61dfcb1fbad3aea950ae0e001748b0
11e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
21e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
31e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// found in the LICENSE file.
41e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
51e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#ifndef MEDIA_VIDEO_CAPTURE_MAC_PLATFORM_VIDEO_CAPTURING_MAC_H_
61e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#define MEDIA_VIDEO_CAPTURE_MAC_PLATFORM_VIDEO_CAPTURING_MAC_H_
71e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
81e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#import <Foundation/Foundation.h>
91e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
101e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)namespace media {
111e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)class VideoCaptureDeviceMac;
121e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)}
131e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
141e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Protocol representing platform-dependent video capture on Mac, implemented
151e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// by both QTKit and AVFoundation APIs.
161e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)@protocol PlatformVideoCapturingMac <NSObject>
171e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
181e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// This method initializes the instance by calling NSObject |init| and registers
191e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// internally a frame receiver at the same time. The frame receiver is supposed
201e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// to be initialised before and outlive the VideoCapturingDeviceMac
211e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// implementation.
221e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)- (id)initWithFrameReceiver:(media::VideoCaptureDeviceMac*)frameReceiver;
231e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
2403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// Sets the frame receiver. This method executes the registration in mutual
251e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// exclusion.
261e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// TODO(mcasas): This method and stopCapture() are always called in sequence and
271e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// this one is only used to clear the frameReceiver, investigate if both can be
281e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// merged.
291e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)- (void)setFrameReceiver:(media::VideoCaptureDeviceMac*)frameReceiver;
301e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
311e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Sets which capture device to use by name passed as deviceId argument. The
321e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// device names are usually obtained via VideoCaptureDevice::GetDeviceNames()
331e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// method. This method will also configure all device properties except those in
3403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// setCaptureHeight:width:frameRate. If |deviceId| is nil, capture is stopped
3503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// and all potential configuration is torn down. Returns YES on sucess, NO
3603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// otherwise.
371e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)- (BOOL)setCaptureDevice:(NSString*)deviceId;
381e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
391e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Configures the capture properties.
406e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)- (BOOL)setCaptureHeight:(int)height
416e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)                   width:(int)width
426e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)               frameRate:(float)frameRate;
431e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
4403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// Starts video capturing, registers observers. Returns YES on sucess, NO
451e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// otherwise.
461e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)- (BOOL)startCapture;
471e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
481e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Stops video capturing, unregisters observers.
491e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)- (void)stopCapture;
501e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
511e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)@end
521e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
531e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#endif  // MEDIA_VIDEO_CAPTURE_MAC_PLATFORM_VIDEO_CAPTURING_MAC_H_
54