Chromium Code Reviews| 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 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | |
| 13 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 14 #include "media/base/video_decoder.h" | 15 #include "media/base/video_decoder.h" |
| 15 #include "media/base/video_decoder_config.h" | 16 #include "media/base/video_decoder_config.h" |
| 16 #include "media/base/video_frame_pool.h" | 17 #include "media/base/video_frame_pool.h" |
| 17 #include "media/ffmpeg/ffmpeg_deleters.h" | 18 #include "media/ffmpeg/ffmpeg_deleters.h" |
| 18 | 19 |
| 19 struct AVCodecContext; | 20 struct AVCodecContext; |
| 20 struct AVFrame; | 21 struct AVFrame; |
| 21 | 22 |
| 22 namespace media { | 23 namespace media { |
| 23 | 24 |
| 24 class DecoderBuffer; | 25 class DecoderBuffer; |
| 26 class MediaLog; | |
| 25 | 27 |
| 26 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { | 28 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { |
| 27 public: | 29 public: |
| 28 static bool IsCodecSupported(VideoCodec codec); | 30 static bool IsCodecSupported(VideoCodec codec); |
| 29 | 31 |
| 30 FFmpegVideoDecoder(); | 32 FFmpegVideoDecoder(scoped_refptr<MediaLog> media_log); |
|
DaleCurtis
2017/03/22 00:43:16
explicit
sandersd (OOO until July 31)
2017/03/23 23:34:36
Done.
| |
| 31 ~FFmpegVideoDecoder() override; | 33 ~FFmpegVideoDecoder() override; |
| 32 | 34 |
| 33 // Allow decoding of individual NALU. Entire frames are required by default. | 35 // Allow decoding of individual NALU. Entire frames are required by default. |
| 34 // Disables low-latency mode. Must be called before Initialize(). | 36 // Disables low-latency mode. Must be called before Initialize(). |
| 35 void set_decode_nalus(bool decode_nalus) { decode_nalus_ = decode_nalus; } | 37 void set_decode_nalus(bool decode_nalus) { decode_nalus_ = decode_nalus; } |
| 36 | 38 |
| 37 // VideoDecoder implementation. | 39 // VideoDecoder implementation. |
| 38 std::string GetDisplayName() const override; | 40 std::string GetDisplayName() const override; |
| 39 void Initialize(const VideoDecoderConfig& config, | 41 void Initialize(const VideoDecoderConfig& config, |
| 40 bool low_delay, | 42 bool low_delay, |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 66 | 68 |
| 67 // Handles (re-)initializing the decoder with a (new) config. | 69 // Handles (re-)initializing the decoder with a (new) config. |
| 68 // Returns true if initialization was successful. | 70 // Returns true if initialization was successful. |
| 69 bool ConfigureDecoder(bool low_delay); | 71 bool ConfigureDecoder(bool low_delay); |
| 70 | 72 |
| 71 // Releases resources associated with |codec_context_| and |av_frame_| | 73 // Releases resources associated with |codec_context_| and |av_frame_| |
| 72 // and resets them to NULL. | 74 // and resets them to NULL. |
| 73 void ReleaseFFmpegResources(); | 75 void ReleaseFFmpegResources(); |
| 74 | 76 |
| 75 base::ThreadChecker thread_checker_; | 77 base::ThreadChecker thread_checker_; |
| 78 scoped_refptr<MediaLog> media_log_; | |
| 76 | 79 |
| 77 DecoderState state_; | 80 DecoderState state_; |
| 78 | 81 |
| 79 OutputCB output_cb_; | 82 OutputCB output_cb_; |
| 80 | 83 |
| 81 // FFmpeg structures owned by this object. | 84 // FFmpeg structures owned by this object. |
| 82 std::unique_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; | 85 std::unique_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; |
| 83 std::unique_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; | 86 std::unique_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; |
| 84 | 87 |
| 85 VideoDecoderConfig config_; | 88 VideoDecoderConfig config_; |
| 86 | 89 |
| 87 VideoFramePool frame_pool_; | 90 VideoFramePool frame_pool_; |
| 88 | 91 |
| 89 bool decode_nalus_; | 92 bool decode_nalus_; |
| 90 | 93 |
| 91 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); | 94 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); |
| 92 }; | 95 }; |
| 93 | 96 |
| 94 } // namespace media | 97 } // namespace media |
| 95 | 98 |
| 96 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 99 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
| OLD | NEW |