OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_COMMON_GPU_MEDIA_VP8_DECODER_H_ | 5 #ifndef MEDIA_GPU_VP8_DECODER_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_VP8_DECODER_H_ | 6 #define MEDIA_GPU_VP8_DECODER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "content/common/gpu/media/accelerated_video_decoder.h" | |
16 #include "content/common/gpu/media/vp8_picture.h" | |
17 #include "media/filters/vp8_parser.h" | 15 #include "media/filters/vp8_parser.h" |
| 16 #include "media/gpu/accelerated_video_decoder.h" |
| 17 #include "media/gpu/vp8_picture.h" |
18 | 18 |
19 namespace content { | 19 namespace media { |
20 | 20 |
21 // Clients of this class are expected to pass raw VP8 stream and are expected | 21 // Clients of this class are expected to pass raw VP8 stream and are expected |
22 // to provide an implementation of VP8Accelerator for offloading final steps | 22 // to provide an implementation of VP8Accelerator for offloading final steps |
23 // of the decoding process. | 23 // of the decoding process. |
24 // | 24 // |
25 // This class must be created, called and destroyed on a single thread, and | 25 // This class must be created, called and destroyed on a single thread, and |
26 // does nothing internally on any other thread. | 26 // does nothing internally on any other thread. |
27 class CONTENT_EXPORT VP8Decoder : public AcceleratedVideoDecoder { | 27 class MEDIA_GPU_EXPORT VP8Decoder : public AcceleratedVideoDecoder { |
28 public: | 28 public: |
29 class CONTENT_EXPORT VP8Accelerator { | 29 class MEDIA_GPU_EXPORT VP8Accelerator { |
30 public: | 30 public: |
31 VP8Accelerator(); | 31 VP8Accelerator(); |
32 virtual ~VP8Accelerator(); | 32 virtual ~VP8Accelerator(); |
33 | 33 |
34 // Create a new VP8Picture that the decoder client can use for decoding | 34 // Create a new VP8Picture that the decoder client can use for decoding |
35 // and pass back to this accelerator for decoding or reference. | 35 // and pass back to this accelerator for decoding or reference. |
36 // When the picture is no longer needed by decoder, it will just drop | 36 // When the picture is no longer needed by decoder, it will just drop |
37 // its reference to it, and it may do so at any time. | 37 // its reference to it, and it may do so at any time. |
38 // Note that this may return nullptr if accelerator is not able to provide | 38 // Note that this may return nullptr if accelerator is not able to provide |
39 // any new pictures at given time. The decoder is expected to handle | 39 // any new pictures at given time. The decoder is expected to handle |
(...skipping 19 matching lines...) Expand all Loading... |
59 // Return true if successful. | 59 // Return true if successful. |
60 virtual bool OutputPicture(const scoped_refptr<VP8Picture>& pic) = 0; | 60 virtual bool OutputPicture(const scoped_refptr<VP8Picture>& pic) = 0; |
61 | 61 |
62 private: | 62 private: |
63 DISALLOW_COPY_AND_ASSIGN(VP8Accelerator); | 63 DISALLOW_COPY_AND_ASSIGN(VP8Accelerator); |
64 }; | 64 }; |
65 | 65 |
66 VP8Decoder(VP8Accelerator* accelerator); | 66 VP8Decoder(VP8Accelerator* accelerator); |
67 ~VP8Decoder() override; | 67 ~VP8Decoder() override; |
68 | 68 |
69 // content::AcceleratedVideoDecoder implementation. | 69 // media::AcceleratedVideoDecoder implementation. |
70 bool Flush() override WARN_UNUSED_RESULT; | 70 bool Flush() override WARN_UNUSED_RESULT; |
71 void Reset() override; | 71 void Reset() override; |
72 void SetStream(const uint8_t* ptr, size_t size) override; | 72 void SetStream(const uint8_t* ptr, size_t size) override; |
73 DecodeResult Decode() override WARN_UNUSED_RESULT; | 73 DecodeResult Decode() override WARN_UNUSED_RESULT; |
74 gfx::Size GetPicSize() const override; | 74 gfx::Size GetPicSize() const override; |
75 size_t GetRequiredNumOfPictures() const override; | 75 size_t GetRequiredNumOfPictures() const override; |
76 | 76 |
77 private: | 77 private: |
78 bool DecodeAndOutputCurrentFrame(); | 78 bool DecodeAndOutputCurrentFrame(); |
79 void RefreshReferenceFrames(); | 79 void RefreshReferenceFrames(); |
(...skipping 20 matching lines...) Expand all Loading... |
100 | 100 |
101 gfx::Size pic_size_; | 101 gfx::Size pic_size_; |
102 int horizontal_scale_; | 102 int horizontal_scale_; |
103 int vertical_scale_; | 103 int vertical_scale_; |
104 | 104 |
105 VP8Accelerator* accelerator_; | 105 VP8Accelerator* accelerator_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(VP8Decoder); | 107 DISALLOW_COPY_AND_ASSIGN(VP8Decoder); |
108 }; | 108 }; |
109 | 109 |
110 } // namespace content | 110 } // namespace media |
111 | 111 |
112 #endif // CONTENT_COMMON_GPU_MEDIA_VP8_DECODER_H_ | 112 #endif // MEDIA_GPU_VP8_DECODER_H_ |
OLD | NEW |