[Ffmpeg-devel] [PATCH] remove most of fprintf
Steve Lhomme
slhomme
Wed Mar 1 06:29:04 CET 2006
Michael Niedermayer wrote:
> Hi
>
> On Tue, Feb 28, 2006 at 02:57:41PM -1000, Steve Lhomme wrote:
>> ...and replace with av_log()
>>
>
> [...]
>
>> Index: libavcodec/huffyuv.c
>> ===================================================================
>> RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/huffyuv.c,v
>> retrieving revision 1.66
>> diff -u -r1.66 huffyuv.c
>> --- libavcodec/huffyuv.c 25 Jan 2006 22:10:12 -0000 1.66
>> +++ libavcodec/huffyuv.c 1 Mar 2006 00:26:14 -0000
>> @@ -343,7 +343,7 @@
>>
>> return 0;
>> #else
>> - fprintf(stderr, "v1 huffyuv is not supported \n");
>> + av_log(s->avctx, AV_LOG_DEBUG, "v1 huffyuv is not supported \n");
>
> AV_LOG_ERROR!
>
> [...]
>
>> Index: libavcodec/motion_est.c
>> ===================================================================
>> RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/motion_est.c,v
>> retrieving revision 1.120
>> diff -u -r1.120 motion_est.c
>> --- libavcodec/motion_est.c 22 Jan 2006 20:54:52 -0000 1.120
>> +++ libavcodec/motion_est.c 1 Mar 2006 00:28:25 -0000
>> @@ -365,7 +365,7 @@
>> #if 0
>> if (*mx_ptr < -(2 * range) || *mx_ptr >= (2 * range) ||
>> *my_ptr < -(2 * range) || *my_ptr >= (2 * range)) {
>> - fprintf(stderr, "error %d %d\n", *mx_ptr, *my_ptr);
>> + av_log(NULL, AV_LOG_DEBUG, "error %d %d\n", *mx_ptr, *my_ptr);
>
> hmm, id also tend toward > DEBUG here, indention looks wrong too
>
> [...]
>> - dprintf("skip %x\n", header);
>> + av_log(avctx, AV_LOG_DEBUG, "skip %x\n", header);
>> /* reset free format frame size to give a chance
>> to get a new bitrate */
>> s->free_format_frame_size = 0;
>
> not ok dprintf is not equivalant to av_log
OK. Although dprintf is redirected to nothing in my case. And I'd prefer
to have the debug info. Now if dprintf is purely for debug and is not
supposed to appear to a regular user (choosing to see debug messages),
it's fine.
>>
>> @@ -504,7 +504,7 @@
>> #if 0
>> if ((unsigned)mx >= 64 ||
>> (unsigned)my >= 64)
>> - fprintf(stderr, "error mx=%d my=%d\n", mx, my);
>> + av_log(s->avctx, AV_LOG_DEBUG, "error mx=%d my=%d\n", mx, my);
>
> if the string contains the word "error" or "illegal" then AV_LOG_DEBUG is
> wrong normally
OK, I'll fix all the wrong DEBUG<->ERROR and submit again.
>> Index: libavformat/utils.c
>> ===================================================================
>> RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/utils.c,v
>> retrieving revision 1.179
>> diff -u -r1.179 utils.c
>> --- libavformat/utils.c 11 Feb 2006 17:17:37 -0000 1.179
>> +++ libavformat/utils.c 1 Mar 2006 00:15:59 -0000
>> @@ -2579,13 +2579,13 @@
>> int i, flags;
>> char buf[256];
>>
>> - av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n",
>> + av_log(ic, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n",
>
> this and the changes below are likely not ok
But it works fine here. All the (Dr)FFMPEG debug is redirected to our
own classes. And depending on the context it ends up in a general file
or a specific file. The latter is preferrable when available. And it
does work.
More information about the ffmpeg-devel
mailing list