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 <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 virtual void NotifyFlushDone() OVERRIDE; | 96 virtual void NotifyFlushDone() OVERRIDE; |
97 virtual void NotifyResetDone() OVERRIDE; | 97 virtual void NotifyResetDone() OVERRIDE; |
98 virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE; | 98 virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE; |
99 | 99 |
100 protected: | 100 protected: |
101 virtual ~GpuVideoDecoder(); | 101 virtual ~GpuVideoDecoder(); |
102 | 102 |
103 private: | 103 private: |
104 enum State { | 104 enum State { |
105 kNormal, | 105 kNormal, |
106 // Avoid the use of "flush" in these enums because the term is overloaded: | |
107 // Filter::Flush() means drop pending data on the floor, but | |
108 // VideoDecodeAccelerator::Flush() means drain pending data (Filter::Flush() | |
109 // actually corresponds to VideoDecodeAccelerator::Reset(), confusingly | |
110 // enough). | |
xhwang
2013/04/18 03:18:36
VideoDecoder::Flush() was replaced by Reset() so w
| |
111 kDrainingDecoder, | 106 kDrainingDecoder, |
112 kDecoderDrained, | 107 kDecoderDrained, |
113 }; | 108 }; |
114 | 109 |
115 // If no demuxer read is in flight and no bitstream buffers are in the | 110 // If no demuxer read is in flight and no bitstream buffers are in the |
116 // decoder, kick some off demuxing/decoding. | 111 // decoder, kick some off demuxing/decoding. |
117 void EnsureDemuxOrDecode(); | 112 void EnsureDemuxOrDecode(); |
118 | 113 |
119 // Return true if more decode work can be piled on to the VDA. | 114 // Return true if more decode work can be piled on to the VDA. |
120 bool CanMoreDecodeWorkBeDone(); | 115 bool CanMoreDecodeWorkBeDone(); |
121 | 116 |
122 // Callback to pass to demuxer_stream_->Read() for receiving encoded bits. | 117 // Callback to pass to demuxer_stream_->Read() for receiving encoded bits. |
123 void RequestBufferDecode(DemuxerStream::Status status, | 118 void RequestBufferDecode(DemuxerStream::Status status, |
124 const scoped_refptr<DecoderBuffer>& buffer); | 119 const scoped_refptr<DecoderBuffer>& buffer); |
125 | 120 |
126 // Enqueue a frame for later delivery (or drop it on the floor if a | 121 // Enqueue a frame for later delivery (or drop it on the floor if a |
127 // vda->Reset() is in progress) and trigger out-of-line delivery of the oldest | 122 // vda->Reset() is in progress) and trigger out-of-line delivery of the oldest |
128 // ready frame to the client if there is a pending read. A NULL |frame| | 123 // ready frame to the client if there is a pending read. A NULL |frame| |
129 // merely triggers delivery, and requires the ready_video_frames_ queue not be | 124 // merely triggers delivery, and requires the ready_video_frames_ queue not be |
130 // empty. | 125 // empty. |
131 void EnqueueFrameAndTriggerFrameDelivery( | 126 void EnqueueFrameAndTriggerFrameDelivery( |
132 const scoped_refptr<VideoFrame>& frame); | 127 const scoped_refptr<VideoFrame>& frame); |
133 | 128 |
134 // Indicate the picturebuffer can be reused by the decoder. | 129 // Indicate the picture buffer can be reused by the decoder. |
135 void ReusePictureBuffer(int64 picture_buffer_id); | 130 void ReusePictureBuffer(int64 picture_buffer_id); |
136 | 131 |
137 void RecordBufferData( | 132 void RecordBufferData( |
138 const BitstreamBuffer& bitstream_buffer, const DecoderBuffer& buffer); | 133 const BitstreamBuffer& bitstream_buffer, const DecoderBuffer& buffer); |
139 void GetBufferData(int32 id, base::TimeDelta* timetamp, | 134 void GetBufferData(int32 id, base::TimeDelta* timetamp, |
140 gfx::Rect* visible_rect, gfx::Size* natural_size); | 135 gfx::Rect* visible_rect, gfx::Size* natural_size); |
141 | 136 |
142 // Set |vda_| and |weak_vda_| on the VDA thread (in practice the render | 137 // Set |vda_| and |weak_vda_| on the VDA thread (in practice the render |
143 // thread). | 138 // thread). |
144 void SetVDA(VideoDecodeAccelerator* vda); | 139 void SetVDA(VideoDecodeAccelerator* vda); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 // Set during ProvidePictureBuffers(), used for checking and implementing | 232 // Set during ProvidePictureBuffers(), used for checking and implementing |
238 // HasAvailableOutputFrames(). | 233 // HasAvailableOutputFrames(). |
239 int available_pictures_; | 234 int available_pictures_; |
240 | 235 |
241 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); | 236 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); |
242 }; | 237 }; |
243 | 238 |
244 } // namespace media | 239 } // namespace media |
245 | 240 |
246 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ | 241 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ |
OLD | NEW |