Save errno for logging before potentially overwriting it.
[chromium-blink-merge.git] / content / browser / renderer_host / media / video_capture_controller_event_handler.h
blob35ab3ef0fe6650ec6861e4802b8abaa385fc1437
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"
9 #include "base/time.h"
10 #include "content/common/content_export.h"
12 namespace content {
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;
21 int device_id;
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 {
28 public:
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,
39 int buffer_id,
40 base::Time timestamp) = 0;
42 // The frame resolution the VideoCaptureDevice capture video in.
43 virtual void OnFrameInfo(const VideoCaptureControllerID& id,
44 int width,
45 int height,
46 int frame_rate) = 0;
48 // The capture session has ended and no more frames will be sent.
49 virtual void OnEnded(const VideoCaptureControllerID& id) = 0;
51 protected:
52 virtual ~VideoCaptureControllerEventHandler() {}
55 } // namespace content
57 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDLER_H_