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/shared_memory.h"
10 #include "content/common/content_export.h"
14 // ID used for identifying an object of VideoCaptureController.
15 struct CONTENT_EXPORT VideoCaptureControllerID
{
16 explicit VideoCaptureControllerID(int device_id
);
18 bool operator<(const VideoCaptureControllerID
& vc
) const;
19 bool operator==(const VideoCaptureControllerID
& vc
) const;
24 // VideoCaptureControllerEventHandler is the interface for
25 // VideoCaptureController to notify clients about the events such as
26 // BufferReady, FrameInfo, Error, etc.
27 class CONTENT_EXPORT VideoCaptureControllerEventHandler
{
29 // An Error has occurred in the VideoCaptureDevice.
30 virtual void OnError(const VideoCaptureControllerID
& id
) = 0;
32 // A buffer has been newly created.
33 virtual void OnBufferCreated(const VideoCaptureControllerID
& id
,
34 base::SharedMemoryHandle handle
,
35 int length
, int buffer_id
) = 0;
37 // A buffer has been filled with I420 video.
38 virtual void OnBufferReady(const VideoCaptureControllerID
& id
,
40 base::Time timestamp
) = 0;
42 // The frame resolution the VideoCaptureDevice capture video in.
43 virtual void OnFrameInfo(const VideoCaptureControllerID
& id
,
48 // The capture session has ended and no more frames will be sent.
49 virtual void OnEnded(const VideoCaptureControllerID
& id
) = 0;
52 virtual ~VideoCaptureControllerEventHandler() {}
55 } // namespace content
57 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDLER_H_