mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 10:40:21 +00:00
GPUJPEG probe: return success if unable to detect
Return success if codec was not able to detect. Returning DECODER_NO_FRAME here doesn't make sense because we are either able to detect from any frame or not at all. That would result in infinite probing for internal codec.
This commit is contained in:
@@ -179,6 +179,7 @@ static int gpujpeg_decompress_reconfigure(void *state, struct video_desc desc,
|
||||
|
||||
#if LIBGPUJPEG_API_VERSION >= 4
|
||||
static decompress_status gpujpeg_probe_internal_codec(unsigned char *buffer, size_t len, codec_t *internal_codec) {
|
||||
*internal_codec = VIDEO_CODEC_NONE;
|
||||
struct gpujpeg_image_parameters params = { 0 };
|
||||
#if LIBGPUJPEG_API_VERSION >= 6
|
||||
if (gpujpeg_decoder_get_image_info(buffer, len, ¶ms, NULL) != 0) {
|
||||
@@ -187,11 +188,13 @@ static decompress_status gpujpeg_probe_internal_codec(unsigned char *buffer, siz
|
||||
#else
|
||||
if (gpujpeg_decoder_get_image_info(buffer, len, ¶ms) != 0) {
|
||||
#endif
|
||||
return DECODER_NO_FRAME;
|
||||
log_msg(LOG_LEVEL_WARNING, MOD_NAME "probe - cannot get image info!\n");
|
||||
return DECODER_GOT_FRAME;
|
||||
}
|
||||
|
||||
if (!params.color_space) {
|
||||
return DECODER_NO_FRAME;
|
||||
log_msg(LOG_LEVEL_WARNING, MOD_NAME "probe - image color space is unknown!\n");
|
||||
return DECODER_GOT_FRAME;
|
||||
}
|
||||
|
||||
switch ( params.color_space ) {
|
||||
@@ -209,7 +212,9 @@ static decompress_status gpujpeg_probe_internal_codec(unsigned char *buffer, siz
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
return DECODER_NO_FRAME;
|
||||
log_msg(LOG_LEVEL_WARNING, MOD_NAME "probe - unhandled color space: %s\n",
|
||||
gpujpeg_color_space_get_name(params.color_space));
|
||||
return DECODER_GOT_FRAME;
|
||||
}
|
||||
|
||||
log_msg(LOG_LEVEL_VERBOSE, "JPEG color space: %s\n", gpujpeg_color_space_get_name(params.color_space));
|
||||
|
||||
Reference in New Issue
Block a user