Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I have variables:
- LPDDSURFACEDESCX pddsDesc
- if (lpfnavcodec_decode_video2!=NULL)
- { iRes = lpfnavcodec_decode_video2( m_lpCodecCtx, m_lpFrame, &iFrameFinished, &m_lpPacket);
- }
- if (iFrameFinished)
- { if (lpfnav_image_fill_linesizes!= NULL)
- { lpfnav_image_fill_linesizes(m_lpFrame->linesize, PIX_FMT_YUV420P,dwWidth+32);
- }
- memset(&m_lpPict , 0, sizeof(AVPicture));
- if (lpfnavpicture_fill!=NULL)
- { lpfnavpicture_fill( &m_lpPict, lpDIBData, PIX_FMT_RGB32, dwWidth, dwHeight);
- }
- // Convert the image into RGB and copy to the surface.
- img_convert( &m_lpPict, PIX_FMT_RGB32, dwWidth, dwHeight, (AVPicture*)m_lpFrame, PIX_FMT_YUV420P, m_lpCodecCtx->width, m_lpCodecCtx->height, pddsDesc->dwLinearSize);
- //////////////////////////////////////////////////////////////////////////////////////////////////////
- int img_convert( AVPicture* dst, PixelFormat dst_pix_fmt, int dstWidth, int dstHeight, AVPicture* src, PixelFormat src_pix_fmt, int srcWidth, int srcHeight, DWORD dwStride)
- //////////////////////////////////////////////////////////////////////////////////////////////////////
- { int result = 0;
- // Init linesize on video card stride
- if (dst->linesize[0] == 0)
- dst->linesize[0] = dwStride;
- if (lpfnsws_getContext!=NULL)
- { SwsContext* img_convert_ctx = lpfnsws_getContext( srcWidth, srcHeight, src_pix_fmt, dstWidth, dstHeight, dst_pix_fmt, SWS_BICUBIC, NULL, NULL, NULL);
- if (img_convert_ctx != NULL)
- { if (lpfnsws_scale!=NULL)
- { result = lpfnsws_scale( img_convert_ctx, (const uint8_t* const*)src->data, src->linesize, 0, srcHeight, dst->data, dst->linesize);
- if(result != dstHeight)
- { printf("sws_scale ERROR\r\n");
- }
- }
- if (lpfnsws_freeContext != NULL)
- { lpfnsws_freeContext(img_convert_ctx);
- }
- }
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement