[FFmpeg-devel] [PATCH] Replace dprintf with av_dlog

Luca Barbato lu_zero
Sat Jan 29 19:11:28 CET 2011


On 01/29/2011 06:30 PM, Diego Biurrun wrote:
> On Sat, Jan 29, 2011 at 05:49:02PM +0100, Luca Barbato wrote:
>> dprintf clashes with POSIX.1-2008
> 
> Nice work, you beat me to it :)

Sed did most of the work
> 
> Maybe av_dbglog is a slightly more intuitive name?

Not sure, I prefer dlog since it is shorter.

> 
>> --- a/libavcodec/mpeg12enc.c
>> +++ b/libavcodec/mpeg12enc.c
>> @@ -890,7 +890,7 @@ static void mpeg1_encode_block(MpegEncContext *s,
>>  #if 0
>>          if (level != 0)
>> -            dprintf(s->avctx, "level[%d]=%d\n", i, level);
>> +            av_dlog(s->avctx, "level[%d]=%d\n", i, level);
>>  #endif
> 
> There is a lot of '#if 0' code in FFmpeg, how about dropping some of it?

We might look at it soon.

>> --- a/libavfilter/avfilter.c
>> +++ b/libavfilter/avfilter.c
>> @@ -217,24 +217,24 @@ static char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms)
>>  
>> -static void ff_dprintf_ref(void *ctx, AVFilterBufferRef *ref, int end)
>> +static void ff_av_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end)
> 
> Did you rename the functions on purpose?

not on purpose, I'd drop the spurious av_.

>> --- a/libavformat/mpegts.c
>> +++ b/libavformat/mpegts.c
>> @@ -994,7 +994,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
>>  
>>  #ifdef DEBUG
>> -    dprintf(ts->stream, "PMT: len %i\n", section_len);
>> +    av_dlog(ts->stream, "PMT: len %i\n", section_len);
>>      av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len);
>>  #endif
>>  
>> @@ -1114,7 +1114,7 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
>>  
>>  #ifdef DEBUG
>> -    dprintf(ts->stream, "PAT:\n");
>> +    av_dlog(ts->stream, "PAT:\n");
>>      av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len);
>>  #endif
>> @@ -1158,7 +1158,7 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
>>  
>>  #ifdef DEBUG
>> -    dprintf(ts->stream, "SDT:\n");
>> +    av_dlog(ts->stream, "SDT:\n");
>>      av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len);
>>  #endif
> 
> Looks like we should introduce a debug variant of av_hex_dump_log...

makes sense.

>> --- a/libavformat/rtspdec.c
>> +++ b/libavformat/rtspdec.c
>> @@ -184,7 +184,7 @@ int ff_rtsp_tcp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
>>  
>>  #ifdef DEBUG_RTP_TCP
>> -    dprintf(s, "tcp_read_packet:\n");
>> +    av_dlog(s, "tcp_read_packet:\n");
>>  #endif
>> @@ -205,7 +205,7 @@ redo:
>>      len = AV_RB16(buf + 1);
>>  #ifdef DEBUG_RTP_TCP
>> -    dprintf(s, "id=%d len=%d\n", id, len);
>> +    av_dlog(s, "id=%d len=%d\n", id, len);
>>  #endif
> 
> not directly related, but does it make sense to drop the #ifdef?

Might be part of a larger patch that cleanups ifdefs.

lu

-- 

Luca Barbato
Gentoo/linux
http://dev.gentoo.org/~lu_zero




More information about the ffmpeg-devel mailing list