libvpx_vp9_decoder.h (1989B)
1 /* 2 * Copyright (c) 2020 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 * 10 */ 11 12 #ifndef MODULES_VIDEO_CODING_CODECS_VP9_LIBVPX_VP9_DECODER_H_ 13 #define MODULES_VIDEO_CODING_CODECS_VP9_LIBVPX_VP9_DECODER_H_ 14 15 #ifdef RTC_ENABLE_VP9 16 17 #include <cstdint> 18 19 #include "api/video/color_space.h" 20 #include "api/video/encoded_image.h" 21 #include "api/video_codecs/video_decoder.h" 22 #include "modules/video_coding/codecs/vp9/include/vp9.h" 23 #include "modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.h" 24 #include "third_party/libvpx/source/libvpx/vpx/vpx_codec.h" 25 #include "third_party/libvpx/source/libvpx/vpx/vpx_image.h" 26 27 namespace webrtc { 28 29 class LibvpxVp9Decoder : public VP9Decoder { 30 public: 31 LibvpxVp9Decoder(); 32 virtual ~LibvpxVp9Decoder(); 33 34 bool Configure(const Settings& settings) override; 35 36 int Decode(const EncodedImage& input_image, 37 int64_t /*render_time_ms*/) override; 38 39 int RegisterDecodeCompleteCallback(DecodedImageCallback* callback) override; 40 41 int Release() override; 42 43 DecoderInfo GetDecoderInfo() const override; 44 const char* ImplementationName() const override; 45 46 private: 47 int ReturnFrame(const vpx_image_t* img, 48 uint32_t timestamp, 49 int qp, 50 const ColorSpace* explicit_color_space); 51 52 // Memory pool used to share buffers between libvpx and webrtc. 53 Vp9FrameBufferPool libvpx_buffer_pool_; 54 DecodedImageCallback* decode_complete_callback_; 55 bool inited_; 56 vpx_codec_ctx_t* decoder_; 57 bool key_frame_required_; 58 Settings current_settings_; 59 }; 60 } // namespace webrtc 61 62 #endif // RTC_ENABLE_VP9 63 64 #endif // MODULES_VIDEO_CODING_CODECS_VP9_LIBVPX_VP9_DECODER_H_