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/shared_memory.h"
9 #include "base/time/time.h"
10 #include "content/common/content_export.h"
11 #include "media/video/capture/video_capture_types.h"
15 // ID used for identifying an object of VideoCaptureController.
16 struct CONTENT_EXPORT VideoCaptureControllerID {
17 explicit VideoCaptureControllerID(int device_id);
19 bool operator<(const VideoCaptureControllerID& vc) const;
20 bool operator==(const VideoCaptureControllerID& vc) const;
25 // VideoCaptureControllerEventHandler is the interface for
26 // VideoCaptureController to notify clients about the events such as
27 // BufferReady, FrameInfo, Error, etc.
28 class CONTENT_EXPORT VideoCaptureControllerEventHandler {
30 // An Error has occurred in the VideoCaptureDevice.
31 virtual void OnError(const VideoCaptureControllerID& id) = 0;
33 // A buffer has been newly created.
34 virtual void OnBufferCreated(const VideoCaptureControllerID& id,
35 base::SharedMemoryHandle handle,
39 // A previously created buffer has been freed and will no longer be used.
40 virtual void OnBufferDestroyed(const VideoCaptureControllerID& id,
43 // A buffer has been filled with I420 video.
44 virtual void OnBufferReady(
45 const VideoCaptureControllerID& id,
48 const media::VideoCaptureFormat& format) = 0;
50 // The capture session has ended and no more frames will be sent.
51 virtual void OnEnded(const VideoCaptureControllerID& id) = 0;
54 virtual ~VideoCaptureControllerEventHandler() {}
57 } // namespace content
59 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDLER_H_