[FFmpeg-devel] [PATCH] drawtext: ignore last newline
ffmpeg at gyani.pro
Mon Jun 10 20:14:43 EEST 2019
On 10-06-2019 09:24 PM, Jonathan Baecker wrote:
> I created this issue on the bugtracker:
> 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
> 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.
More information about the ffmpeg-devel