[FFmpeg-devel] [PATCH] AVFormat: LRC demuxer and muxer

Star Brilliant m13253 at hotmail.com
Wed Jul 9 17:37:31 CEST 2014

On 2014-07-09 23:09, Derek Buitenhuis wrote:
> You misunderstand what I am asking. int may be 32bits, and timestamps generate 64.
> is LRC guaranteed to only have 32bit timestamps?

I find no portable way to scanf a 64-bit integer in C90 standard.
sscanf(buf, "%" SCNd64, &ptr); is a C99 thing.
Does lavfutil provide something to read a 64-bit integer?

>>>> +        *start = -(mm*60000LL + ss*1000LL + cs*10LL); // just in case negative pts
>>> Why are you mangling the timestamps? Negative timestamps are technically valid.
>> Negative timestamps are not effective in real LRCs. However, with the
>> feature called "offset" mentioned just above. A normal timestamp can
>> easily become negative.
>> Since most players ignore uneffective lines (LRC has no official spec,
>> it is a de-facto standard). So I will let the players drop those
>> negative timestamps, instead of losing data at FFmpeg layer.
> Sorry, I misunderstood the code. I thought you we're making it positive (double negative -> positive).
> That said, there is still a bug. %d will read negative integers already, you
> do not need to check for '-'.

I check for negative before positive. Anyway, if I use only one sscanf, 
I will have to do this:

if(sscanf(p, "[%d:%d.%d]", &mm, &ss, &cs) == 3) {
     if(mm >= 0)
         *start = mm*60000LL + ss*1000LL + cs*10LL;
         *start = mm*60000LL - ss*1000LL - cs*10LL;

Which one do you think is better?

More information about the ffmpeg-devel mailing list