1. 程式人生 > >FFmpeg 被宣告為已否決 deprecated(2018 精)

FFmpeg 被宣告為已否決 deprecated(2018 精)

PIX_FMT_YUV420P -> AV_PIX_FMT_YUV420P


'AVStream::codec': 被宣告為已否決:
if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO){
=>
if(pFormatCtx->streams[i]->codecpar->codec_type==AVMEDIA_TYPE_VIDEO){


'AVStream::codec': 被宣告為已否決:
pCodecCtx = pFormatCtx->streams[videoindex]->codec;
=>
pCodecCtx = avcodec_alloc_context3(NULL);
avcodec_parameters_to_context(pCodecCtx, pFormatCtx->streams[videoindex]->codecpar);


'avpicture_get_size': 被宣告為已否決:
avpicture_get_size(AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height)
=>
#include "libavutil/imgutils.h"
av_image_get_buffer_size(AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height, 1)


'avpicture_fill': 被宣告為已否決:
avpicture_fill((AVPicture *)pFrameYUV, out_buffer, AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height);
=>
av_image_fill_arrays(pFrameYUV->data, pFrameYUV->linesize, out_buffer, AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height, 1);


'avcodec_decode_video2': 被宣告為已否決:
ret = avcodec_decode_video2(pCodecCtx, pFrame, &got_picture, packet); //got_picture_ptr Zero if no frame could be decompressed
=>
ret = avcodec_send_packet(pCodecCtx, packet);
got_picture = avcodec_receive_frame(pCodecCtx, pFrame); //got_picture = 0 success, a frame was returned
//注意:got_picture含義相反
或者: