#ifndef MPPDECODER_H #define MPPDECODER_H #include #include #include #include #include #include #define MPP_ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) class MppDecoder { public: MppDecoder(const MppDecoder &) = delete; MppDecoder &operator=(const MppDecoder &) = delete; bool init(); int getDecodeIndex() { return m_index; } bool decodeJpegToRgb(const char *jpegData, size_t jpegSize, unsigned char **rgbData, int *width, int *height); MppDecoder() = default; ~MppDecoder() = default; private: MppCtx m_ctx{nullptr}; MppApi *m_mpi{nullptr}; MppDecCfg m_decCfg{nullptr}; uint32_t m_needSplit{0}; MppBufferGroup m_PacketGroup{nullptr}; MppBufferGroup m_frameGroup{nullptr}; MppFrame m_frame{nullptr}; MppPacket m_packet{nullptr}; RK_U32 m_width{3840}; RK_U32 m_height{2160}; RK_U32 m_format; MppBuffer m_packetBuffer{nullptr}; MppBuffer m_frameBuffer{nullptr}; void *m_inputBufferPtr{nullptr}; MppTask m_task{nullptr}; unsigned char *m_rgbData{nullptr}; // init flag bool m_initFlag{false}; // decoder index int m_index{0}; }; #endif // MPPDECODER_H