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