[FFmpeg-devel] [PATCH] drawtext: ignore last newline
    Gyan 
    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: 
> 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.
> 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.
Gyan
    
    
More information about the ffmpeg-devel
mailing list