# HG changeset patch # User ib # Date 1302011042 0 # Node ID f884fb919ac564355e905ef0b35326a4d4932981 # Parent 07be88814256c4a76bd3495b855bdd617a4038c4 Remove various pngRead() debug messages. Instead, issue the return code in the debug message after calling pngRead() and increase return code values to allow exact error assignments. diff -r 07be88814256 -r f884fb919ac5 gui/util/bitmap.c --- a/gui/util/bitmap.c Tue Apr 05 13:21:20 2011 +0000 +++ b/gui/util/bitmap.c Tue Apr 05 13:44:02 2011 +0000 @@ -41,26 +41,22 @@ file = fopen(fname, "rb"); - if (!file) { - mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] open error: %s\n", fname); - return 1; - } + if (!file) + return 2; fseek(file, 0, SEEK_END); len = ftell(file); if (len > 50 * 1024 * 1024) { fclose(file); - mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] file too big: %s\n", fname); - return 2; + return 3; } data = av_malloc(len + FF_INPUT_BUFFER_PADDING_SIZE); if (!data) { fclose(file); - mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] not enough memory: %lu\n", len + FF_INPUT_BUFFER_PADDING_SIZE); - return 3; + return 4; } fseek(file, 0, SEEK_SET); @@ -117,6 +113,8 @@ if (bf->Image) memcpy_pic(bf->Image, frame->data[0], bpl, bf->Height, bpl, frame->linesize[0]); + else + decode_ok = 0; } avcodec_close(avctx); @@ -124,11 +122,6 @@ av_freep(&avctx); av_freep(&data); - if (decode_ok && bf->BPP && !bf->Image) { - mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] not enough memory: %lu\n", bf->ImageSize); - return 4; - } - return !(decode_ok && bf->BPP); } @@ -194,13 +187,17 @@ int bpRead(char *fname, txSample *bf) { + int r; + fname = fExist(fname); if (!fname) return -2; - if (pngRead(fname, bf) != 0) { - mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] read error: %s\n", fname); + r = pngRead(fname, bf); + + if (r != 0) { + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] read error #%d: %s\n", r, fname); return -5; }