summaryrefslogtreecommitdiff
path: root/apps/codecs/libtremor/framing.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2011-10-08 10:09:11 +0000
committerNils Wallménius <nils@rockbox.org>2011-10-08 10:09:11 +0000
commite1ea13ee75d545a4a945f5e24b652d8741a675cf (patch)
treecf1b6a24aaa2bb4deb6ee8eb770d954fdadaa3ff /apps/codecs/libtremor/framing.c
parentb779fcc3ed9adbaf0fda5598f3e26a154f1c1410 (diff)
libtremor: hack to work around huge allocations for the comment packet in files with embedded album art. Should fix playback of such files on targets with large codec buffers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30728 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libtremor/framing.c')
-rw-r--r--apps/codecs/libtremor/framing.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/apps/codecs/libtremor/framing.c b/apps/codecs/libtremor/framing.c
index d67708f87a..582084853a 100644
--- a/apps/codecs/libtremor/framing.c
+++ b/apps/codecs/libtremor/framing.c
@@ -236,7 +236,7 @@ int ogg_stream_destroy(ogg_stream_state *os){
/* Helpers for ogg_stream_encode; this keeps the structure and
what's happening fairly clear */
-static int _os_body_expand(ogg_stream_state *os,int needed){
+int _os_body_expand(ogg_stream_state *os,int needed){
if(os->body_storage<=os->body_fill+needed){
void *ret;
ret=_ogg_realloc(os->body_data,(os->body_storage+needed+1024)*
@@ -783,7 +783,7 @@ int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){
/* add the incoming page to the stream state; we decompose the page
into packet segments here as well. */
-int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){
+int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og, bool copy_body){
unsigned char *header=og->header;
unsigned char *body=og->body;
long bodysize=og->body_len;
@@ -868,8 +868,10 @@ int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){
}
if(bodysize){
- if(_os_body_expand(os,bodysize)) return -1;
- memcpy(os->body_data+os->body_fill,body,bodysize);
+ if(copy_body){
+ if(_os_body_expand(os,bodysize)) return -1;
+ memcpy(os->body_data+os->body_fill,body,bodysize);
+ }
os->body_fill+=bodysize;
}