| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDL
ER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDL
ER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDL
ER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDL
ER_H_ |
| 7 | 7 |
| 8 #include "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "media/video/capture/video_capture_types.h" |
| 12 #include "media/video/video_encode_types.h" |
| 11 | 13 |
| 12 namespace content { | 14 namespace content { |
| 13 | 15 |
| 14 // ID used for identifying an object of VideoCaptureController. | 16 // ID used for identifying an object of VideoCaptureController. |
| 15 struct CONTENT_EXPORT VideoCaptureControllerID { | 17 struct CONTENT_EXPORT VideoCaptureControllerID { |
| 16 explicit VideoCaptureControllerID(int device_id); | 18 explicit VideoCaptureControllerID(int device_id); |
| 17 | 19 |
| 18 bool operator<(const VideoCaptureControllerID& vc) const; | 20 bool operator<(const VideoCaptureControllerID& vc) const; |
| 19 bool operator==(const VideoCaptureControllerID& vc) const; | 21 bool operator==(const VideoCaptureControllerID& vc) const; |
| 20 | 22 |
| 21 int device_id; | 23 int device_id; |
| 22 }; | 24 }; |
| 23 | 25 |
| 24 // VideoCaptureControllerEventHandler is the interface for | 26 // VideoCaptureControllerEventHandler is the interface for |
| 25 // VideoCaptureController to notify clients about the events such as | 27 // VideoCaptureController to notify clients about the events such as |
| 26 // BufferReady, FrameInfo, Error, etc. | 28 // BufferReady, FrameInfo, Error, etc. |
| 27 class CONTENT_EXPORT VideoCaptureControllerEventHandler { | 29 class CONTENT_EXPORT VideoCaptureControllerEventHandler { |
| 28 public: | 30 public: |
| 29 // An Error has occurred in the VideoCaptureDevice. | 31 // An Error has occurred in the VideoCaptureDevice. |
| 30 virtual void OnError(const VideoCaptureControllerID& id) = 0; | 32 virtual void OnError(const VideoCaptureControllerID& id) = 0; |
| 31 | 33 |
| 32 // A buffer has been newly created. | 34 // A buffer has been filled with video. |
| 33 virtual void OnBufferCreated(const VideoCaptureControllerID& id, | |
| 34 base::SharedMemoryHandle handle, | |
| 35 int length, int buffer_id) = 0; | |
| 36 | |
| 37 // A buffer has been filled with I420 video. | |
| 38 virtual void OnBufferReady(const VideoCaptureControllerID& id, | 35 virtual void OnBufferReady(const VideoCaptureControllerID& id, |
| 39 int buffer_id, | 36 int buffer_id, |
| 40 base::Time timestamp) = 0; | 37 size_t data_size, |
| 38 base::Time timestamp, |
| 39 bool key_frame) = 0; |
| 41 | 40 |
| 42 // The frame resolution the VideoCaptureDevice capture video in. | 41 // The (unencoded) frame resolution the VideoCaptureDevice captures video in. |
| 43 virtual void OnFrameInfo(const VideoCaptureControllerID& id, | 42 virtual void OnFrameInfo(const VideoCaptureControllerID& id, |
| 44 int width, | 43 const media::VideoCaptureParams& params, |
| 45 int height, | 44 const std::vector<base::SharedMemoryHandle>& buffers, |
| 46 int frame_rate) = 0; | 45 size_t buffer_size) = 0; |
| 46 |
| 47 // The (encoded) frame resolution the VideoCaptureDevice captures video in. |
| 48 virtual void OnEncodedFrameInfo( |
| 49 const VideoCaptureControllerID& id, |
| 50 const media::VideoEncodingParameters& params, |
| 51 const std::vector<base::SharedMemoryHandle>& buffers, |
| 52 size_t buffer_size) = 0; |
| 53 |
| 54 // The encoded bitstream configuration has changed. |
| 55 virtual void OnBitstreamConfigChanged( |
| 56 const VideoCaptureControllerID& id, |
| 57 const media::RuntimeVideoEncodingParameters& params) = 0; |
| 47 | 58 |
| 48 // The capture session has ended and no more frames will be sent. | 59 // The capture session has ended and no more frames will be sent. |
| 49 virtual void OnEnded(const VideoCaptureControllerID& id) = 0; | 60 virtual void OnEnded(const VideoCaptureControllerID& id) = 0; |
| 50 | 61 |
| 51 protected: | 62 protected: |
| 52 virtual ~VideoCaptureControllerEventHandler() {} | 63 virtual ~VideoCaptureControllerEventHandler() {} |
| 53 }; | 64 }; |
| 54 | 65 |
| 55 } // namespace content | 66 } // namespace content |
| 56 | 67 |
| 57 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HA
NDLER_H_ | 68 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HA
NDLER_H_ |
| OLD | NEW |