OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H264_DECODER_H_ | 5 #ifndef MEDIA_GPU_H264_DECODER_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_H264_DECODER_H_ | 6 #define MEDIA_GPU_H264_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/content_export.h" | |
17 #include "content/common/gpu/media/accelerated_video_decoder.h" | |
18 #include "content/common/gpu/media/h264_dpb.h" | |
19 #include "media/base/limits.h" | 16 #include "media/base/limits.h" |
20 #include "media/filters/h264_parser.h" | 17 #include "media/filters/h264_parser.h" |
| 18 #include "media/gpu/accelerated_video_decoder.h" |
| 19 #include "media/gpu/h264_dpb.h" |
| 20 #include "media/gpu/media_gpu_export.h" |
21 #include "ui/gfx/geometry/size.h" | 21 #include "ui/gfx/geometry/size.h" |
22 | 22 |
23 namespace content { | 23 namespace media { |
24 | 24 |
25 // Clients of this class are expected to pass H264 Annex-B byte stream | 25 // Clients of this class are expected to pass H264 Annex-B byte stream |
26 // and are expected to provide an implementation of H264Accelerator for | 26 // and are expected to provide an implementation of H264Accelerator for |
27 // offloading final steps of the decoding process. | 27 // offloading final steps of the decoding process. |
28 // | 28 // |
29 // 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 |
30 // does nothing internally on any other thread. | 30 // does nothing internally on any other thread. |
31 class CONTENT_EXPORT H264Decoder : public AcceleratedVideoDecoder { | 31 class MEDIA_GPU_EXPORT H264Decoder : public AcceleratedVideoDecoder { |
32 public: | 32 public: |
33 class CONTENT_EXPORT H264Accelerator { | 33 class MEDIA_GPU_EXPORT H264Accelerator { |
34 public: | 34 public: |
35 H264Accelerator(); | 35 H264Accelerator(); |
36 virtual ~H264Accelerator(); | 36 virtual ~H264Accelerator(); |
37 | 37 |
38 // Create a new H264Picture that the decoder client can use for decoding | 38 // Create a new H264Picture that the decoder client can use for decoding |
39 // and pass back to this accelerator for decoding or reference. | 39 // and pass back to this accelerator for decoding or reference. |
40 // When the picture is no longer needed by decoder, it will just drop | 40 // When the picture is no longer needed by decoder, it will just drop |
41 // its reference to it, and it may do so at any time. | 41 // its reference to it, and it may do so at any time. |
42 // Note that this may return nullptr if accelerator is not able to provide | 42 // Note that this may return nullptr if accelerator is not able to provide |
43 // any new pictures at given time. The decoder is expected to handle | 43 // any new pictures at given time. The decoder is expected to handle |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // any cached parameters/slices that have not been committed yet. | 96 // any cached parameters/slices that have not been committed yet. |
97 virtual void Reset() = 0; | 97 virtual void Reset() = 0; |
98 | 98 |
99 private: | 99 private: |
100 DISALLOW_COPY_AND_ASSIGN(H264Accelerator); | 100 DISALLOW_COPY_AND_ASSIGN(H264Accelerator); |
101 }; | 101 }; |
102 | 102 |
103 H264Decoder(H264Accelerator* accelerator); | 103 H264Decoder(H264Accelerator* accelerator); |
104 ~H264Decoder() override; | 104 ~H264Decoder() override; |
105 | 105 |
106 // content::AcceleratedVideoDecoder implementation. | 106 // media::AcceleratedVideoDecoder implementation. |
107 bool Flush() override WARN_UNUSED_RESULT; | 107 bool Flush() override WARN_UNUSED_RESULT; |
108 void Reset() override; | 108 void Reset() override; |
109 void SetStream(const uint8_t* ptr, size_t size) override; | 109 void SetStream(const uint8_t* ptr, size_t size) override; |
110 DecodeResult Decode() override WARN_UNUSED_RESULT; | 110 DecodeResult Decode() override WARN_UNUSED_RESULT; |
111 gfx::Size GetPicSize() const override; | 111 gfx::Size GetPicSize() const override; |
112 size_t GetRequiredNumOfPictures() const override; | 112 size_t GetRequiredNumOfPictures() const override; |
113 | 113 |
114 private: | 114 private: |
115 // We need to keep at most kDPBMaxSize pictures in DPB for | 115 // We need to keep at most kDPBMaxSize pictures in DPB for |
116 // reference/to display later and an additional one for the one currently | 116 // reference/to display later and an additional one for the one currently |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 gfx::Size pic_size_; | 268 gfx::Size pic_size_; |
269 | 269 |
270 // PicOrderCount of the previously outputted frame. | 270 // PicOrderCount of the previously outputted frame. |
271 int last_output_poc_; | 271 int last_output_poc_; |
272 | 272 |
273 H264Accelerator* accelerator_; | 273 H264Accelerator* accelerator_; |
274 | 274 |
275 DISALLOW_COPY_AND_ASSIGN(H264Decoder); | 275 DISALLOW_COPY_AND_ASSIGN(H264Decoder); |
276 }; | 276 }; |
277 | 277 |
278 } // namespace content | 278 } // namespace media |
279 | 279 |
280 #endif // CONTENT_COMMON_GPU_MEDIA_H264_DECODER_H_ | 280 #endif // MEDIA_GPU_H264_DECODER_H_ |
OLD | NEW |