Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / browser / renderer_host / media / video_capture_controller_event_handler.h
blobe7d8d2190124bb3788ab2f19b86913b297651aaf
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"
14 namespace media {
15 class VideoFrame;
16 } // namespace media
18 namespace content {
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 {
26 public:
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,
33 int length,
34 int buffer_id) = 0;
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,
41 int buffer_id) = 0;
43 // A previously created buffer has been freed and will no longer be used.
44 virtual void OnBufferDestroyed(VideoCaptureControllerID id,
45 int buffer_id) = 0;
47 // A buffer has been filled with a captured VideoFrame.
48 virtual void OnBufferReady(VideoCaptureControllerID id,
49 int buffer_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;
56 protected:
57 virtual ~VideoCaptureControllerEventHandler() {}
60 } // namespace content
62 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDLER_H_