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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDLER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDLER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/shared_memory.h"
10 #include "content/common/content_export.h"
11 #include "ui/gfx/geometry/size.h"
12 #include "ui/gfx/gpu_memory_buffer.h"
20 typedef int VideoCaptureControllerID
;
22 // VideoCaptureControllerEventHandler is the interface for
23 // VideoCaptureController to notify clients about the events such as
24 // BufferReady, FrameInfo, Error, etc.
25 class CONTENT_EXPORT VideoCaptureControllerEventHandler
{
27 // An Error has occurred in the VideoCaptureDevice.
28 virtual void OnError(VideoCaptureControllerID id
) = 0;
30 // A buffer has been newly created.
31 virtual void OnBufferCreated(VideoCaptureControllerID id
,
32 base::SharedMemoryHandle handle
,
36 // A GpuMemoryBuffer backed buffer has been newly created.
37 virtual void OnBufferCreated2(
38 VideoCaptureControllerID id
,
39 const std::vector
<gfx::GpuMemoryBufferHandle
>& handles
,
40 const gfx::Size
& size
,
43 // A previously created buffer has been freed and will no longer be used.
44 virtual void OnBufferDestroyed(VideoCaptureControllerID id
,
47 // A buffer has been filled with a captured VideoFrame.
48 virtual void OnBufferReady(VideoCaptureControllerID id
,
50 const scoped_refptr
<media::VideoFrame
>& frame
,
51 const base::TimeTicks
& timestamp
) = 0;
53 // The capture session has ended and no more frames will be sent.
54 virtual void OnEnded(VideoCaptureControllerID id
) = 0;
57 virtual ~VideoCaptureControllerEventHandler() {}
60 } // namespace content
62 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDLER_H_