changeset 3943:b250956a6f68 libavformat

Do not lose the '\n'.
author michael
date Fri, 26 Sep 2008 03:24:05 +0000
parents ffb410d82ad3
children 7141e56c9f69
files assdec.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/assdec.c	Fri Sep 26 02:19:21 2008 +0000
+++ b/assdec.c	Fri Sep 26 03:24:05 2008 +0000
@@ -140,7 +140,7 @@
         ass->event[i]= p;
         while(*p && *p != '\n')
             p++;
-        *p++ = 0;
+        p++;
     }
 
     qsort(ass->event, ass->event_count, sizeof(*ass->event), event_cmp);
@@ -156,14 +156,15 @@
 static int read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     ASSContext *ass = s->priv_data;
-    uint8_t *p;
+    uint8_t *p, *end;
 
     if(ass->event_index >= ass->event_count)
         return AVERROR(EIO);
 
     p= ass->event[ ass->event_index ];
 
-    av_new_packet(pkt, strlen(p));
+    end= strchr(p, '\n');
+    av_new_packet(pkt, end ? end-p+1 : strlen(p));
     pkt->flags |= PKT_FLAG_KEY;
     pkt->pos= p - ass->event_buffer + s->streams[0]->codec->extradata_size;
     pkt->pts= pkt->dts= get_pts(p);