Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: media/filters/gpu_video_decoder.h

Issue 10824141: Remove VideoDecoder::natural_size() & added VideoFrame::natural_size(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 MessageLoop* vda_loop, 60 MessageLoop* vda_loop,
61 const scoped_refptr<Factories>& factories); 61 const scoped_refptr<Factories>& factories);
62 62
63 // VideoDecoder implementation. 63 // VideoDecoder implementation.
64 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, 64 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream,
65 const PipelineStatusCB& status_cb, 65 const PipelineStatusCB& status_cb,
66 const StatisticsCB& statistics_cb) OVERRIDE; 66 const StatisticsCB& statistics_cb) OVERRIDE;
67 virtual void Read(const ReadCB& read_cb) OVERRIDE; 67 virtual void Read(const ReadCB& read_cb) OVERRIDE;
68 virtual void Reset(const base::Closure& closure) OVERRIDE; 68 virtual void Reset(const base::Closure& closure) OVERRIDE;
69 virtual void Stop(const base::Closure& closure) OVERRIDE; 69 virtual void Stop(const base::Closure& closure) OVERRIDE;
70 virtual const gfx::Size& natural_size() OVERRIDE;
71 virtual bool HasAlpha() const OVERRIDE; 70 virtual bool HasAlpha() const OVERRIDE;
72 virtual void PrepareForShutdownHack() OVERRIDE; 71 virtual void PrepareForShutdownHack() OVERRIDE;
73 72
74 // VideoDecodeAccelerator::Client implementation. 73 // VideoDecodeAccelerator::Client implementation.
75 virtual void NotifyInitializeDone() OVERRIDE; 74 virtual void NotifyInitializeDone() OVERRIDE;
76 virtual void ProvidePictureBuffers(uint32 count, 75 virtual void ProvidePictureBuffers(uint32 count,
77 const gfx::Size& size, 76 const gfx::Size& size,
78 uint32 texture_target) OVERRIDE; 77 uint32 texture_target) OVERRIDE;
79 virtual void DismissPictureBuffer(int32 id) OVERRIDE; 78 virtual void DismissPictureBuffer(int32 id) OVERRIDE;
80 virtual void PictureReady(const media::Picture& picture) OVERRIDE; 79 virtual void PictureReady(const media::Picture& picture) OVERRIDE;
(...skipping 29 matching lines...) Expand all
110 // vda->Reset() is in progress) and trigger out-of-line delivery of the oldest 109 // vda->Reset() is in progress) and trigger out-of-line delivery of the oldest
111 // ready frame to the client if there is a pending read. A NULL |frame| 110 // ready frame to the client if there is a pending read. A NULL |frame|
112 // merely triggers delivery, and requires the ready_video_frames_ queue not be 111 // merely triggers delivery, and requires the ready_video_frames_ queue not be
113 // empty. 112 // empty.
114 void EnqueueFrameAndTriggerFrameDelivery( 113 void EnqueueFrameAndTriggerFrameDelivery(
115 const scoped_refptr<VideoFrame>& frame); 114 const scoped_refptr<VideoFrame>& frame);
116 115
117 // Indicate the picturebuffer can be reused by the decoder. 116 // Indicate the picturebuffer can be reused by the decoder.
118 void ReusePictureBuffer(int64 picture_buffer_id); 117 void ReusePictureBuffer(int64 picture_buffer_id);
119 118
120 void RecordBufferTimeData( 119 void RecordBufferData(
121 const BitstreamBuffer& bitstream_buffer, const Buffer& buffer); 120 const BitstreamBuffer& bitstream_buffer, const Buffer& buffer);
122 base::TimeDelta GetBufferTimestamp(int32 id); 121 void GetBufferData(int32 id, base::TimeDelta* timetamp,
122 gfx::Size* natural_size);
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 // Natural size from the last VideoDecoderConfig received.
Ami GONE FROM CHROMIUM 2012/08/02 00:16:14 Ditto
acolwell GONE FROM CHROMIUM 2012/08/02 02:16:30 Gone.
146 // on information provided by VideoDecoders (i.e., aspect ratio).
147 gfx::Size natural_size_; 146 gfx::Size natural_size_;
148 147
149 // Pointer to the demuxer stream that will feed us compressed buffers. 148 // Pointer to the demuxer stream that will feed us compressed buffers.
150 scoped_refptr<DemuxerStream> demuxer_stream_; 149 scoped_refptr<DemuxerStream> demuxer_stream_;
151 150
152 // MessageLoop on which to fire callbacks and trampoline calls to this class 151 // MessageLoop on which to fire callbacks and trampoline calls to this class
153 // if they arrive on other loops. 152 // if they arrive on other loops.
154 scoped_refptr<base::MessageLoopProxy> gvd_loop_proxy_; 153 scoped_refptr<base::MessageLoopProxy> gvd_loop_proxy_;
155 154
156 // Message loop on which to makes all calls to vda_. (beware this loop may be 155 // Message loop on which to makes all calls to vda_. (beware this loop may be
(...skipping 30 matching lines...) Expand all
187 ~BufferPair(); 186 ~BufferPair();
188 SHMBuffer* shm_buffer; 187 SHMBuffer* shm_buffer;
189 scoped_refptr<DecoderBuffer> buffer; 188 scoped_refptr<DecoderBuffer> buffer;
190 }; 189 };
191 std::map<int32, BufferPair> bitstream_buffers_in_decoder_; 190 std::map<int32, BufferPair> bitstream_buffers_in_decoder_;
192 std::map<int32, PictureBuffer> picture_buffers_in_decoder_; 191 std::map<int32, PictureBuffer> picture_buffers_in_decoder_;
193 192
194 // The texture target used for decoded pictures. 193 // The texture target used for decoded pictures.
195 uint32 decoder_texture_target_; 194 uint32 decoder_texture_target_;
196 195
197 // Maintains bitstream buffer ID to timestamp mappings. 196 struct BufferData {
198 typedef std::pair<int32, base::TimeDelta> BufferTimeData; 197 BufferData(int32 bbid, base::TimeDelta ts,
199 std::list<BufferTimeData> input_buffer_time_data_; 198 const gfx::Size& natural_size);
Ami GONE FROM CHROMIUM 2012/08/02 00:16:14 indent is off
acolwell GONE FROM CHROMIUM 2012/08/02 02:16:30 Done.
199 ~BufferData();
200 int32 bitstream_buffer_id;
201 base::TimeDelta timestamp;
202 gfx::Size natural_size;
203 };
204 std::list<BufferData> input_buffer_time_data_;
Ami GONE FROM CHROMIUM 2012/08/02 00:16:14 s/_time//
acolwell GONE FROM CHROMIUM 2012/08/02 02:16:30 Done.
200 205
201 // picture_buffer_id and the frame wrapping the corresponding Picture, for 206 // picture_buffer_id and the frame wrapping the corresponding Picture, for
202 // frames that have been decoded but haven't been requested by a Read() yet. 207 // frames that have been decoded but haven't been requested by a Read() yet.
203 std::list<scoped_refptr<VideoFrame> > ready_video_frames_; 208 std::list<scoped_refptr<VideoFrame> > ready_video_frames_;
204 int64 next_picture_buffer_id_; 209 int64 next_picture_buffer_id_;
205 int64 next_bitstream_buffer_id_; 210 int64 next_bitstream_buffer_id_;
206 211
207 // Indicates PrepareForShutdownHack()'s been called. Makes further calls to 212 // Indicates PrepareForShutdownHack()'s been called. Makes further calls to
208 // this class not require the render thread's loop to be processing. 213 // this class not require the render thread's loop to be processing.
209 bool shutting_down_; 214 bool shutting_down_;
210 215
211 // Indicates decoding error occurred. 216 // Indicates decoding error occurred.
212 bool error_occured_; 217 bool error_occured_;
213 218
214 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); 219 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder);
215 }; 220 };
216 221
217 } // namespace media 222 } // namespace media
218 223
219 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ 224 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698