| 1 | #ifndef WEBRTC_NVIDIA_H265_DECODER_IMPL_H_ |
| 2 | #define WEBRTC_NVIDIA_H265_DECODER_IMPL_H_ |
| 3 | |
| 4 | #include <api/video_codecs/sdp_video_format.h> |
| 5 | #include <api/video_codecs/video_decoder.h> |
| 6 | #include <api/video_codecs/video_decoder_factory.h> |
| 7 | #include <api/video/video_codec_type.h> |
| 8 | #include <common_video/include/video_frame_buffer_pool.h> |
| 9 | #include <cuda.h> |
| 10 | #include <media/base/codec.h> |
| 11 | |
| 12 | #include "NvDecoder/NvDecoder.h" |
| 13 | |
| 14 | namespace webrtc { |
| 15 | |
| 16 | class NvidiaH265DecoderImpl : public VideoDecoder { |
| 17 | public: |
| 18 | explicit NvidiaH265DecoderImpl(CUcontext context); |
| 19 | NvidiaH265DecoderImpl(const NvidiaH265DecoderImpl&) = delete; |
| 20 | NvidiaH265DecoderImpl& operator=(const NvidiaH265DecoderImpl&) = delete; |
| 21 | ~NvidiaH265DecoderImpl() override; |
| 22 | |
| 23 | bool Configure(const Settings& settings) override; |
| 24 | int32_t Decode(const EncodedImage& input_image, |
| 25 | bool missing_frames, |
| 26 | int64_t render_time_ms) override; |
| 27 | int32_t RegisterDecodeCompleteCallback( |
| 28 | DecodedImageCallback* callback) override; |
| 29 | int32_t Release() override; |
| 30 | DecoderInfo GetDecoderInfo() const override; |
| 31 | |
| 32 | private: |
| 33 | CUcontext cu_context_; |
| 34 | std::unique_ptr<NvDecoder> decoder_; |
| 35 | bool is_configured_decoder_; |
| 36 | |
| 37 | Settings settings_; |
| 38 | |
| 39 | DecodedImageCallback* decoded_complete_callback_ = nullptr; |
| 40 | webrtc::VideoFrameBufferPool buffer_pool_; |
| 41 | }; |
| 42 | |
| 43 | } // end namespace webrtc |
| 44 | |
| 45 | #endif // WEBRTC_NVIDIA_H265_DECODER_IMPL_H_ |
| 46 | |
| 47 | |