ffmpeg 解码 png apng 图片
1,搭建环境
参考网上搭建 ubuntu 下 ffmpeg 环境
2. 定义解码结构体
typedef struct Decode_PNG_Key{
int video_stream_index;
AVFormatContext *pFormatCtx;
AVCodecContext *pCodecCtx;
AVCodec *dec;
int init_flag;
int decode_flag;
AVFrame *filt_frame;
} Decode_Png_key;
int decode_png_init(Decode_Png_key *args, char *filename)
{
int ret = 0;
if (args == NULL || filename == NULL )
return -1;
if ((ret = avformat_open_input(&args->pFormatCtx, filename, NULL, NULL)) < 0)
{
dm_printf("Cannot open input file");
goto end;
}
if ((ret = avformat_find_stream_info(args->pFormatCtx, NULL)) < 0)
{
dm_printf("Cannot find stream infor