| 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 "mojo/public/cpp/system/buffer.h" |
| 12 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
| 13 | 14 |
| 14 namespace media { | 15 namespace media { |
| 15 class VideoFrame; | 16 class VideoFrame; |
| 16 } // namespace media | 17 } // namespace media |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 | 20 |
| 20 typedef int VideoCaptureControllerID; | 21 typedef int VideoCaptureControllerID; |
| 21 | 22 |
| 22 // VideoCaptureControllerEventHandler is the interface for | 23 // VideoCaptureControllerEventHandler is the interface for |
| 23 // VideoCaptureController to notify clients about the events such as | 24 // VideoCaptureController to notify clients about the events such as |
| 24 // BufferReady, FrameInfo, Error, etc. | 25 // BufferReady, FrameInfo, Error, etc. |
| 25 // TODO(mcasas): https://crbug.com/654176 merge back into VideoCaptureController | 26 // TODO(mcasas): https://crbug.com/654176 merge back into VideoCaptureController |
| 26 class CONTENT_EXPORT VideoCaptureControllerEventHandler { | 27 class CONTENT_EXPORT VideoCaptureControllerEventHandler { |
| 27 public: | 28 public: |
| 28 // An Error has occurred in the VideoCaptureDevice. | 29 // An Error has occurred in the VideoCaptureDevice. |
| 29 virtual void OnError(VideoCaptureControllerID id) = 0; | 30 virtual void OnError(VideoCaptureControllerID id) = 0; |
| 30 | 31 |
| 31 // A buffer has been newly created. | 32 // A buffer has been newly created. |
| 32 virtual void OnBufferCreated(VideoCaptureControllerID id, | 33 virtual void OnBufferCreated(VideoCaptureControllerID id, |
| 33 base::SharedMemoryHandle handle, | 34 mojo::ScopedSharedBufferHandle handle, |
| 34 int length, | 35 int length, |
| 35 int buffer_id) = 0; | 36 int buffer_id) = 0; |
| 36 | 37 |
| 37 // A previously created buffer has been freed and will no longer be used. | 38 // A previously created buffer has been freed and will no longer be used. |
| 38 virtual void OnBufferDestroyed(VideoCaptureControllerID id, | 39 virtual void OnBufferDestroyed(VideoCaptureControllerID id, |
| 39 int buffer_id) = 0; | 40 int buffer_id) = 0; |
| 40 | 41 |
| 41 // A buffer has been filled with a captured VideoFrame. | 42 // A buffer has been filled with a captured VideoFrame. |
| 42 virtual void OnBufferReady(VideoCaptureControllerID id, | 43 virtual void OnBufferReady(VideoCaptureControllerID id, |
| 43 int buffer_id, | 44 int buffer_id, |
| 44 const scoped_refptr<media::VideoFrame>& frame) = 0; | 45 const scoped_refptr<media::VideoFrame>& frame) = 0; |
| 45 | 46 |
| 46 // The capture session has ended and no more frames will be sent. | 47 // The capture session has ended and no more frames will be sent. |
| 47 virtual void OnEnded(VideoCaptureControllerID id) = 0; | 48 virtual void OnEnded(VideoCaptureControllerID id) = 0; |
| 48 | 49 |
| 49 protected: | 50 protected: |
| 50 virtual ~VideoCaptureControllerEventHandler() {} | 51 virtual ~VideoCaptureControllerEventHandler() {} |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 } // namespace content | 54 } // namespace content |
| 54 | 55 |
| 55 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HA
NDLER_H_ | 56 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HA
NDLER_H_ |
| OLD | NEW |