Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_COMMON_GPU_MEDIA_VP8_DECODER_H_ | |
| 6 #define CONTENT_COMMON_GPU_MEDIA_VP8_DECODER_H_ | |
| 7 | |
| 8 #include "content/common/gpu/media/accelerated_video_decoder.h" | |
| 9 #include "content/common/gpu/media/vp8_picture.h" | |
| 10 #include "media/filters/vp8_parser.h" | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 // Clients of this class are expected to pass raw VP8 stream and are expected | |
| 15 // to provide an implementation of VP8Accelerator for offloading final steps | |
| 16 // of the decoding process. | |
| 17 // | |
| 18 // This class must be created, called and destroyed on a single thread, and | |
| 19 // does nothing internally on any other thread. | |
| 20 class CONTENT_EXPORT VP8Decoder : public AcceleratedVideoDecoder { | |
| 21 public: | |
| 22 class VP8Accelerator { | |
| 23 public: | |
| 24 VP8Accelerator() {} | |
| 25 virtual ~VP8Accelerator() {} | |
| 26 | |
| 27 virtual scoped_refptr<VP8Picture> CreateVP8Picture() = 0; | |
| 28 | |
| 29 virtual bool SubmitDecode(const scoped_refptr<VP8Picture>& pic, | |
| 30 const media::VP8FrameHeader* frame_hdr, | |
| 31 const scoped_refptr<VP8Picture>& last_frame, | |
| 32 const scoped_refptr<VP8Picture>& golden_frame, | |
| 33 const scoped_refptr<VP8Picture>& alt_frame) = 0; | |
| 34 | |
| 35 virtual bool OutputPicture(const scoped_refptr<VP8Picture>& pic) = 0; | |
| 36 | |
| 37 DISALLOW_COPY_AND_ASSIGN(VP8Accelerator); | |
|
Owen Lin
2015/01/09 09:56:14
put under private:.
kcwu
2015/01/09 10:07:48
private: before this line
Pawel Osciak
2015/01/12 07:18:19
Done.
Pawel Osciak
2015/01/12 07:18:19
Done.
| |
| 38 }; | |
| 39 | |
| 40 VP8Decoder(VP8Accelerator* accelerator); | |
| 41 virtual ~VP8Decoder(); | |
| 42 | |
| 43 // content::AcceleratedVideoDecoder implementation. | |
| 44 bool Flush() override WARN_UNUSED_RESULT; | |
| 45 void Reset() override; | |
| 46 void SetStream(const uint8* ptr, size_t size) override; | |
| 47 DecResult Decode() override WARN_UNUSED_RESULT; | |
| 48 gfx::Size GetPicSize() override { return pic_size_; } | |
| 49 size_t GetRequiredNumOfPictures() override; | |
| 50 | |
| 51 private: | |
| 52 bool DecodeAndOutputCurrentFrame(); | |
| 53 void BeginFrame(); | |
| 54 void RefreshReferenceFrames(); | |
| 55 | |
| 56 enum State { | |
| 57 kNeedStreamMetadata, // After initialization, need a keyframe. | |
| 58 kDecoding, // Ready to decode from any point. | |
| 59 kAfterReset, // After Reset(), need a resume point. | |
| 60 kError, // Error in decode, can't continue. | |
| 61 }; | |
| 62 | |
| 63 State state_; | |
| 64 | |
| 65 media::VP8Parser parser_; | |
| 66 | |
| 67 scoped_ptr<media::VP8FrameHeader> curr_frame_hdr_; | |
| 68 scoped_refptr<VP8Picture> curr_pic_; | |
| 69 scoped_refptr<VP8Picture> last_frame_; | |
| 70 scoped_refptr<VP8Picture> golden_frame_; | |
| 71 scoped_refptr<VP8Picture> alt_frame_; | |
| 72 | |
| 73 const uint8_t* curr_frame_start_; | |
| 74 size_t frame_size_; | |
| 75 | |
| 76 gfx::Size pic_size_; | |
| 77 int horizontal_scale_; | |
| 78 int vertical_scale_; | |
| 79 | |
| 80 VP8Accelerator* accelerator_; | |
| 81 }; | |
| 82 | |
| 83 } // namespace content | |
| 84 | |
| 85 #endif // CONTENT_COMMON_GPU_MEDIA_VP8_DECODER_H_ | |
| OLD | NEW |