|
|
@ -106,6 +106,11 @@ static int video_decode(const char *input_filename) |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (strcmp(codec->name, "flv") && strcmp(codec->name, "mpeg4") && strcmp(codec->name, "huffyuv")) { |
|
|
|
|
|
|
|
av_log(NULL, AV_LOG_ERROR, "Wrong codec\n"); |
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ctx = avcodec_alloc_context3(codec); |
|
|
|
ctx = avcodec_alloc_context3(codec); |
|
|
|
if (!ctx) { |
|
|
|
if (!ctx) { |
|
|
|
av_log(NULL, AV_LOG_ERROR, "Can't allocate decoder context\n"); |
|
|
|
av_log(NULL, AV_LOG_ERROR, "Can't allocate decoder context\n"); |
|
|
@ -139,11 +144,6 @@ static int video_decode(const char *input_filename) |
|
|
|
return AVERROR(ENOMEM); |
|
|
|
return AVERROR(ENOMEM); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (strcmp(codec->name, "flv") && strcmp(codec->name, "mpeg4") && strcmp(codec->name, "huffyuv")) { |
|
|
|
|
|
|
|
av_log(NULL, AV_LOG_ERROR, "Wrong codec\n"); |
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte_buffer_size = av_image_get_buffer_size(ctx->pix_fmt, ctx->width, ctx->height, 32); |
|
|
|
byte_buffer_size = av_image_get_buffer_size(ctx->pix_fmt, ctx->width, ctx->height, 32); |
|
|
|
byte_buffer = av_malloc(byte_buffer_size); |
|
|
|
byte_buffer = av_malloc(byte_buffer_size); |
|
|
|
if (!byte_buffer) { |
|
|
|
if (!byte_buffer) { |
|
|
|