[FFmpeg-devel] [PATCH] drawtext: ignore last newline

Jonathan Baecker jonbae77 at gmail.com
Mon Jun 10 21:52:56 EEST 2019


Am 10.06.2019 um 19:14 schrieb Gyan:
>
>
> On 10-06-2019 09:24 PM, Jonathan Baecker wrote:
>> I created this issue on the bugtracker: 
>> https://trac.ffmpeg.org/ticket/7948
>>
>> Here is now a patch for it. drawtext should ignore the very last 
>> newline character in text files, because many editor add 
>> automatically a newline at the end.
>
> Some users may want to deliberately expand the box, so this should not 
> be forced.

Then you have the box double so high then it should and most of the free 
space under the text, but if you want this - a blank space would be enough.

Anyway what would be your suggestion? It don't have to be like this, I 
only though it is more intuitive.

>
>> What do you think about this solution?
>
>> -        /* skip the \n in the sequence \r\n */
>> -        if (prev_code == '\r' && code == '\n')
>> +        /* skip the \n in the sequence \r\n and ignore last empty 
>> line */
>> +        if ((prev_code == '\r' && code == '\n') ||
>> +            (code == '\n' && i == len - 1) ||
>> +            (code == '\r' && i == len - 2))
>
> I believe this will keep the last line on Mac-style text files.
Ok thanks for the hint, tomorrow I can test it on macOS and change it.
>
> Gyan
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".




More information about the ffmpeg-devel mailing list