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