| Index: content/common/gpu/media/vp8_decoder.h
|
| diff --git a/content/common/gpu/media/vp8_decoder.h b/content/common/gpu/media/vp8_decoder.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..647458764a43dc2eefb433a09e87c6e484e25e22
|
| --- /dev/null
|
| +++ b/content/common/gpu/media/vp8_decoder.h
|
| @@ -0,0 +1,85 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_COMMON_GPU_MEDIA_VP8_DECODER_H_
|
| +#define CONTENT_COMMON_GPU_MEDIA_VP8_DECODER_H_
|
| +
|
| +#include "content/common/gpu/media/accelerated_video_decoder.h"
|
| +#include "content/common/gpu/media/vp8_picture.h"
|
| +#include "media/filters/vp8_parser.h"
|
| +
|
| +namespace content {
|
| +
|
| +// Clients of this class are expected to pass raw VP8 stream and are expected
|
| +// to provide an implementation of VP8Accelerator for offloading final steps
|
| +// of the decoding process.
|
| +//
|
| +// This class must be created, called and destroyed on a single thread, and
|
| +// does nothing internally on any other thread.
|
| +class CONTENT_EXPORT VP8Decoder : public AcceleratedVideoDecoder {
|
| + public:
|
| + class VP8Accelerator {
|
| + public:
|
| + VP8Accelerator() {}
|
| + virtual ~VP8Accelerator() {}
|
| +
|
| + virtual scoped_refptr<VP8Picture> CreateVP8Picture() = 0;
|
| +
|
| + virtual bool SubmitDecode(const scoped_refptr<VP8Picture>& pic,
|
| + const media::VP8FrameHeader* frame_hdr,
|
| + const scoped_refptr<VP8Picture>& last_frame,
|
| + const scoped_refptr<VP8Picture>& golden_frame,
|
| + const scoped_refptr<VP8Picture>& alt_frame) = 0;
|
| +
|
| + virtual bool OutputPicture(const scoped_refptr<VP8Picture>& pic) = 0;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(VP8Accelerator);
|
| + };
|
| +
|
| + VP8Decoder(VP8Accelerator* accelerator);
|
| + virtual ~VP8Decoder();
|
| +
|
| + // content::AcceleratedVideoDecoder implementation.
|
| + bool Flush() override WARN_UNUSED_RESULT;
|
| + void Reset() override;
|
| + void SetStream(const uint8* ptr, size_t size) override;
|
| + DecResult Decode() override WARN_UNUSED_RESULT;
|
| + gfx::Size GetPicSize() override { return pic_size_; }
|
| + size_t GetRequiredNumOfPictures() override;
|
| +
|
| + private:
|
| + bool DecodeAndOutputCurrentFrame();
|
| + void BeginFrame();
|
| + void RefreshReferenceFrames();
|
| +
|
| + enum State {
|
| + kNeedStreamMetadata, // After initialization, need a keyframe.
|
| + kDecoding, // Ready to decode from any point.
|
| + kAfterReset, // After Reset(), need a resume point.
|
| + kError, // Error in decode, can't continue.
|
| + };
|
| +
|
| + State state_;
|
| +
|
| + media::VP8Parser parser_;
|
| +
|
| + scoped_ptr<media::VP8FrameHeader> curr_frame_hdr_;
|
| + scoped_refptr<VP8Picture> curr_pic_;
|
| + scoped_refptr<VP8Picture> last_frame_;
|
| + scoped_refptr<VP8Picture> golden_frame_;
|
| + scoped_refptr<VP8Picture> alt_frame_;
|
| +
|
| + const uint8_t* curr_frame_start_;
|
| + size_t frame_size_;
|
| +
|
| + gfx::Size pic_size_;
|
| + int horizontal_scale_;
|
| + int vertical_scale_;
|
| +
|
| + VP8Accelerator* accelerator_;
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_COMMON_GPU_MEDIA_VP8_DECODER_H_
|
|
|