Monday, August 15, 2011

Replace img_convert by swscale for ffmpeg


//        img_convert(&pFrameRGB, PIX_FMT_RGB24,
//        (AVPicture *)pFrame, pCodecCtx->pix_fmt,
//        pCodecCtx->width, pCodecCtx->height);

        static struct SwsContext *img_convert_ctx;
        int w = pCodecCtx->width;
        int h = pCodecCtx->height;
        img_convert_ctx = sws_getContext(w, h,
        pCodecCtx->pix_fmt,
        w, h, PIX_FMT_RGB24, SWS_BICUBIC,
        NULL, NULL, NULL);

        sws_scale(
        img_convert_ctx,pFrame->data, pFrame->linesize,0,
        pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize);

No comments:

Post a Comment