OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_CAPTURE_DEVICE_CLIENT_H_ | 5 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ | 6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 ~VideoCaptureDeviceClient() override; | 50 ~VideoCaptureDeviceClient() override; |
51 | 51 |
52 // VideoCaptureDevice::Client implementation. | 52 // VideoCaptureDevice::Client implementation. |
53 void OnIncomingCapturedData(const uint8_t* data, | 53 void OnIncomingCapturedData(const uint8_t* data, |
54 int length, | 54 int length, |
55 const media::VideoCaptureFormat& frame_format, | 55 const media::VideoCaptureFormat& frame_format, |
56 int rotation, | 56 int rotation, |
57 base::TimeTicks reference_time, | 57 base::TimeTicks reference_time, |
58 base::TimeDelta timestamp, | 58 base::TimeDelta timestamp, |
59 int frame_feedback_id = 0) override; | 59 int frame_feedback_id = 0) override; |
60 std::unique_ptr<Buffer> ReserveOutputBuffer(const gfx::Size& dimensions, | 60 Buffer ReserveOutputBuffer(const gfx::Size& dimensions, |
61 media::VideoPixelFormat format, | 61 media::VideoPixelFormat format, |
62 media::VideoPixelStorage storage, | 62 media::VideoPixelStorage storage, |
63 int frame_feedback_id) override; | 63 int frame_feedback_id) override; |
64 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, | 64 void OnIncomingCapturedBuffer(Buffer buffer, |
65 const VideoCaptureFormat& format, | 65 const VideoCaptureFormat& format, |
66 base::TimeTicks reference_time, | 66 base::TimeTicks reference_time, |
67 base::TimeDelta timestamp) override; | 67 base::TimeDelta timestamp) override; |
68 void OnIncomingCapturedBufferExt( | 68 void OnIncomingCapturedBufferExt( |
69 std::unique_ptr<Buffer> buffer, | 69 Buffer buffer, |
70 const VideoCaptureFormat& format, | 70 const VideoCaptureFormat& format, |
71 base::TimeTicks reference_time, | 71 base::TimeTicks reference_time, |
72 base::TimeDelta timestamp, | 72 base::TimeDelta timestamp, |
73 gfx::Rect visible_rect, | 73 gfx::Rect visible_rect, |
74 const VideoFrameMetadata& additional_metadata) override; | 74 const VideoFrameMetadata& additional_metadata) override; |
75 std::unique_ptr<Buffer> ResurrectLastOutputBuffer( | 75 Buffer ResurrectLastOutputBuffer(const gfx::Size& dimensions, |
76 const gfx::Size& dimensions, | 76 media::VideoPixelFormat format, |
77 media::VideoPixelFormat format, | 77 media::VideoPixelStorage storage, |
78 media::VideoPixelStorage storage, | 78 int new_frame_feedback_id) override; |
79 int new_frame_feedback_id) override; | |
80 void OnError(const tracked_objects::Location& from_here, | 79 void OnError(const tracked_objects::Location& from_here, |
81 const std::string& reason) override; | 80 const std::string& reason) override; |
82 void OnLog(const std::string& message) override; | 81 void OnLog(const std::string& message) override; |
83 double GetBufferPoolUtilization() const override; | 82 double GetBufferPoolUtilization() const override; |
84 | 83 |
84 static Buffer MakeBufferStruct( | |
miu
2016/12/20 22:25:37
Outside of this class, it seems this function is o
chfremer
2016/12/22 19:01:20
Note, that this method is static, which already in
miu
2016/12/27 23:38:49
Acknowledged.
| |
85 scoped_refptr<VideoCaptureBufferPool> buffer_pool, | |
86 int buffer_id, | |
87 int frame_feedback_id); | |
88 | |
85 private: | 89 private: |
86 // Reserve output buffer into which I420 contents can be copied directly. | 90 void InitializeI420PlanePointers(const gfx::Size& dimensions, |
87 // The dimensions of the frame is described by |dimensions|, and requested | 91 uint8_t* const data, |
88 // output buffer format is specified by |storage|. The reserved output buffer | 92 uint8_t** y_plane_data, |
89 // is returned; and the pointer to Y plane is stored at [y_plane_data], U | 93 uint8_t** u_plane_data, |
90 // plane is stored at [u_plane_data], V plane is stored at [v_plane_data]. | 94 uint8_t** v_plane_data); |
91 // Returns an nullptr if allocation fails. | |
92 // | |
93 // When requested |storage| is PIXEL_STORAGE_CPU, a single shared memory | |
94 // chunk is reserved. The output buffers stay reserved and mapped for use | |
95 // until the Buffer objects are destroyed or returned. | |
96 std::unique_ptr<Buffer> ReserveI420OutputBuffer( | |
97 const gfx::Size& dimensions, | |
98 media::VideoPixelStorage storage, | |
99 int frame_feedback_id, | |
100 uint8_t** y_plane_data, | |
101 uint8_t** u_plane_data, | |
102 uint8_t** v_plane_data); | |
103 | 95 |
104 // A branch of OnIncomingCapturedData for Y16 frame_format.pixel_format. | 96 // A branch of OnIncomingCapturedData for Y16 frame_format.pixel_format. |
105 void OnIncomingCapturedY16Data(const uint8_t* data, | 97 void OnIncomingCapturedY16Data(const uint8_t* data, |
106 int length, | 98 int length, |
107 const VideoCaptureFormat& frame_format, | 99 const VideoCaptureFormat& frame_format, |
108 base::TimeTicks reference_time, | 100 base::TimeTicks reference_time, |
109 base::TimeDelta timestamp, | 101 base::TimeDelta timestamp, |
110 int frame_feedback_id); | 102 int frame_feedback_id); |
111 | 103 |
112 // The receiver to which we post events. | 104 // The receiver to which we post events. |
(...skipping 17 matching lines...) Expand all Loading... | |
130 #endif // DCHECK_IS_ON() | 122 #endif // DCHECK_IS_ON() |
131 | 123 |
132 media::VideoPixelFormat last_captured_pixel_format_; | 124 media::VideoPixelFormat last_captured_pixel_format_; |
133 | 125 |
134 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); | 126 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); |
135 }; | 127 }; |
136 | 128 |
137 } // namespace media | 129 } // namespace media |
138 | 130 |
139 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ | 131 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
OLD | NEW |