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
3// found in the LICENSE file.
4
5#ifndef MEDIA_VIDEO_CAPTURE_MAC_PLATFORM_VIDEO_CAPTURING_MAC_H_
6#define MEDIA_VIDEO_CAPTURE_MAC_PLATFORM_VIDEO_CAPTURING_MAC_H_
7
8#import <Foundation/Foundation.h>
9
10namespace media {
11class VideoCaptureDeviceMac;
12}
13
14// Protocol representing platform-dependent video capture on Mac, implemented
15// by both QTKit and AVFoundation APIs.
16@protocol PlatformVideoCapturingMac <NSObject>
17
18// This method initializes the instance by calling NSObject |init| and registers
19// internally a frame receiver at the same time. The frame receiver is supposed
20// to be initialised before and outlive the VideoCapturingDeviceMac
21// implementation.
22- (id)initWithFrameReceiver:(media::VideoCaptureDeviceMac*)frameReceiver;
23
24// Sets the frame receiver. This method executes the registration in mutual
25// exclusion.
26// TODO(mcasas): This method and stopCapture() are always called in sequence and
27// this one is only used to clear the frameReceiver, investigate if both can be
28// merged.
29- (void)setFrameReceiver:(media::VideoCaptureDeviceMac*)frameReceiver;
30
31// Sets which capture device to use by name passed as deviceId argument. The
32// device names are usually obtained via VideoCaptureDevice::GetDeviceNames()
33// method. This method will also configure all device properties except those in
34// setCaptureHeight:width:frameRate. If |deviceId| is nil, capture is stopped
35// and all potential configuration is torn down. Returns YES on sucess, NO
36// otherwise.
37- (BOOL)setCaptureDevice:(NSString*)deviceId;
38
39// Configures the capture properties.
40- (BOOL)setCaptureHeight:(int)height
41                   width:(int)width
42               frameRate:(float)frameRate;
43
44// Starts video capturing, registers observers. Returns YES on sucess, NO
45// otherwise.
46- (BOOL)startCapture;
47
48// Stops video capturing, unregisters observers.
49- (void)stopCapture;
50
51@end
52
53#endif  // MEDIA_VIDEO_CAPTURE_MAC_PLATFORM_VIDEO_CAPTURING_MAC_H_
54