comparison imgresample.c @ 5185:a81dc8cc24fa libavcodec

add an AVClass pointer in SwsContext context
author benoit
date Tue, 26 Jun 2007 16:09:55 +0000
parents cf6608b00186
children 8a6fac216a2f
comparison
equal deleted inserted replaced
5184:f3873cd7f473 5185:a81dc8cc24fa
42 #define FILTER_BITS 8 42 #define FILTER_BITS 8
43 43
44 #define LINE_BUF_HEIGHT (NB_TAPS * 4) 44 #define LINE_BUF_HEIGHT (NB_TAPS * 4)
45 45
46 struct SwsContext { 46 struct SwsContext {
47 AVClass *av_class;
47 struct ImgReSampleContext *resampling_ctx; 48 struct ImgReSampleContext *resampling_ctx;
48 enum PixelFormat src_pix_fmt, dst_pix_fmt; 49 enum PixelFormat src_pix_fmt, dst_pix_fmt;
49 }; 50 };
50 51
51 struct ImgReSampleContext { 52 struct ImgReSampleContext {
640 SwsFilter *dstFilter, double *param) 641 SwsFilter *dstFilter, double *param)
641 { 642 {
642 struct SwsContext *ctx; 643 struct SwsContext *ctx;
643 644
644 ctx = av_malloc(sizeof(struct SwsContext)); 645 ctx = av_malloc(sizeof(struct SwsContext));
645 if (ctx == NULL) { 646 ctx->av_class = av_mallocz(sizeof(AVClass));
647 if (!ctx || !ctx->av_class) {
646 av_log(NULL, AV_LOG_ERROR, "Cannot allocate a resampling context!\n"); 648 av_log(NULL, AV_LOG_ERROR, "Cannot allocate a resampling context!\n");
647 649
648 return NULL; 650 return NULL;
649 } 651 }
650 652
674 (ctx->resampling_ctx->iheight != ctx->resampling_ctx->oheight)) { 676 (ctx->resampling_ctx->iheight != ctx->resampling_ctx->oheight)) {
675 img_resample_close(ctx->resampling_ctx); 677 img_resample_close(ctx->resampling_ctx);
676 } else { 678 } else {
677 av_free(ctx->resampling_ctx); 679 av_free(ctx->resampling_ctx);
678 } 680 }
681 av_free(ctx->av_class);
679 av_free(ctx); 682 av_free(ctx);
680 } 683 }
681 684
682 685
683 /** 686 /**