OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_H_ | 5 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_H_ |
6 #define MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_H_ | 6 #define MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_H_ |
7 | 7 |
8 #include "media/capture/capture_export.h" | 8 #include "media/capture/capture_export.h" |
| 9 #include "media/capture/mojo/video_capture_types.mojom.h" |
| 10 #include "media/capture/video/video_capture_buffer_handle.h" |
9 #include "media/capture/video/video_capture_device.h" | 11 #include "media/capture/video/video_capture_device.h" |
10 | 12 |
11 namespace media { | 13 namespace media { |
12 | 14 |
13 // Callback interface for VideoCaptureDeviceClient to communicate with its | 15 // Callback interface for VideoCaptureDeviceClient to communicate with its |
14 // clients. | 16 // clients. |
15 class CAPTURE_EXPORT VideoFrameReceiver { | 17 class CAPTURE_EXPORT VideoFrameReceiver { |
16 public: | 18 public: |
17 virtual ~VideoFrameReceiver(){}; | 19 virtual ~VideoFrameReceiver(){}; |
18 | 20 |
19 virtual void OnIncomingCapturedVideoFrame( | 21 // Tells the VideoFrameReceiver that the producer is going to subsequently use |
20 media::VideoCaptureDevice::Client::Buffer buffer, | 22 // the provided buffer as one of possibly many for frame delivery via |
21 scoped_refptr<media::VideoFrame> frame) = 0; | 23 // OnFrameReadyInBuffer(). Note, that a call to this method does not mean that |
22 virtual void OnError() = 0; | 24 // the caller allows the receiver to read from or write to the buffer. |
23 virtual void OnLog(const std::string& message) = 0; | 25 virtual void OnNewBufferHandle( |
| 26 int buffer_id, |
| 27 std::unique_ptr<VideoCaptureDevice::Client::Buffer::HandleProvider> |
| 28 handle_provider) = 0; |
| 29 |
| 30 // Tells the VideoFrameReceiver that a new frame is ready for consumption |
| 31 // in the buffer with id |buffer_id| and allows it to read the data from |
| 32 // the buffer. The producer guarantees that the buffer and its contents stay |
| 33 // alive and unchanged until VideoFrameReceiver releases the given |
| 34 // |buffer_read_permission|. |
| 35 virtual void OnFrameReadyInBuffer( |
| 36 int buffer_id, |
| 37 int frame_feedback_id, |
| 38 std::unique_ptr< |
| 39 VideoCaptureDevice::Client::Buffer::ScopedAccessPermission> |
| 40 buffer_read_permission, |
| 41 mojom::VideoFrameInfoPtr frame_info) = 0; |
24 | 42 |
25 // Tells the VideoFrameReceiver that the producer is no longer going to use | 43 // Tells the VideoFrameReceiver that the producer is no longer going to use |
26 // the buffer with id |buffer_id| for frame delivery. This may be called even | 44 // the buffer with id |buffer_id| for frame delivery. This may be called even |
27 // while the receiver is still consuming the buffer from a call to | 45 // while the receiver is still holding |buffer_read_permission| from a call to |
28 // OnIncomingCapturedVideoFrame(). In that case, it means that the | 46 // OnFrameReadInBuffer() for the same buffer. In that case, it means that the |
29 // caller is asking the VideoFrameReceiver to release the buffer | 47 // caller is asking the VideoFrameReceiver to release the read permission and |
30 // at its earliest convenience. | 48 // buffer handle at its earliest convenience. |
31 // A producer may reuse a retired |buffer_id| immediately after this call. | 49 // After this call, a producer may immediately reuse the retired |buffer_id| |
| 50 // with a new buffer via a call to OnNewBufferHandle(). |
32 virtual void OnBufferRetired(int buffer_id) = 0; | 51 virtual void OnBufferRetired(int buffer_id) = 0; |
| 52 |
| 53 virtual void OnError() = 0; |
| 54 virtual void OnLog(const std::string& message) = 0; |
33 }; | 55 }; |
34 | 56 |
35 } // namespace media | 57 } // namespace media |
36 | 58 |
37 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_H_ | 59 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_H_ |
OLD | NEW |