zoukankan      html  css  js  c++  java
  • FFmpeg 被声明为已否决 deprecated(2018 精)

    不用再取消SDL检查,不用再添加#pragma warning(disable :4996),下面才是正确的解决方法!!
    以下是一些常见的deprecated问题,遇到下述没有列出的问题,可以打开相应的头文件,在里面搜索ctrl+F,会有英文说明的,如下:
     
     
    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含义相反
    或者:
    int ret = avcodec_send_packet(aCodecCtx, &pkt);
    if (ret != 0)
    {
    prinitf("%s/n","error");
    return;
    }
    while( avcodec_receive_frame(aCodecCtx, &frame) == 0){
    //读取到一帧音频或者视频
    //处理解码后音视频 frame
    }

    'av_free_packet': 被声明为已否决:
    av_free_packet(packet);
    =>
    av_packet_unref(packet);
     
     
    avcodec_decode_audio4:被声明为已否决:
    int ret = avcodec_send_packet(aCodecCtx, &pkt);
    if (ret != 0){prinitf("%s/n","error");}
    while( avcodec_receive_frame(aCodecCtx, &frame) == 0){
    //读取到一帧音频或者视频
    //处理解码后音视频 frame
    }
  • 相关阅读:
    Nova创建虚拟机的底层代码分析
    Chapter 1 Securing Your Server and Network(12):保护链接server
    c语言实现hashtable,相似C++的map和iOS的NSDictionary
    Android_Training
    Bean Validation 技术规范特性概述
    linux下串口调试工具/串口终端推荐: picocom
    Android:主题(Theme)
    oracle database 12c R1 安装文档
    python版本wifi共享工具
    iOS 6编程Cookbook(影印版)
  • 原文地址:https://www.cnblogs.com/jiu0821/p/11406029.html
Copyright © 2011-2022 走看看