missed "void sws_freeContext(SwsContext *c)"
On Mon, Feb 8, 2010 at 8:18 PM, Xiaofei Tian <[email protected]>wrote:
> Hello all,
> I've encountered with a problem. I made a small change to the code from
> Dranger's tutorial02. (Raplace img_convert with sws_scale) When the
> following loop is being executed, the amount of used memory is almost
> linearly increased. After the playback is finished, the memory would be
> released to the original level. However, I could not find any dynamic
> allocation inside the loop. Why would that happened?
> Sorry for my poor English skill, but that problem is really confusing me.
> Thanks a lot in advance.
> Mickey
>
> while(av_read_frame(pFormatCtx, &packet)>=0)
> {
> if(packet.stream_index==videoStream)
> {
> fprintf(fp,"pts:%d\n",packet.pts);
> avcodec_decode_video(pCodecCtx, pFrame, &frameFinished,packet.data,
> packet.size);
> fprintf(fp,"%d\n",pFrame->pts);
>
> if(frameFinished) {
>
> SDL_LockYUVOverlay(bmp);
>
> AVPicture pict;
> pict.data[0] = bmp->pixels[0];
> pict.data[1] = bmp->pixels[2];
> pict.data[2] = bmp->pixels[1];
>
> pict.linesize[0] = bmp->pitches[0];
> pict.linesize[1] = bmp->pitches[2];
> pict.linesize[2] = bmp->pitches[1];
>
> img_convert_ctx =
> sws_getContext(pCodecCtx->width,pCodecCtx->height,pCodecCtx->pix_fmt,
>
> pCodecCtx->width,pCodecCtx->height,PIX_FMT_YUV420P,SWS_BICUBIC, NULL, NULL,
> NULL);
>
>
> sws_scale(img_convert_ctx,pFrame->data,pFrame->linesize,0,pCodecCtx->height,pict.data,pict.linesize);
>
> SDL_UnlockYUVOverlay(bmp);
>
> rect.x = 0;
> rect.y = 0;
> rect.w = pCodecCtx->width;
> rect.h = pCodecCtx->height;
> SDL_DisplayYUVOverlay(bmp,&rect);
>
> }
> }
> av_free_packet(&packet);
> }
> _______________________________________________
> libav-user mailing list
> [email protected]
> https://lists.mplayerhq.hu/mailman/listinfo/libav-user
>
--
-----------------------------------------------------------------------------------------
My key fingerprint: d1:03:f5:32:26:ff:d7:3c:e4:42:e3:51:ec:92:78:b2
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user