25 #ifndef BEBOP_AUTONOMY_BEBOP_VIDEO_DECODER_H 26 #define BEBOP_AUTONOMY_BEBOP_VIDEO_DECODER_H 30 #include "libARController/ARCONTROLLER_Error.h" 31 #include "libARController/ARCONTROLLER_Frame.h" 32 #include <libavcodec/avcodec.h> 33 #include <libavformat/avformat.h> 34 #include <libavformat/avio.h> 35 #include <libswscale/swscale.h> 43 #if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 25, 0)) 44 #define AV_CODEC_ID_H264 CODEC_ID_H264 48 #if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(51, 42, 0)) 49 #define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P 52 #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1) 53 #define av_frame_alloc avcodec_alloc_frame 54 #define av_frame_free avcodec_free_frame 92 bool SetH264Params(uint8_t* sps_buffer_ptr, uint32_t sps_buffer_size,
93 uint8_t* pps_buffer_ptr, uint32_t pps_buffer_size);
94 bool Decode(
const ARCONTROLLER_Frame_t* bebop_frame_ptr_);
95 inline uint32_t
GetFrameWidth()
const {
return codec_initialized_ ? codec_ctx_ptr_->width : 0;}
96 inline uint32_t
GetFrameHeight()
const {
return codec_initialized_ ? codec_ctx_ptr_->height : 0;}
103 #endif // BEBOP_AUTONOMY_BEBOP_VIDEO_DECODER_H
bool update_codec_params_
uint32_t GetFrameHeight() const
uint8_t * frame_rgb_raw_ptr_
AVInputFormat * input_format_ptr_
bool Decode(const ARCONTROLLER_Frame_t *bebop_frame_ptr_)
bool SetH264Params(uint8_t *sps_buffer_ptr, uint32_t sps_buffer_size, uint8_t *pps_buffer_ptr, uint32_t pps_buffer_size)
std::vector< uint8_t > codec_data_
const uint8_t * GetFrameRGBRawCstPtr() const
SwsContext * img_convert_ctx_ptr_
AVCodecContext * codec_ctx_ptr_
static const char * LOG_TAG
uint32_t GetFrameWidth() const
static void ThrowOnCondition(const bool cond, const std::string &message)
AVFormatContext * format_ctx_ptr_