updated to latest mobile-common (0cf55b7da58e), removed libtiff, libpng, libmng, devil, jasper, jpeg-8d, added libturbo-jpeg

This commit is contained in:
fysx
2014-08-27 23:19:11 +02:00
parent aba2f47b31
commit abb819335b
1910 changed files with 78167 additions and 922995 deletions
+3 -3
View File
@@ -42,11 +42,11 @@ class Sound : public Module
public:
/**
* Destructor.
**/
virtual ~Sound();
// Implements Module.
virtual ModuleType getModuleType() const { return M_SOUND; }
/**
* Creates new SoundData from a decoder. Fully expands the
* encoded sound data into raw sound data. Not recommended
@@ -37,7 +37,6 @@ Decoder::Decoder(Data *data, const std::string &ext, int bufferSize)
, buffer(0)
, eof(false)
{
data->retain();
buffer = new char[bufferSize];
}
@@ -45,8 +44,6 @@ Decoder::~Decoder()
{
if (buffer != 0)
delete [](char *) buffer;
if (data != 0)
data->release();
}
void *Decoder::getBuffer() const
+1 -1
View File
@@ -53,7 +53,7 @@ protected:
// The encoded data. This should be replaced with buffered file
// reads in the future.
Data *data;
Object::StrongRef<Data> data;
// File extension.
std::string ext;
@@ -69,7 +69,7 @@ bool FLACDecoder::accepts(const std::string &ext)
love::sound::Decoder *FLACDecoder::clone()
{
return new FLACDecoder(data, ext, bufferSize, sampleRate);
return new FLACDecoder(data.get(), ext, bufferSize, sampleRate);
}
int FLACDecoder::decode()
@@ -86,7 +86,7 @@ bool GmeDecoder::accepts(const std::string &ext)
love::sound::Decoder *GmeDecoder::clone()
{
return new GmeDecoder(data, ext, bufferSize);
return new GmeDecoder(data.get(), ext, bufferSize);
}
int GmeDecoder::decode()
@@ -98,7 +98,7 @@ bool ModPlugDecoder::accepts(const std::string &ext)
love::sound::Decoder *ModPlugDecoder::clone()
{
return new ModPlugDecoder(data, ext, bufferSize);
return new ModPlugDecoder(data.get(), ext, bufferSize);
}
int ModPlugDecoder::decode()
@@ -96,7 +96,7 @@ void Mpg123Decoder::quit()
love::sound::Decoder *Mpg123Decoder::clone()
{
return new Mpg123Decoder(data, ext, bufferSize);
return new Mpg123Decoder(data.get(), ext, bufferSize);
}
int Mpg123Decoder::decode()
@@ -179,7 +179,7 @@ bool VorbisDecoder::accepts(const std::string &ext)
love::sound::Decoder *VorbisDecoder::clone()
{
return new VorbisDecoder(data, ext, bufferSize);
return new VorbisDecoder(data.get(), ext, bufferSize);
}
int VorbisDecoder::decode()
@@ -117,7 +117,7 @@ bool WaveDecoder::accepts(const std::string &ext)
love::sound::Decoder *WaveDecoder::clone()
{
return new WaveDecoder(data, ext, bufferSize);
return new WaveDecoder(data.get(), ext, bufferSize);
}
int WaveDecoder::decode()
+17 -14
View File
@@ -20,6 +20,8 @@
#include "wrap_Sound.h"
#include "filesystem/wrap_Filesystem.h"
// Implementations.
#include "lullaby/Sound.h"
@@ -28,7 +30,7 @@ namespace love
namespace sound
{
static Sound *instance = 0;
#define instance() (Module::getInstance<Sound>(Module::M_SOUND))
int w_newSoundData(lua_State *L)
{
@@ -41,7 +43,7 @@ int w_newSoundData(lua_State *L)
int bitDepth = luaL_optint(L, 3, Decoder::DEFAULT_BIT_DEPTH);
int channels = luaL_optint(L, 4, Decoder::DEFAULT_CHANNELS);
EXCEPT_GUARD(t = instance->newSoundData(samples, sampleRate, bitDepth, channels);)
luax_catchexcept(L, [&](){ t = instance()->newSoundData(samples, sampleRate, bitDepth, channels); });
}
// Must be string or decoder.
else
@@ -53,30 +55,30 @@ int w_newSoundData(lua_State *L)
lua_replace(L, 1);
}
EXCEPT_GUARD(t = instance->newSoundData(luax_checkdecoder(L, 1));)
luax_catchexcept(L, [&](){ t = instance()->newSoundData(luax_checkdecoder(L, 1)); });
}
luax_pushtype(L, "SoundData", SOUND_SOUND_DATA_T, t);
t->release();
return 1;
}
int w_newDecoder(lua_State *L)
{
// Convert to FileData, if necessary.
if (lua_isstring(L, 1) || luax_istype(L, 1, FILESYSTEM_FILE_T))
luax_convobj(L, 1, "filesystem", "newFileData");
love::filesystem::FileData *data = luax_checktype<love::filesystem::FileData>(L, 1, "FileData", FILESYSTEM_FILE_DATA_T);
love::filesystem::FileData *data = love::filesystem::luax_getfiledata(L, 1);
int bufferSize = luaL_optint(L, 2, Decoder::DEFAULT_BUFFER_SIZE);
Decoder *t = 0;
EXCEPT_GUARD(t = instance->newDecoder(data, bufferSize);)
Decoder *t = nullptr;
luax_catchexcept(L,
[&]() { t = instance()->newDecoder(data, bufferSize); },
[&]() { data->release(); }
);
if (t == 0)
if (t == nullptr)
return luaL_error(L, "Extension \"%s\" not supported.", data->getExtension().c_str());
luax_pushtype(L, "Decoder", SOUND_DECODER_T, t);
t->release();
return 1;
}
@@ -97,9 +99,10 @@ static const lua_CFunction types[] =
extern "C" int luaopen_love_sound(lua_State *L)
{
if (instance == 0)
Sound *instance = instance();
if (instance == nullptr)
{
EXCEPT_GUARD(instance = new lullaby::Sound();)
luax_catchexcept(L, [&](){ instance = new lullaby::Sound(); });
}
else
instance->retain();
@@ -73,7 +73,7 @@ int w_SoundData_setSample(lua_State *L)
int i = (int) luaL_checkinteger(L, 2);
float sample = (float) luaL_checknumber(L, 3);
EXCEPT_GUARD(sd->setSample(i, sample);)
luax_catchexcept(L, [&](){ sd->setSample(i, sample); });
return 0;
}
@@ -82,7 +82,7 @@ int w_SoundData_getSample(lua_State *L)
SoundData *sd = luax_checksounddata(L, 1);
int i = (int) luaL_checkinteger(L, 2);
EXCEPT_GUARD(lua_pushnumber(L, sd->getSample(i));)
luax_catchexcept(L, [&](){ lua_pushnumber(L, sd->getSample(i)); });
return 1;
}