diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2008-09-26 03:24:05 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2008-09-26 03:24:05 +0000 |
commit | 5c8a1d19274267bc45374b49a844192f54b40a93 (patch) | |
tree | 83bf555cabcae7c9a5d818ac2708929178153be4 /libavformat/assdec.c | |
parent | a3250d073da3b95f3369361f0b20809d66fbf692 (diff) | |
download | ffmpeg-5c8a1d19274267bc45374b49a844192f54b40a93.tar.gz |
Do not lose the '\n'.
Originally committed as revision 15424 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/assdec.c')
-rw-r--r-- | libavformat/assdec.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libavformat/assdec.c b/libavformat/assdec.c index fa0ab793e0..c5d319dffc 100644 --- a/libavformat/assdec.c +++ b/libavformat/assdec.c @@ -140,7 +140,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) 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 @@ fail: 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); |