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

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

Issue 83633008: Reland: Reorganize media::VideoCapture* types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // MacOSX implementation of generic VideoCaptureDevice, using either QTKit or 5 // MacOSX implementation of generic VideoCaptureDevice, using either QTKit or
6 // AVFoundation as native capture API. QTKit is used in OSX versions 10.6 and 6 // AVFoundation as native capture API. QTKit is used in OSX versions 10.6 and
7 // previous, and AVFoundation is used in the rest. 7 // previous, and AVFoundation is used in the rest.
8 8
9 #ifndef MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ 9 #ifndef MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_
10 #define MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ 10 #define MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_
(...skipping 12 matching lines...) Expand all
23 namespace media { 23 namespace media {
24 24
25 // Called by VideoCaptureManager to open, close and start, stop video capture 25 // Called by VideoCaptureManager to open, close and start, stop video capture
26 // devices. 26 // devices.
27 class VideoCaptureDeviceMac : public VideoCaptureDevice { 27 class VideoCaptureDeviceMac : public VideoCaptureDevice {
28 public: 28 public:
29 explicit VideoCaptureDeviceMac(const Name& device_name); 29 explicit VideoCaptureDeviceMac(const Name& device_name);
30 virtual ~VideoCaptureDeviceMac(); 30 virtual ~VideoCaptureDeviceMac();
31 31
32 // VideoCaptureDevice implementation. 32 // VideoCaptureDevice implementation.
33 virtual void AllocateAndStart( 33 virtual void AllocateAndStart(const VideoCaptureParams& params,
34 const VideoCaptureCapability& capture_format, 34 scoped_ptr<VideoCaptureDevice::Client> client)
35 scoped_ptr<VideoCaptureDevice::Client> client) OVERRIDE; 35 OVERRIDE;
36 virtual void StopAndDeAllocate() OVERRIDE; 36 virtual void StopAndDeAllocate() OVERRIDE;
37 37
38 bool Init(); 38 bool Init();
39 39
40 // Called to deliver captured video frames. 40 // Called to deliver captured video frames.
41 void ReceiveFrame(const uint8* video_frame, 41 void ReceiveFrame(const uint8* video_frame,
42 int video_frame_length, 42 int video_frame_length,
43 const VideoCaptureCapability& frame_info, 43 const VideoCaptureFormat& frame_format,
44 int aspect_numerator, 44 int aspect_numerator,
45 int aspect_denominator); 45 int aspect_denominator);
46 46
47 void ReceiveError(const std::string& reason); 47 void ReceiveError(const std::string& reason);
48 48
49 private: 49 private:
50 void SetErrorState(const std::string& reason); 50 void SetErrorState(const std::string& reason);
51 bool UpdateCaptureResolution(); 51 bool UpdateCaptureResolution();
52 52
53 // Flag indicating the internal state. 53 // Flag indicating the internal state.
54 enum InternalState { 54 enum InternalState {
55 kNotInitialized, 55 kNotInitialized,
56 kIdle, 56 kIdle,
57 kCapturing, 57 kCapturing,
58 kError 58 kError
59 }; 59 };
60 60
61 Name device_name_; 61 Name device_name_;
62 scoped_ptr<VideoCaptureDevice::Client> client_; 62 scoped_ptr<VideoCaptureDevice::Client> client_;
63 63
64 VideoCaptureCapability current_settings_; 64 VideoCaptureFormat capture_format_;
65 bool sent_frame_info_; 65 bool sent_frame_info_;
66 bool tried_to_square_pixels_; 66 bool tried_to_square_pixels_;
67 67
68 // Only read and write state_ from inside this loop. 68 // Only read and write state_ from inside this loop.
69 const scoped_refptr<base::MessageLoopProxy> loop_proxy_; 69 const scoped_refptr<base::MessageLoopProxy> loop_proxy_;
70 InternalState state_; 70 InternalState state_;
71 71
72 // Used with Bind and PostTask to ensure that methods aren't called 72 // Used with Bind and PostTask to ensure that methods aren't called
73 // after the VideoCaptureDeviceMac is destroyed. 73 // after the VideoCaptureDeviceMac is destroyed.
74 base::WeakPtrFactory<VideoCaptureDeviceMac> weak_factory_; 74 base::WeakPtrFactory<VideoCaptureDeviceMac> weak_factory_;
75 base::WeakPtr<VideoCaptureDeviceMac> weak_this_; 75 base::WeakPtr<VideoCaptureDeviceMac> weak_this_;
76 76
77 id<PlatformVideoCapturingMac> capture_device_; 77 id<PlatformVideoCapturingMac> capture_device_;
78 78
79 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceMac); 79 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceMac);
80 }; 80 };
81 81
82 } // namespace media 82 } // namespace media
83 83
84 #endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ 84 #endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_
OLDNEW
« no previous file with comments | « media/video/capture/linux/video_capture_device_linux.cc ('k') | media/video/capture/mac/video_capture_device_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698