[FFmpeg-devel] [PATCH] avformat/aviobuf/ff_get_line: also accept \r as end of line character

Michael Niedermayer michaelni at gmx.at
Tue May 13 00:29:56 CEST 2014


Fixes Ticket3108

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavformat/aviobuf.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 32a1f92..738459e 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -665,7 +665,9 @@ int ff_get_line(AVIOContext *s, char *buf, int maxlen)
         c = avio_r8(s);
         if (c && i < maxlen-1)
             buf[i++] = c;
-    } while (c != '\n' && c);
+    } while (c != '\n' && c != '\r' && c);
+    if (c == '\r' && avio_r8(s) != '\n')
+        avio_skip(s, -1);
 
     buf[i] = 0;
     return i;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list