Exemplo n.º 1
0
void MovieDecoder::getScaledVideoFrame(int scaledSize, bool maintainAspectRatio, VideoFrame& videoFrame)
{
    if (m_pFrame->interlaced_frame) {
        processFilterGraph((AVPicture*) m_pFrame, (AVPicture*) m_pFrame, m_pVideoCodecContext->pix_fmt,
                              m_pVideoCodecContext->width, m_pVideoCodecContext->height);
    }

    int scaledWidth, scaledHeight;
    convertAndScaleFrame(AV_PIX_FMT_RGB24, scaledSize, maintainAspectRatio, scaledWidth, scaledHeight);

    videoFrame.width = scaledWidth;
    videoFrame.height = scaledHeight;
    videoFrame.lineSize = m_pFrame->linesize[0];

    videoFrame.frameData.clear();
    videoFrame.frameData.resize(videoFrame.lineSize * videoFrame.height);
    memcpy((&(videoFrame.frameData.front())), m_pFrame->data[0], videoFrame.lineSize * videoFrame.height);
}
Exemplo n.º 2
0
void MovieDecoder::getScaledVideoFrame(VideoFrame& videoFrame)
{
    if (pFrame_->interlaced_frame)
    {
        avpicture_deinterlace((AVPicture*) pFrame_, (AVPicture*) pFrame_, pVideoCodecContext_->pix_fmt,
                              pVideoCodecContext_->width, pVideoCodecContext_->height);
    }

    int scaledWidth, scaledHeight;
    convertAndScaleFrame(PIX_FMT_RGB24, scaledWidth, scaledHeight);

    videoFrame.width = scaledWidth;
    videoFrame.height = scaledHeight;
    videoFrame.lineSize = pFrame_->linesize[0];

    videoFrame.frameData.clear();
    videoFrame.frameData.resize(videoFrame.lineSize * videoFrame.height);
    memcpy((&(videoFrame.frameData.front())), pFrame_->data[0], videoFrame.lineSize * videoFrame.height);
}
Exemplo n.º 3
0
void MovieDecoder::getScaledVideoFrame(int scaledSize, bool maintainAspectRatio, VideoFrame& videoFrame)
{
	
    if (m_pFrame->interlaced_frame)
    {
        avpicture_deinterlace((AVPicture*) m_pFrame, (AVPicture*) m_pFrame, m_pVideoCodecContext->pix_fmt,
                              GetVideoWidth(), GetVideoHeigth());
    }

    int scaledWidth, scaledHeight;
    convertAndScaleFrame(PIX_FMT_RGBA, scaledSize, maintainAspectRatio, scaledWidth, scaledHeight);

    videoFrame.width = scaledWidth;
    videoFrame.height = scaledHeight;
    videoFrame.lineSize = m_pFrame->linesize[0];

	if(videoFrame.frameData != nullptr)
		delete videoFrame.frameData;

	videoFrame.frameData = new uint8_t[videoFrame.lineSize * videoFrame.height];
    memcpy(videoFrame.frameData, m_pFrame->data[0], videoFrame.lineSize * videoFrame.height);

}