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 MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
6 #define MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 6 #define MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 // empty. | 112 // empty. |
113 void EnqueueFrameAndTriggerFrameDelivery( | 113 void EnqueueFrameAndTriggerFrameDelivery( |
114 const scoped_refptr<VideoFrame>& frame); | 114 const scoped_refptr<VideoFrame>& frame); |
115 | 115 |
116 // Indicate the picturebuffer can be reused by the decoder. | 116 // Indicate the picturebuffer can be reused by the decoder. |
117 void ReusePictureBuffer(int64 picture_buffer_id); | 117 void ReusePictureBuffer(int64 picture_buffer_id); |
118 | 118 |
119 void RecordBufferTimeData( | 119 void RecordBufferTimeData( |
120 const BitstreamBuffer& bitstream_buffer, const Buffer& buffer); | 120 const BitstreamBuffer& bitstream_buffer, const Buffer& buffer); |
121 void GetBufferTimeData( | 121 void GetBufferTimeData( |
122 int32 id, base::TimeDelta* timestamp, base::TimeDelta* duration); | 122 int32 id, base::TimeDelta* timestamp); |
123 | 123 |
124 // Set |vda_| and |weak_vda_| on the VDA thread (in practice the render | 124 // Set |vda_| and |weak_vda_| on the VDA thread (in practice the render |
125 // thread). | 125 // thread). |
126 void SetVDA(VideoDecodeAccelerator* vda); | 126 void SetVDA(VideoDecodeAccelerator* vda); |
127 | 127 |
128 // A shared memory segment and its allocated size. | 128 // A shared memory segment and its allocated size. |
129 struct SHMBuffer { | 129 struct SHMBuffer { |
130 SHMBuffer(base::SharedMemory* m, size_t s); | 130 SHMBuffer(base::SharedMemory* m, size_t s); |
131 ~SHMBuffer(); | 131 ~SHMBuffer(); |
132 base::SharedMemory* shm; | 132 base::SharedMemory* shm; |
133 size_t size; | 133 size_t size; |
134 }; | 134 }; |
135 | 135 |
136 // Request a shared-memory segment of at least |min_size| bytes. Will | 136 // Request a shared-memory segment of at least |min_size| bytes. Will |
137 // allocate as necessary. Caller does not own returned pointer. | 137 // allocate as necessary. Caller does not own returned pointer. |
138 SHMBuffer* GetSHM(size_t min_size); | 138 SHMBuffer* GetSHM(size_t min_size); |
139 | 139 |
140 // Return a shared-memory segment to the available pool. | 140 // Return a shared-memory segment to the available pool. |
141 void PutSHM(SHMBuffer* shm_buffer); | 141 void PutSHM(SHMBuffer* shm_buffer); |
142 | 142 |
143 StatisticsCB statistics_cb_; | 143 StatisticsCB statistics_cb_; |
144 | 144 |
145 // TODO(scherkus): I think this should be calculated by VideoRenderers based | 145 // TODO(scherkus): I think this should be calculated by VideoRenderers based |
146 // on information provided by VideoDecoders (i.e., aspect ratio). | 146 // on information provided by VideoDecoders (i.e., aspect ratio). |
147 gfx::Size natural_size_; | 147 gfx::Size natural_size_; |
148 | 148 |
149 // Frame duration specified in the video stream's configuration, or 0 if not | |
150 // present. | |
151 base::TimeDelta config_frame_duration_; | |
152 | |
153 // Pointer to the demuxer stream that will feed us compressed buffers. | 149 // Pointer to the demuxer stream that will feed us compressed buffers. |
154 scoped_refptr<DemuxerStream> demuxer_stream_; | 150 scoped_refptr<DemuxerStream> demuxer_stream_; |
155 | 151 |
156 // MessageLoop on which to fire callbacks and trampoline calls to this class | 152 // MessageLoop on which to fire callbacks and trampoline calls to this class |
157 // if they arrive on other loops. | 153 // if they arrive on other loops. |
158 scoped_refptr<base::MessageLoopProxy> gvd_loop_proxy_; | 154 scoped_refptr<base::MessageLoopProxy> gvd_loop_proxy_; |
159 | 155 |
160 // Message loop on which to makes all calls to vda_. (beware this loop may be | 156 // Message loop on which to makes all calls to vda_. (beware this loop may be |
161 // paused during the Pause/Flush/Stop dance PipelineImpl::Stop() goes | 157 // paused during the Pause/Flush/Stop dance PipelineImpl::Stop() goes |
162 // through). | 158 // through). |
(...skipping 28 matching lines...) Expand all Loading... | |
191 ~BufferPair(); | 187 ~BufferPair(); |
192 SHMBuffer* shm_buffer; | 188 SHMBuffer* shm_buffer; |
193 scoped_refptr<DecoderBuffer> buffer; | 189 scoped_refptr<DecoderBuffer> buffer; |
194 }; | 190 }; |
195 std::map<int32, BufferPair> bitstream_buffers_in_decoder_; | 191 std::map<int32, BufferPair> bitstream_buffers_in_decoder_; |
196 std::map<int32, PictureBuffer> picture_buffers_in_decoder_; | 192 std::map<int32, PictureBuffer> picture_buffers_in_decoder_; |
197 | 193 |
198 // The texture target used for decoded pictures. | 194 // The texture target used for decoded pictures. |
199 uint32 decoder_texture_target_; | 195 uint32 decoder_texture_target_; |
200 | 196 |
201 struct BufferTimeData { | 197 struct BufferTimeData { |
Ami GONE FROM CHROMIUM
2012/07/31 18:13:52
this can just be a pair now.
acolwell GONE FROM CHROMIUM
2012/07/31 18:41:24
Done.
| |
202 BufferTimeData(int32 bbid, base::TimeDelta ts, base::TimeDelta dur); | 198 BufferTimeData(int32 bbid, base::TimeDelta ts); |
203 ~BufferTimeData(); | 199 ~BufferTimeData(); |
204 int32 bitstream_buffer_id; | 200 int32 bitstream_buffer_id; |
205 base::TimeDelta timestamp; | 201 base::TimeDelta timestamp; |
206 base::TimeDelta duration; | |
207 }; | 202 }; |
208 std::list<BufferTimeData> input_buffer_time_data_; | 203 std::list<BufferTimeData> input_buffer_time_data_; |
209 | 204 |
210 // picture_buffer_id and the frame wrapping the corresponding Picture, for | 205 // picture_buffer_id and the frame wrapping the corresponding Picture, for |
211 // frames that have been decoded but haven't been requested by a Read() yet. | 206 // frames that have been decoded but haven't been requested by a Read() yet. |
212 std::list<scoped_refptr<VideoFrame> > ready_video_frames_; | 207 std::list<scoped_refptr<VideoFrame> > ready_video_frames_; |
213 int64 next_picture_buffer_id_; | 208 int64 next_picture_buffer_id_; |
214 int64 next_bitstream_buffer_id_; | 209 int64 next_bitstream_buffer_id_; |
215 | 210 |
216 // Indicates PrepareForShutdownHack()'s been called. Makes further calls to | 211 // Indicates PrepareForShutdownHack()'s been called. Makes further calls to |
217 // this class not require the render thread's loop to be processing. | 212 // this class not require the render thread's loop to be processing. |
218 bool shutting_down_; | 213 bool shutting_down_; |
219 | 214 |
220 // Indicates decoding error occurred. | 215 // Indicates decoding error occurred. |
221 bool error_occured_; | 216 bool error_occured_; |
222 | 217 |
223 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); | 218 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); |
224 }; | 219 }; |
225 | 220 |
226 } // namespace media | 221 } // namespace media |
227 | 222 |
228 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 223 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
OLD | NEW |