Battery Status API: add UMA logging for Linux.
[chromium-blink-merge.git] / content / browser / renderer_host / media / video_capture_controller_event_handler.h
blob3e709476a129eb640eae54054189d0859b9e3c02
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"
12 namespace gpu {
13 struct MailboxHolder;
14 } // namespace gpu
16 namespace media {
17 class VideoCaptureFormat;
18 } // namespace media
20 namespace content {
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;
29 int device_id;
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 {
36 public:
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,
43 int length,
44 int buffer_id) = 0;
46 // A previously created buffer has been freed and will no longer be used.
47 virtual void OnBufferDestroyed(const VideoCaptureControllerID& id,
48 int buffer_id) = 0;
50 // A buffer has been filled with I420 video.
51 virtual void OnBufferReady(const VideoCaptureControllerID& id,
52 int buffer_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,
58 int buffer_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;
66 protected:
67 virtual ~VideoCaptureControllerEventHandler() {}
70 } // namespace content
72 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDLER_H_