<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Very informative : I didn't know AVPicture had a bad rep.<br><div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><br class="Apple-interchange-newline"></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">I'll check it out.</div><div apple-content-edited="true"><br></div>Thanks.<br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br><div><div>On Sep 13, 2013, at 12:47, wm4 <<a href="mailto:nfxjfg@googlemail.com">nfxjfg@googlemail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">On Thu, 12 Sep 2013 14:46:31 +0200<br>Fulbert Boussaton <42@<a href="http://flubb.net">flubb.net</a>> wrote:<br><br><blockquote type="cite">AVFormatContext*<span class="Apple-tab-span" style="white-space:pre"> </span>Ctx;<br>avformat_open_input(&Ctx, <...>, NULL, &Options);<br>avformat_find_stream_info(Ctx, NULL);<br>AVCodecContext* VCodecCtx = Ctx->streams[0]->codec;<br>AVCodec* TargetVideoCodec = avcodec_find_decoder(VCodecCtx->codec_id);<br>avcodec_open2(VCodecCtx, TargetVideoCodec, NULL);<br>AVFrame* TargetFrame = avcodec_alloc_frame();<br>AVFrame* TargetFrameRGB = avcodec_alloc_frame();<br>int FrameSizeInBytes = avpicture_get_size(PIX_FMT_RGB24, VCodecCtx->width, VCodecCtx->height);<br>uint8_t* FrameBuffer = (uint8_t*) av_malloc(FrameSizeInBytes);<br>avpicture_fill((AVPicture*) TargetFrameRGB, FrameBuffer, PIX_FMT_RGB24, VCodecCtx->width, VCodecCtx->height);<br>struct SwsContext* ScaleCtx = sws_getContext(VCodecCtx->width, VCodecCtx->height, VCodecCtx->pix_fmt, VCodecCtx->width, VCodecCtx->height, PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL);<br><br>And here are the functions I call to release all the previous structures :<br><br>sws_freeContext(ScaleCtx);<br>avpicture_free((AVPicture*)TargetFrameRGB);<br>av_free(FrameBuffer);<br>avcodec_free_frame(&TargetFrame);<br>avcodec_free_frame(&TargetFrameRGB);<br>avcodec_close(VCodecCtx);<br>avformat_close_input(&Ctx);<br></blockquote><br>This all looks very wrong. I'd just stick to the AVFrame API, and not<br>touch AVPicture. In some cases, you cast AVFrame to AVPicture, which<br>only works by coincidence. (I'm not sure if it's possibly supposed to<br>work - as far as I'm concerned AVPicture is ridiculous. You can get<br>everything done without using AVPicture at all.)<br><br>See libavutil/frame.h.<br>_______________________________________________<br>Libav-user mailing list<br><a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>http://ffmpeg.org/mailman/listinfo/libav-user<br></blockquote></div><br></body></html>