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"
13 class DictionaryValue
;
28 typedef int VideoCaptureControllerID
;
30 // VideoCaptureControllerEventHandler is the interface for
31 // VideoCaptureController to notify clients about the events such as
32 // BufferReady, FrameInfo, Error, etc.
33 class CONTENT_EXPORT VideoCaptureControllerEventHandler
{
35 // An Error has occurred in the VideoCaptureDevice.
36 virtual void OnError(VideoCaptureControllerID id
) = 0;
38 // A buffer has been newly created.
39 virtual void OnBufferCreated(VideoCaptureControllerID id
,
40 base::SharedMemoryHandle handle
,
44 // A previously created buffer has been freed and will no longer be used.
45 virtual void OnBufferDestroyed(VideoCaptureControllerID id
,
48 // A buffer has been filled with I420 video.
49 virtual void OnBufferReady(VideoCaptureControllerID id
,
51 const gfx::Size
& coded_size
,
52 const gfx::Rect
& visible_rect
,
53 const base::TimeTicks
& timestamp
,
54 scoped_ptr
<base::DictionaryValue
> metadata
) = 0;
56 // A texture mailbox buffer has been filled with data.
57 virtual void OnMailboxBufferReady(
58 VideoCaptureControllerID id
,
60 const gpu::MailboxHolder
& mailbox_holder
,
61 const gfx::Size
& packed_frame_size
,
62 const base::TimeTicks
& timestamp
,
63 scoped_ptr
<base::DictionaryValue
> metadata
) = 0;
65 // The capture session has ended and no more frames will be sent.
66 virtual void OnEnded(VideoCaptureControllerID id
) = 0;
69 virtual ~VideoCaptureControllerEventHandler() {}
72 } // namespace content
74 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDLER_H_