[FFmpeg-devel] Questions about av_base64_encode()

Luca Abeni lucabe72
Tue Oct 30 09:50:04 CET 2007


Hi Michael,

Michael Niedermayer wrote:
[...]
>> I am trying to use base64 encoding from libavutil, so I looked
>> at av_base64_encode() and I have two questions about it:
>> 1) Why isn't the "uint8_t * src" marked as "const"?
>>     Would it be ok to change the function's prototype in
>>     char *av_base64_encode(char * buf, int buf_len, const uint8_t * src, int len)
>>     ?
> 
> probably ok

Good. I'll commit it today unless anyone complains.


>> 2) av_base64_encode() fails if buf_len < len * 4 / 3 + 12...
>>     Why "+12"? Shouldn't it be "+4", or "+5" (considering the
>>     0 to terminate the string)? Or am I missing something?
> 
> dunno, also i dunno why the
> if(len) is there it seems redundant

That was my next question ;-)


> feel free to simplify it

I am for removing the "if(len)", and changing "+ 12" in "+ 5".
I'll do some tests, and I'll commit those changes next week,
if noone disagrees.


			Thanks,
				Luca




More information about the ffmpeg-devel mailing list