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_VP9_DECODER_H_ | 5 #ifndef MEDIA_GPU_VP9_DECODER_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_VP9_DECODER_H_ | 6 #define MEDIA_GPU_VP9_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 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "content/common/gpu/media/accelerated_video_decoder.h" | |
17 #include "content/common/gpu/media/vp9_picture.h" | |
18 #include "media/filters/vp9_parser.h" | 16 #include "media/filters/vp9_parser.h" |
| 17 #include "media/gpu/accelerated_video_decoder.h" |
| 18 #include "media/gpu/vp9_picture.h" |
19 | 19 |
20 namespace content { | 20 namespace media { |
21 | 21 |
22 // This class implements an AcceleratedVideoDecoder for VP9 decoding. | 22 // This class implements an AcceleratedVideoDecoder for VP9 decoding. |
23 // Clients of this class are expected to pass raw VP9 stream and are expected | 23 // Clients of this class are expected to pass raw VP9 stream and are expected |
24 // to provide an implementation of VP9Accelerator for offloading final steps | 24 // to provide an implementation of VP9Accelerator for offloading final steps |
25 // of the decoding process. | 25 // of the decoding process. |
26 // | 26 // |
27 // This class must be created, called and destroyed on a single thread, and | 27 // This class must be created, called and destroyed on a single thread, and |
28 // does nothing internally on any other thread. | 28 // does nothing internally on any other thread. |
29 class CONTENT_EXPORT VP9Decoder : public AcceleratedVideoDecoder { | 29 class MEDIA_GPU_EXPORT VP9Decoder : public AcceleratedVideoDecoder { |
30 public: | 30 public: |
31 class CONTENT_EXPORT VP9Accelerator { | 31 class MEDIA_GPU_EXPORT VP9Accelerator { |
32 public: | 32 public: |
33 VP9Accelerator(); | 33 VP9Accelerator(); |
34 virtual ~VP9Accelerator(); | 34 virtual ~VP9Accelerator(); |
35 | 35 |
36 // Create a new VP9Picture that the decoder client can use for initial | 36 // Create a new VP9Picture that the decoder client can use for initial |
37 // stages of the decoding process and pass back to this accelerator for | 37 // stages of the decoding process and pass back to this accelerator for |
38 // final, accelerated stages of it, or for reference when decoding other | 38 // final, accelerated stages of it, or for reference when decoding other |
39 // pictures. | 39 // pictures. |
40 // | 40 // |
41 // When a picture is no longer needed by the decoder, it will just drop | 41 // When a picture is no longer needed by the decoder, it will just drop |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // Return true when successful, false otherwise. | 75 // Return true when successful, false otherwise. |
76 virtual bool OutputPicture(const scoped_refptr<VP9Picture>& pic) = 0; | 76 virtual bool OutputPicture(const scoped_refptr<VP9Picture>& pic) = 0; |
77 | 77 |
78 private: | 78 private: |
79 DISALLOW_COPY_AND_ASSIGN(VP9Accelerator); | 79 DISALLOW_COPY_AND_ASSIGN(VP9Accelerator); |
80 }; | 80 }; |
81 | 81 |
82 VP9Decoder(VP9Accelerator* accelerator); | 82 VP9Decoder(VP9Accelerator* accelerator); |
83 ~VP9Decoder() override; | 83 ~VP9Decoder() override; |
84 | 84 |
85 // content::AcceleratedVideoDecoder implementation. | 85 // media::AcceleratedVideoDecoder implementation. |
86 void SetStream(const uint8_t* ptr, size_t size) override; | 86 void SetStream(const uint8_t* ptr, size_t size) override; |
87 bool Flush() override WARN_UNUSED_RESULT; | 87 bool Flush() override WARN_UNUSED_RESULT; |
88 void Reset() override; | 88 void Reset() override; |
89 DecodeResult Decode() override WARN_UNUSED_RESULT; | 89 DecodeResult Decode() override WARN_UNUSED_RESULT; |
90 gfx::Size GetPicSize() const override; | 90 gfx::Size GetPicSize() const override; |
91 size_t GetRequiredNumOfPictures() const override; | 91 size_t GetRequiredNumOfPictures() const override; |
92 | 92 |
93 private: | 93 private: |
94 // Update ref_frames_ based on the information in current frame header. | 94 // Update ref_frames_ based on the information in current frame header. |
95 void RefreshReferenceFrames(const scoped_refptr<VP9Picture>& pic); | 95 void RefreshReferenceFrames(const scoped_refptr<VP9Picture>& pic); |
(...skipping 26 matching lines...) Expand all Loading... |
122 gfx::Size pic_size_; | 122 gfx::Size pic_size_; |
123 | 123 |
124 media::Vp9Parser parser_; | 124 media::Vp9Parser parser_; |
125 | 125 |
126 // VP9Accelerator instance owned by the client. | 126 // VP9Accelerator instance owned by the client. |
127 VP9Accelerator* accelerator_; | 127 VP9Accelerator* accelerator_; |
128 | 128 |
129 DISALLOW_COPY_AND_ASSIGN(VP9Decoder); | 129 DISALLOW_COPY_AND_ASSIGN(VP9Decoder); |
130 }; | 130 }; |
131 | 131 |
132 } // namespace content | 132 } // namespace media |
133 | 133 |
134 #endif // CONTENT_COMMON_GPU_MEDIA_VP9_DECODER_H_ | 134 #endif // MEDIA_GPU_VP9_DECODER_H_ |
OLD | NEW |