OLD | NEW |
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 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDL
ER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDL
ER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDL
ER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDL
ER_H_ |
7 | 7 |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 | 11 #include "media/video/capture/video_capture_types.h" |
12 namespace media { | |
13 class VideoCaptureCapability; | |
14 } | |
15 | 12 |
16 namespace content { | 13 namespace content { |
17 | 14 |
18 // ID used for identifying an object of VideoCaptureController. | 15 // ID used for identifying an object of VideoCaptureController. |
19 struct CONTENT_EXPORT VideoCaptureControllerID { | 16 struct CONTENT_EXPORT VideoCaptureControllerID { |
20 explicit VideoCaptureControllerID(int device_id); | 17 explicit VideoCaptureControllerID(int device_id); |
21 | 18 |
22 bool operator<(const VideoCaptureControllerID& vc) const; | 19 bool operator<(const VideoCaptureControllerID& vc) const; |
23 bool operator==(const VideoCaptureControllerID& vc) const; | 20 bool operator==(const VideoCaptureControllerID& vc) const; |
24 | 21 |
25 int device_id; | 22 int device_id; |
26 }; | 23 }; |
27 | 24 |
28 // VideoCaptureControllerEventHandler is the interface for | 25 // VideoCaptureControllerEventHandler is the interface for |
29 // VideoCaptureController to notify clients about the events such as | 26 // VideoCaptureController to notify clients about the events such as |
30 // BufferReady, FrameInfo, Error, etc. | 27 // BufferReady, FrameInfo, Error, etc. |
31 class CONTENT_EXPORT VideoCaptureControllerEventHandler { | 28 class CONTENT_EXPORT VideoCaptureControllerEventHandler { |
32 public: | 29 public: |
33 // An Error has occurred in the VideoCaptureDevice. | 30 // An Error has occurred in the VideoCaptureDevice. |
34 virtual void OnError(const VideoCaptureControllerID& id) = 0; | 31 virtual void OnError(const VideoCaptureControllerID& id) = 0; |
35 | 32 |
36 // A buffer has been newly created. | 33 // A buffer has been newly created. |
37 virtual void OnBufferCreated(const VideoCaptureControllerID& id, | 34 virtual void OnBufferCreated(const VideoCaptureControllerID& id, |
38 base::SharedMemoryHandle handle, | 35 base::SharedMemoryHandle handle, |
39 int length, int buffer_id) = 0; | 36 int length, |
| 37 int buffer_id) = 0; |
| 38 |
| 39 // A previously created buffer has been freed and will no longer be used. |
| 40 virtual void OnBufferDestroyed(const VideoCaptureControllerID& id, |
| 41 int buffer_id) = 0; |
40 | 42 |
41 // A buffer has been filled with I420 video. | 43 // A buffer has been filled with I420 video. |
42 virtual void OnBufferReady(const VideoCaptureControllerID& id, | 44 virtual void OnBufferReady( |
43 int buffer_id, | 45 const VideoCaptureControllerID& id, |
44 base::Time timestamp) = 0; | 46 int buffer_id, |
45 | 47 base::Time timestamp, |
46 // The frame resolution the VideoCaptureDevice capture video in. | 48 const media::VideoCaptureFormat& format) = 0; |
47 virtual void OnFrameInfo(const VideoCaptureControllerID& id, | |
48 const media::VideoCaptureCapability& format) = 0; | |
49 | |
50 // The frame resolution the VideoCaptureDevice capture video in. | |
51 virtual void OnFrameInfoChanged(const VideoCaptureControllerID& id, | |
52 int width, | |
53 int height, | |
54 int frame_rate) {}; | |
55 | 49 |
56 // The capture session has ended and no more frames will be sent. | 50 // The capture session has ended and no more frames will be sent. |
57 virtual void OnEnded(const VideoCaptureControllerID& id) = 0; | 51 virtual void OnEnded(const VideoCaptureControllerID& id) = 0; |
58 | 52 |
59 protected: | 53 protected: |
60 virtual ~VideoCaptureControllerEventHandler() {} | 54 virtual ~VideoCaptureControllerEventHandler() {} |
61 }; | 55 }; |
62 | 56 |
63 } // namespace content | 57 } // namespace content |
64 | 58 |
65 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HA
NDLER_H_ | 59 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HA
NDLER_H_ |
OLD | NEW |