You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
Merge commit '5c0a09839c707f10e5dba59460e219e989c1da93'
* commit '5c0a09839c707f10e5dba59460e219e989c1da93': libopenjpegdec: return meaningful error codes Conflicts: libavcodec/libopenjpegdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -245,7 +245,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
|
|||||||
opj_dinfo_t *dec;
|
opj_dinfo_t *dec;
|
||||||
opj_cio_t *stream;
|
opj_cio_t *stream;
|
||||||
opj_image_t *image;
|
opj_image_t *image;
|
||||||
int width, height, ret = -1;
|
int width, height, ret;
|
||||||
int pixel_size = 0;
|
int pixel_size = 0;
|
||||||
int ispacked = 0;
|
int ispacked = 0;
|
||||||
int i;
|
int i;
|
||||||
@@ -267,7 +267,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
|
|||||||
|
|
||||||
if (!dec) {
|
if (!dec) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Error initializing decoder.\n");
|
av_log(avctx, AV_LOG_ERROR, "Error initializing decoder.\n");
|
||||||
return -1;
|
return AVERROR_UNKNOWN;
|
||||||
}
|
}
|
||||||
opj_set_event_mgr((opj_common_ptr)dec, NULL, NULL);
|
opj_set_event_mgr((opj_common_ptr)dec, NULL, NULL);
|
||||||
ctx->dec_params.cp_limit_decoding = LIMIT_TO_MAIN_HEADER;
|
ctx->dec_params.cp_limit_decoding = LIMIT_TO_MAIN_HEADER;
|
||||||
@@ -280,7 +280,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
|
|||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"Codestream could not be opened for reading.\n");
|
"Codestream could not be opened for reading.\n");
|
||||||
opj_destroy_decompress(dec);
|
opj_destroy_decompress(dec);
|
||||||
return -1;
|
return AVERROR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode the header only.
|
// Decode the header only.
|
||||||
@@ -290,13 +290,13 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
|
|||||||
if (!image) {
|
if (!image) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Error decoding codestream.\n");
|
av_log(avctx, AV_LOG_ERROR, "Error decoding codestream.\n");
|
||||||
opj_destroy_decompress(dec);
|
opj_destroy_decompress(dec);
|
||||||
return -1;
|
return AVERROR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
width = image->x1 - image->x0;
|
width = image->x1 - image->x0;
|
||||||
height = image->y1 - image->y0;
|
height = image->y1 - image->y0;
|
||||||
|
|
||||||
if (av_image_check_size(width, height, 0, avctx) < 0) {
|
if ((ret = av_image_check_size(width, height, 0, avctx)) < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"%dx%d dimension invalid.\n", width, height);
|
"%dx%d dimension invalid.\n", width, height);
|
||||||
goto done;
|
goto done;
|
||||||
@@ -319,7 +319,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
|
|||||||
if (image->comps[i].prec > avctx->bits_per_raw_sample)
|
if (image->comps[i].prec > avctx->bits_per_raw_sample)
|
||||||
avctx->bits_per_raw_sample = image->comps[i].prec;
|
avctx->bits_per_raw_sample = image->comps[i].prec;
|
||||||
|
|
||||||
if (ff_thread_get_buffer(avctx, &frame, 0) < 0)
|
if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
ctx->dec_params.cp_limit_decoding = NO_LIMITATION;
|
ctx->dec_params.cp_limit_decoding = NO_LIMITATION;
|
||||||
@@ -330,6 +330,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
|
|||||||
if (!stream) {
|
if (!stream) {
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"Codestream could not be opened for reading.\n");
|
"Codestream could not be opened for reading.\n");
|
||||||
|
ret = AVERROR_UNKNOWN;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,6 +341,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
|
|||||||
|
|
||||||
if (!image) {
|
if (!image) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Error decoding codestream.\n");
|
av_log(avctx, AV_LOG_ERROR, "Error decoding codestream.\n");
|
||||||
|
ret = AVERROR_UNKNOWN;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,6 +378,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
av_log(avctx, AV_LOG_ERROR, "unsupported pixel size %d\n", pixel_size);
|
av_log(avctx, AV_LOG_ERROR, "unsupported pixel size %d\n", pixel_size);
|
||||||
|
ret = AVERROR_PATCHWELCOME;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user