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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "content/common/video_capture.mojom.h" | 12 #include "content/common/video_capture.mojom.h" |
13 #include "mojo/public/cpp/system/buffer.h" | 13 #include "mojo/public/cpp/system/buffer.h" |
14 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
15 | 15 |
16 namespace media { | 16 namespace media { |
17 class VideoFrame; | 17 class VideoFrame; |
18 } // namespace media | 18 } // namespace media |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 typedef int VideoCaptureControllerID; | 22 typedef int VideoCaptureControllerID; |
23 | 23 |
24 // VideoCaptureControllerEventHandler is the interface for | 24 // VideoCaptureControllerEventHandler is the interface for |
25 // VideoCaptureController to notify clients about the events such as | 25 // VideoCaptureController to notify clients about the events such as |
26 // BufferReady, FrameInfo, Error, etc. | 26 // BufferReady, FrameInfo, Error, etc. |
| 27 |
| 28 // OnError and OnEnded need to be scheduled to the end of message queue to |
| 29 // guarantee some other clearing jobs are done before they are handled. |
| 30 // Other methods can be forwarded synchronously. |
| 31 |
27 // TODO(mcasas): https://crbug.com/654176 merge back into VideoCaptureController | 32 // TODO(mcasas): https://crbug.com/654176 merge back into VideoCaptureController |
28 class CONTENT_EXPORT VideoCaptureControllerEventHandler { | 33 class CONTENT_EXPORT VideoCaptureControllerEventHandler { |
29 public: | 34 public: |
30 // An Error has occurred in the VideoCaptureDevice. | 35 // An Error has occurred in the VideoCaptureDevice. |
31 virtual void OnError(VideoCaptureControllerID id) = 0; | 36 virtual void OnError(VideoCaptureControllerID id) = 0; |
32 | 37 |
33 // A buffer has been newly created. | 38 // A buffer has been newly created. |
34 virtual void OnBufferCreated(VideoCaptureControllerID id, | 39 virtual void OnBufferCreated(VideoCaptureControllerID id, |
35 mojo::ScopedSharedBufferHandle handle, | 40 mojo::ScopedSharedBufferHandle handle, |
36 int length, | 41 int length, |
37 int buffer_id) = 0; | 42 int buffer_id) = 0; |
38 | 43 |
39 // A previously created buffer has been freed and will no longer be used. | 44 // A previously created buffer has been freed and will no longer be used. |
40 virtual void OnBufferDestroyed(VideoCaptureControllerID id, | 45 virtual void OnBufferDestroyed(VideoCaptureControllerID id, |
41 int buffer_id) = 0; | 46 int buffer_id) = 0; |
42 | 47 |
43 // A buffer has been filled with a captured VideoFrame. | 48 // A buffer has been filled with a captured VideoFrame. |
44 virtual void OnBufferReady( | 49 virtual void OnBufferReady( |
45 VideoCaptureControllerID id, | 50 VideoCaptureControllerID id, |
46 int buffer_id, | 51 int buffer_id, |
47 const media::mojom::VideoFrameInfoPtr& frame_info) = 0; | 52 const media::mojom::VideoFrameInfoPtr& frame_info) = 0; |
48 | 53 |
49 // The capture session has ended and no more frames will be sent. | 54 // The capture session has ended and no more frames will be sent. |
50 virtual void OnEnded(VideoCaptureControllerID id) = 0; | 55 virtual void OnEnded(VideoCaptureControllerID id) = 0; |
51 | 56 |
| 57 // VideoCaptureDevice has successfully started the device. |
| 58 virtual void OnStarted(VideoCaptureControllerID id) = 0; |
| 59 |
52 protected: | 60 protected: |
53 virtual ~VideoCaptureControllerEventHandler() {} | 61 virtual ~VideoCaptureControllerEventHandler() {} |
54 }; | 62 }; |
55 | 63 |
56 } // namespace content | 64 } // namespace content |
57 | 65 |
58 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HA
NDLER_H_ | 66 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HA
NDLER_H_ |
OLD | NEW |