zoukankan      html  css  js  c++  java
  • FFmpeg:Avframe内存分配方式

    1.第一种

            m_pFrameVideoOut = av_frame_alloc();
            m_pFrameVideoOut->format = AV_PIX_FMT_BGR24;
            m_pFrameVideoOut->width = m_VideoCodecCtx->width;
            m_pFrameVideoOut->height = m_VideoCodecCtx->height;
            if (av_image_alloc(m_pFrameVideoOut->data, m_pFrameVideoOut->linesize, m_pFrameVideoOut->width, m_pFrameVideoOut->height, AV_PIX_FMT_BGR24, 16) < 0)
            {
                return ;
            }

    2.第二种

            m_pFrameVideoOut = av_frame_alloc();
            m_pFrameVideoOut->format = AV_PIX_FMT_BGR24;
            m_pFrameVideoOut->width = m_VideoCodecCtx->width;
            m_pFrameVideoOut->height = m_VideoCodecCtx->height;
            av_frame_get_buffer(m_pFrameVideoOut, 16);

    3.第三种

        int bufferSize = av_image_get_buffer_size(AV_PIX_FMT_YUV420P, nWidth, nHeight, 1);;
        m_InputFrame = av_frame_alloc();
        m_InputFrame->width = nWidth;
        m_InputFrame->height = nHeight;
        m_InputFrame->format = AV_PIX_FMT_YUV420P;
        m_Buffer = (unsigned char *)av_malloc(bufferSize);
        av_image_fill_arrays(m_InputFrame->data, m_InputFrame->linesize, m_Buffer, AV_PIX_FMT_YUV420P, nWidth, nHeight, 1);

  • 相关阅读:
    前端插件集合
    建立controller
    W3C对DOM2.0定义的标准事件
    事件代理和委托学习
    css3属性flex弹性布局设置三列(四列)分布样式
    css+html 关于文本的总结(整理中)
    jquery阻止事件冒泡的3种方式
    web前端打印总结
    前端打印插件
    object实现小老鼠交互
  • 原文地址:https://www.cnblogs.com/lidabo/p/15033757.html
Copyright © 2011-2022 走看看