Commit f15e6b86 authored by Michael Niedermayer's avatar Michael Niedermayer

Provide non null class name to avoid crash with ffmpeg -h.

Originally committed as revision 12300 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 6548ff57
...@@ -512,6 +512,8 @@ void img_resample_close(ImgReSampleContext *s) ...@@ -512,6 +512,8 @@ void img_resample_close(ImgReSampleContext *s)
av_free(s); av_free(s);
} }
static const AVClass context_class = { "imgresample", NULL, NULL };
struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat,
int dstW, int dstH, int dstFormat, int dstW, int dstH, int dstFormat,
int flags, SwsFilter *srcFilter, int flags, SwsFilter *srcFilter,
...@@ -520,13 +522,12 @@ struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, ...@@ -520,13 +522,12 @@ struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat,
struct SwsContext *ctx; struct SwsContext *ctx;
ctx = av_malloc(sizeof(struct SwsContext)); ctx = av_malloc(sizeof(struct SwsContext));
if (ctx) if (!ctx) {
ctx->av_class = av_mallocz(sizeof(AVClass));
if (!ctx || !ctx->av_class) {
av_log(NULL, AV_LOG_ERROR, "Cannot allocate a resampling context!\n"); av_log(NULL, AV_LOG_ERROR, "Cannot allocate a resampling context!\n");
return NULL; return NULL;
} }
ctx->av_class = &context_class;
if ((srcH != dstH) || (srcW != dstW)) { if ((srcH != dstH) || (srcW != dstW)) {
if ((srcFormat != PIX_FMT_YUV420P) || (dstFormat != PIX_FMT_YUV420P)) { if ((srcFormat != PIX_FMT_YUV420P) || (dstFormat != PIX_FMT_YUV420P)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment