changeset 6433:d42d5a90f7de libavcodec

Provide non null class name to avoid crash with ffmpeg -h.
author michael
date Mon, 03 Mar 2008 19:53:27 +0000
parents f22e4bdf4ad8
children 442f96044f19
files imgresample.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/imgresample.c	Sat Mar 01 16:10:19 2008 +0000
+++ b/imgresample.c	Mon Mar 03 19:53:27 2008 +0000
@@ -512,6 +512,8 @@
     av_free(s);
 }
 
+static const AVClass context_class = { "imgresample", NULL, NULL };
+
 struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat,
                                   int dstW, int dstH, int dstFormat,
                                   int flags, SwsFilter *srcFilter,
@@ -520,13 +522,12 @@
     struct SwsContext *ctx;
 
     ctx = av_malloc(sizeof(struct SwsContext));
-    if (ctx)
-        ctx->av_class = av_mallocz(sizeof(AVClass));
-    if (!ctx || !ctx->av_class) {
+    if (!ctx) {
         av_log(NULL, AV_LOG_ERROR, "Cannot allocate a resampling context!\n");
 
         return NULL;
     }
+    ctx->av_class = &context_class;
 
     if ((srcH != dstH) || (srcW != dstW)) {
         if ((srcFormat != PIX_FMT_YUV420P) || (dstFormat != PIX_FMT_YUV420P)) {