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 MEDIA_GPU_VP9_DECODER_H_ | 5 #ifndef MEDIA_GPU_VP9_DECODER_H_ |
6 #define MEDIA_GPU_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/callback_forward.h" | 14 #include "base/callback_forward.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "media/filters/vp9_parser.h" | 17 #include "media/filters/vp9_parser.h" |
18 #include "media/gpu/accelerated_video_decoder.h" | 18 #include "media/gpu/accelerated_video_decoder.h" |
19 #include "media/gpu/vp9_picture.h" | 19 #include "media/gpu/vp9_picture.h" |
| 20 #include "ui/gfx/geometry/rect.h" |
20 | 21 |
21 namespace media { | 22 namespace media { |
22 | 23 |
23 // This class implements an AcceleratedVideoDecoder for VP9 decoding. | 24 // This class implements an AcceleratedVideoDecoder for VP9 decoding. |
24 // Clients of this class are expected to pass raw VP9 stream and are expected | 25 // Clients of this class are expected to pass raw VP9 stream and are expected |
25 // to provide an implementation of VP9Accelerator for offloading final steps | 26 // to provide an implementation of VP9Accelerator for offloading final steps |
26 // of the decoding process. | 27 // of the decoding process. |
27 // | 28 // |
28 // This class must be created, called and destroyed on a single thread, and | 29 // This class must be created, called and destroyed on a single thread, and |
29 // does nothing internally on any other thread. | 30 // does nothing internally on any other thread. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // Schedule output (display) of |pic|. | 70 // Schedule output (display) of |pic|. |
70 // | 71 // |
71 // Note that returning from this method does not mean that |pic| has already | 72 // Note that returning from this method does not mean that |pic| has already |
72 // been outputted (displayed), but guarantees that all pictures will be | 73 // been outputted (displayed), but guarantees that all pictures will be |
73 // outputted in the same order as this method was called for them, and that | 74 // outputted in the same order as this method was called for them, and that |
74 // they are decoded before outputting (assuming SubmitDecode() has been | 75 // they are decoded before outputting (assuming SubmitDecode() has been |
75 // called for them beforehand). Decoder may drop its references to |pic| | 76 // called for them beforehand). Decoder may drop its references to |pic| |
76 // immediately after calling this method. | 77 // immediately after calling this method. |
77 // | 78 // |
78 // Return true when successful, false otherwise. | 79 // Return true when successful, false otherwise. |
79 virtual bool OutputPicture(const scoped_refptr<VP9Picture>& pic) = 0; | 80 virtual bool OutputPicture(const scoped_refptr<VP9Picture>& pic, |
| 81 const gfx::Rect& visible_rect) = 0; |
80 | 82 |
81 // Return true if the accelerator requires the client to provide frame | 83 // Return true if the accelerator requires the client to provide frame |
82 // context in order to decode. If so, the Vp9FrameHeader provided by the | 84 // context in order to decode. If so, the Vp9FrameHeader provided by the |
83 // client must contain a valid compressed header and frame context data. | 85 // client must contain a valid compressed header and frame context data. |
84 virtual bool IsFrameContextRequired() const = 0; | 86 virtual bool IsFrameContextRequired() const = 0; |
85 | 87 |
86 // Set |frame_ctx| to the state after decoding |pic|, returning true on | 88 // Set |frame_ctx| to the state after decoding |pic|, returning true on |
87 // success, false otherwise. | 89 // success, false otherwise. |
88 virtual bool GetFrameContext(const scoped_refptr<VP9Picture>& pic, | 90 virtual bool GetFrameContext(const scoped_refptr<VP9Picture>& pic, |
89 Vp9FrameContext* frame_ctx) = 0; | 91 Vp9FrameContext* frame_ctx) = 0; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 State state_; | 134 State state_; |
133 | 135 |
134 // Current frame header to be used in decoding the next picture. | 136 // Current frame header to be used in decoding the next picture. |
135 std::unique_ptr<Vp9FrameHeader> curr_frame_hdr_; | 137 std::unique_ptr<Vp9FrameHeader> curr_frame_hdr_; |
136 | 138 |
137 // Reference frames currently in use. | 139 // Reference frames currently in use. |
138 std::vector<scoped_refptr<VP9Picture>> ref_frames_; | 140 std::vector<scoped_refptr<VP9Picture>> ref_frames_; |
139 | 141 |
140 // Current coded resolution. | 142 // Current coded resolution. |
141 gfx::Size pic_size_; | 143 gfx::Size pic_size_; |
| 144 // Current render resolution. |
| 145 gfx::Rect render_rect_; |
142 | 146 |
143 // VP9Accelerator instance owned by the client. | 147 // VP9Accelerator instance owned by the client. |
144 VP9Accelerator* accelerator_; | 148 VP9Accelerator* accelerator_; |
145 | 149 |
146 Vp9Parser parser_; | 150 Vp9Parser parser_; |
147 | 151 |
148 DISALLOW_COPY_AND_ASSIGN(VP9Decoder); | 152 DISALLOW_COPY_AND_ASSIGN(VP9Decoder); |
149 }; | 153 }; |
150 | 154 |
151 } // namespace media | 155 } // namespace media |
152 | 156 |
153 #endif // MEDIA_GPU_VP9_DECODER_H_ | 157 #endif // MEDIA_GPU_VP9_DECODER_H_ |
OLD | NEW |