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"
17 class VideoCaptureFormat
;
22 // ID used for identifying an object of VideoCaptureController.
23 struct CONTENT_EXPORT VideoCaptureControllerID
{
24 explicit VideoCaptureControllerID(int device_id
);
26 bool operator<(const VideoCaptureControllerID
& vc
) const;
27 bool operator==(const VideoCaptureControllerID
& vc
) const;
32 // VideoCaptureControllerEventHandler is the interface for
33 // VideoCaptureController to notify clients about the events such as
34 // BufferReady, FrameInfo, Error, etc.
35 class CONTENT_EXPORT VideoCaptureControllerEventHandler
{
37 // An Error has occurred in the VideoCaptureDevice.
38 virtual void OnError(const VideoCaptureControllerID
& id
) = 0;
40 // A buffer has been newly created.
41 virtual void OnBufferCreated(const VideoCaptureControllerID
& id
,
42 base::SharedMemoryHandle handle
,
46 // A previously created buffer has been freed and will no longer be used.
47 virtual void OnBufferDestroyed(const VideoCaptureControllerID
& id
,
50 // A buffer has been filled with I420 video.
51 virtual void OnBufferReady(const VideoCaptureControllerID
& id
,
53 const media::VideoCaptureFormat
& format
,
54 base::TimeTicks timestamp
) = 0;
56 // A texture mailbox buffer has been filled with data.
57 virtual void OnMailboxBufferReady(const VideoCaptureControllerID
& id
,
59 const gpu::MailboxHolder
& mailbox_holder
,
60 const media::VideoCaptureFormat
& format
,
61 base::TimeTicks timestamp
) = 0;
63 // The capture session has ended and no more frames will be sent.
64 virtual void OnEnded(const VideoCaptureControllerID
& id
) = 0;
67 virtual ~VideoCaptureControllerEventHandler() {}
70 } // namespace content
72 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDLER_H_