Commit 1cfd1d86 authored by bcoudurier's avatar bcoudurier

Correctly write last 0 lacing value when packet size is multiple of 255, patch...

Correctly write last 0 lacing value when packet size is multiple of 255, patch by Greg Maxwell, gmaxwell at gmail dot com

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@22559 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 55fa84a4
...@@ -61,7 +61,7 @@ static int ogg_write_page(AVFormatContext *s, const uint8_t *data, int size, ...@@ -61,7 +61,7 @@ static int ogg_write_page(AVFormatContext *s, const uint8_t *data, int size,
} else if (oggstream->eos) } else if (oggstream->eos)
flags |= 4; flags |= 4;
page_segments = FFMIN((size/255)+!!size, 255); page_segments = FFMIN(size/255 + 1, 255);
init_checksum(s->pb, ff_crc04C11DB7_update, 0); init_checksum(s->pb, ff_crc04C11DB7_update, 0);
put_tag(s->pb, "OggS"); put_tag(s->pb, "OggS");
...@@ -75,10 +75,9 @@ static int ogg_write_page(AVFormatContext *s, const uint8_t *data, int size, ...@@ -75,10 +75,9 @@ static int ogg_write_page(AVFormatContext *s, const uint8_t *data, int size,
put_byte(s->pb, page_segments); put_byte(s->pb, page_segments);
for (i = 0; i < page_segments-1; i++) for (i = 0; i < page_segments-1; i++)
put_byte(s->pb, 255); put_byte(s->pb, 255);
if (size) { put_byte(s->pb, size - (page_segments-1)*255);
put_byte(s->pb, size - (page_segments-1)*255); put_buffer(s->pb, data, size);
put_buffer(s->pb, data, size);
}
ogg_update_checksum(s, crc_offset); ogg_update_checksum(s, crc_offset);
put_flush_packet(s->pb); put_flush_packet(s->pb);
return size; return size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment