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 MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
6 #define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 6 #define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
14 #include "media/base/video_decoder.h" | 14 #include "media/base/video_decoder.h" |
15 #include "media/base/video_decoder_config.h" | 15 #include "media/base/video_decoder_config.h" |
16 #include "media/base/video_frame_pool.h" | |
17 #include "media/ffmpeg/ffmpeg_deleters.h" | 16 #include "media/ffmpeg/ffmpeg_deleters.h" |
18 | 17 |
19 struct AVCodecContext; | 18 struct AVCodecContext; |
20 struct AVFrame; | 19 struct AVFrame; |
21 | 20 |
22 namespace base { | 21 namespace base { |
23 class SingleThreadTaskRunner; | 22 class SingleThreadTaskRunner; |
24 } | 23 } |
25 | 24 |
26 namespace media { | 25 namespace media { |
27 | 26 |
28 class DecoderBuffer; | 27 class DecoderBuffer; |
| 28 class GpuMemoryBufferVideoFramePool; |
| 29 class HybridVideoFramePool; |
29 | 30 |
30 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { | 31 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { |
31 public: | 32 public: |
32 static bool IsCodecSupported(VideoCodec codec); | 33 static bool IsCodecSupported(VideoCodec codec); |
33 | 34 |
34 FFmpegVideoDecoder(); | 35 FFmpegVideoDecoder(); |
| 36 explicit FFmpegVideoDecoder( |
| 37 std::unique_ptr<GpuMemoryBufferVideoFramePool> gpu_video_frame_pool); |
35 ~FFmpegVideoDecoder() override; | 38 ~FFmpegVideoDecoder() override; |
36 | 39 |
37 // Allow decoding of individual NALU. Entire frames are required by default. | 40 // Allow decoding of individual NALU. Entire frames are required by default. |
38 // Disables low-latency mode. Must be called before Initialize(). | 41 // Disables low-latency mode. Must be called before Initialize(). |
39 void set_decode_nalus(bool decode_nalus) { decode_nalus_ = decode_nalus; } | 42 void set_decode_nalus(bool decode_nalus) { decode_nalus_ = decode_nalus; } |
40 | 43 |
41 // VideoDecoder implementation. | 44 // VideoDecoder implementation. |
42 std::string GetDisplayName() const override; | 45 std::string GetDisplayName() const override; |
43 void Initialize(const VideoDecoderConfig& config, | 46 void Initialize(const VideoDecoderConfig& config, |
44 bool low_delay, | 47 bool low_delay, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 DecoderState state_; | 84 DecoderState state_; |
82 | 85 |
83 OutputCB output_cb_; | 86 OutputCB output_cb_; |
84 | 87 |
85 // FFmpeg structures owned by this object. | 88 // FFmpeg structures owned by this object. |
86 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; | 89 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; |
87 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; | 90 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; |
88 | 91 |
89 VideoDecoderConfig config_; | 92 VideoDecoderConfig config_; |
90 | 93 |
91 VideoFramePool frame_pool_; | 94 std::unique_ptr<HybridVideoFramePool> hybrid_frame_pool_; |
92 | 95 |
93 bool decode_nalus_; | 96 bool decode_nalus_; |
94 | 97 |
95 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); | 98 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); |
96 }; | 99 }; |
97 | 100 |
98 } // namespace media | 101 } // namespace media |
99 | 102 |
100 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 103 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
OLD | NEW |