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

Side by Side Diff: media/video/capture/video_capture_device.h

Issue 12090109: Tab Capture: Backing store readbacks to YV12 VideoFrames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style fix per wjia Created 7 years, 10 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 | 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 // VideoCaptureDevice is the abstract base class for realizing video capture 5 // VideoCaptureDevice is the abstract base class for realizing video capture
6 // device support in Chromium. It provides the interface for OS dependent 6 // device support in Chromium. It provides the interface for OS dependent
7 // implementations. 7 // implementations.
8 // The class is created and functions are invoked on a thread owned by 8 // The class is created and functions are invoked on a thread owned by
9 // VideoCaptureManager. Capturing is done on other threads depended on the OS 9 // VideoCaptureManager. Capturing is done on other threads depended on the OS
10 // specific implementation. 10 // specific implementation.
(...skipping 18 matching lines...) Expand all
29 std::string device_name; 29 std::string device_name;
30 30
31 // Unique name of a device. Even if there are multiple devices with the same 31 // Unique name of a device. Even if there are multiple devices with the same
32 // friendly name connected to the computer this will be unique. 32 // friendly name connected to the computer this will be unique.
33 std::string unique_id; 33 std::string unique_id;
34 }; 34 };
35 typedef std::list<Name> Names; 35 typedef std::list<Name> Names;
36 36
37 class MEDIA_EXPORT EventHandler { 37 class MEDIA_EXPORT EventHandler {
38 public: 38 public:
39 // Captured a new video frame. 39 // Captured a new video frame as a raw buffer. The size, color format, and
40 // layout are taken from the parameters specified by an earlier call to
41 // OnFrameInfo(). |data| must be packed, with no padding between rows and/or
42 // color planes.
40 virtual void OnIncomingCapturedFrame(const uint8* data, 43 virtual void OnIncomingCapturedFrame(const uint8* data,
41 int length, 44 int length,
42 base::Time timestamp) = 0; 45 base::Time timestamp) = 0;
43 // An error has occurred that can not be handled 46 // Captured a new video frame, held in a VideoFrame container. |frame| must
44 // and VideoCaptureDevice must be DeAllocated. 47 // be allocated as RGB32, YV12 or I420, and the size must match that
48 // specified by an earlier call to OnFrameInfo().
49 virtual void OnIncomingCapturedVideoFrame(media::VideoFrame* frame,
50 base::Time timestamp) = 0;
51 // An error has occurred that cannot be handled and VideoCaptureDevice must
52 // be DeAllocate()-ed.
45 virtual void OnError() = 0; 53 virtual void OnError() = 0;
46 // Called when VideoCaptureDevice::Allocate has been called 54 // Called when VideoCaptureDevice::Allocate() has been called to inform of
47 // to inform of the resulting frame size and color format. 55 // the resulting frame size.
48 virtual void OnFrameInfo(const VideoCaptureCapability& info) = 0; 56 virtual void OnFrameInfo(const VideoCaptureCapability& info) = 0;
49 57
50 protected: 58 protected:
51 virtual ~EventHandler() {} 59 virtual ~EventHandler() {}
52 }; 60 };
53 // Creates a VideoCaptureDevice object. 61 // Creates a VideoCaptureDevice object.
54 // Return NULL if the hardware is not available. 62 // Return NULL if the hardware is not available.
55 static VideoCaptureDevice* Create(const Name& device_name); 63 static VideoCaptureDevice* Create(const Name& device_name);
56 virtual ~VideoCaptureDevice() {} 64 virtual ~VideoCaptureDevice() {}
57 65
58 // Gets the names of all video capture devices connected to this computer. 66 // Gets the names of all video capture devices connected to this computer.
59 static void GetDeviceNames(Names* device_names); 67 static void GetDeviceNames(Names* device_names);
60 68
61 // Prepare the camera for use. After this function has been called no other 69 // Prepare the camera for use. After this function has been called no other
62 // applications can use the camera. On completion EventHandler::OnFrameInfo is 70 // applications can use the camera. On completion EventHandler::OnFrameInfo()
63 // called informing of the resulting resolution and frame rate. 71 // is called informing of the resulting resolution and frame rate.
64 // DeAllocate must be called before this function can be called again and 72 // DeAllocate() must be called before this function can be called again and
65 // before the object is deleted. 73 // before the object is deleted.
66 virtual void Allocate(int width, 74 virtual void Allocate(int width,
67 int height, 75 int height,
68 int frame_rate, 76 int frame_rate,
69 EventHandler* observer) = 0; 77 EventHandler* observer) = 0;
70 78
71 // Start capturing video frames. Allocate must be called before this function. 79 // Start capturing video frames. Allocate must be called before this function.
72 virtual void Start() = 0; 80 virtual void Start() = 0;
73 81
74 // Stop capturing video frames. 82 // Stop capturing video frames.
75 virtual void Stop() = 0; 83 virtual void Stop() = 0;
76 84
77 // DeAllocates the camera. This means other applications can use it. 85 // Deallocates the camera. This means other applications can use it. After
78 // After this function has been called the Capture device is reset to the 86 // this function has been called the capture device is reset to the state it
79 // state it was when created. 87 // was when created.
80 virtual void DeAllocate() = 0; 88 virtual void DeAllocate() = 0;
81 89
82 // Get the name of the capture device. 90 // Get the name of the capture device.
83 virtual const Name& device_name() = 0; 91 virtual const Name& device_name() = 0;
84 }; 92 };
85 93
86 } // namespace media 94 } // namespace media
87 95
88 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ 96 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_
OLDNEW
« no previous file with comments | « media/video/capture/screen/screen_capture_device_unittest.cc ('k') | media/video/capture/video_capture_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698