Fix decode on Android
This commit is contained in:
@@ -107,6 +107,7 @@ namespace lime {
|
||||
bool OGG::Decode (Resource *resource, AudioBuffer *audioBuffer) {
|
||||
|
||||
OggVorbis_File oggFile;
|
||||
Bytes data;
|
||||
|
||||
if (resource->path) {
|
||||
|
||||
@@ -130,7 +131,7 @@ namespace lime {
|
||||
} else {
|
||||
|
||||
lime::fclose (file);
|
||||
Bytes data = Bytes (resource->path);
|
||||
data = Bytes (resource->path);
|
||||
|
||||
OAL_OggMemoryFile fakeFile = { data.Data (), data.Length (), 0 };
|
||||
|
||||
@@ -186,10 +187,10 @@ namespace lime {
|
||||
audioBuffer->data->Resize (dataLength);
|
||||
|
||||
while (bytes > 0) {
|
||||
|
||||
bytes = ov_read (&oggFile, (char *)audioBuffer->data->Data () + totalBytes, BUFFER_SIZE, BUFFER_READ_TYPE, 2, 1, &bitStream);
|
||||
totalBytes += bytes;
|
||||
|
||||
|
||||
bytes = ov_read (&oggFile, (char *)audioBuffer->data->Data () + totalBytes, BUFFER_SIZE, BUFFER_READ_TYPE, 2, 1, &bitStream);
|
||||
totalBytes += bytes;
|
||||
|
||||
}
|
||||
|
||||
if (dataLength != totalBytes) {
|
||||
|
||||
@@ -191,6 +191,7 @@ namespace lime {
|
||||
jpegError.base.output_message = OnOutput;
|
||||
|
||||
FILE_HANDLE *file = NULL;
|
||||
Bytes data = NULL;
|
||||
|
||||
if (resource->path) {
|
||||
|
||||
@@ -227,7 +228,7 @@ namespace lime {
|
||||
|
||||
} else {
|
||||
|
||||
Bytes data = Bytes (resource->path);
|
||||
data = Bytes (resource->path);
|
||||
MySrcManager manager (data.Data (), data.Length ());
|
||||
cinfo.src = &manager.pub;
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ namespace lime {
|
||||
int bit_depth, color_type, interlace_type;
|
||||
|
||||
FILE_HANDLE *file = NULL;
|
||||
Bytes data = NULL;
|
||||
|
||||
if (resource->path) {
|
||||
|
||||
@@ -143,7 +144,7 @@ namespace lime {
|
||||
|
||||
} else {
|
||||
|
||||
Bytes data = Bytes (resource->path);
|
||||
data = Bytes (resource->path);
|
||||
ReadBuffer buffer (data.Data (), data.Length ());
|
||||
png_set_read_fn (png_ptr, &buffer, user_read_data_fn);
|
||||
|
||||
|
||||
@@ -363,10 +363,10 @@ namespace lime {
|
||||
Bytes data = Bytes (resource->path);
|
||||
faceMemory = (unsigned char*)malloc (data.Length ());
|
||||
memcpy (faceMemory, data.Data (), data.Length ());
|
||||
|
||||
|
||||
lime::fclose (file);
|
||||
file = 0;
|
||||
|
||||
|
||||
error = FT_New_Memory_Face (library, faceMemory, data.Length (), faceIndex, &face);
|
||||
|
||||
}
|
||||
@@ -415,11 +415,10 @@ namespace lime {
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
FT_Done_FreeType (library);
|
||||
|
||||
free (faceMemory);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user