Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 91
View file
lightspark.spec
Changed
@@ -20,7 +20,7 @@ %bcond_without rtmp Name: lightspark -Version: 0.7.2.99+git20151228.1242 +Version: 0.7.2.99+git20160105.1059 Release: 0 Summary: Modern, free, open-source flash player implementation License: LGPL-3.0+
View file
lightspark.tar.xz/README
Changed
@@ -10,12 +10,12 @@ ============ To compile this software you need to install development packages for -llvm (version 2.8 or >= 3.0), opengl, curl, zlib, libavcodec, +llvm (version 2.8 or >= 3.0), opengl, curl, zlib, libavcodec, libavresample libglew, pcre, librtmp, cairo, libboost-filesystem, gtk-2, libjpeg, libavformat, pango, liblzma If sound is enabled (on by default), you will also need the -development package for pulseaudio-libs and/or libsdl. +development package for pulseaudio-libs and/or sdl_mixer. Install also cmake, nasm and gcc (version 4.6.0 or newer) or clang
View file
lightspark.tar.xz/src/allclasses.h
Changed
@@ -97,6 +97,7 @@ REGISTER_CLASS_NAME(LoaderInfo,"flash.display") REGISTER_CLASS_NAME(MorphShape,"flash.display") REGISTER_CLASS_NAME(MovieClip,"flash.display") +REGISTER_CLASS_NAME(PixelSnapping,"flash.display") REGISTER_CLASS_NAME(Scene,"flash.display") REGISTER_CLASS_NAME(Shader,"flash.display") REGISTER_CLASS_NAME(Shape,"flash.display")
View file
lightspark.tar.xz/src/backends/audio.h
Changed
@@ -59,6 +59,8 @@ void unmuteAll() { oAudioPlugin->unmuteAll(); } void toggleMuteAll() { oAudioPlugin->toggleMuteAll(); } bool allMuted() { return oAudioPlugin->allMuted(); } + int forcedSampleRate() const { return oAudioPlugin->forcedSampleRate();} + int forcedChannelLayout() const { return oAudioPlugin->forcedChannelLayout();} ~AudioManager(); };
View file
lightspark.tar.xz/src/backends/decoder.cpp
Changed
@@ -20,6 +20,7 @@ #include "compat.h" #include <cassert> +#include "backends/audio.h" #include "backends/decoder.h" #include "platforms/fastpaths.h" #include "swf.h" @@ -647,17 +648,7 @@ } else { - if (frameIn->format != AV_SAMPLE_FMT_S16) - { - maxLen = resampleFrameToS16(curTail); - } - else - { - //This is suboptimal but equivalent to what libavcodec - //does for the compatibility version of avcodec_decode_audio3 - memcpy(curTail.samples, frameIn->extended_data[0], frameIn->linesize[0]); - maxLen=frameIn->linesize[0]; - } + maxLen = resampleFrameToS16(curTail); } #else int32_t ret=avcodec_decode_audio3(codecContext, curTail.samples, &maxLen, &pkt); @@ -706,17 +697,7 @@ } else { - if (frameIn->format != AV_SAMPLE_FMT_S16) - { - maxLen = resampleFrameToS16(curTail); - } - else - { - //This is suboptimal but equivalent to what libavcodec - //does for the compatibility version of avcodec_decode_audio3 - memcpy(curTail.samples, frameIn->extended_data[0], frameIn->linesize[0]); - maxLen=frameIn->linesize[0]; - } + maxLen = resampleFrameToS16(curTail); } #elif HAVE_AVCODEC_DECODE_AUDIO3 int ret=avcodec_decode_audio3(codecContext, curTail.samples, &maxLen, pkt); @@ -751,24 +732,33 @@ #if HAVE_AVCODEC_DECODE_AUDIO4 int FFMpegAudioDecoder::resampleFrameToS16(FrameSamples& curTail) { + int sample_rate = getSys()->audioManager->forcedSampleRate() == -1 ? codecContext->sample_rate : getSys()->audioManager->forcedSampleRate(); + uint channel_layout = getSys()->audioManager->forcedChannelLayout() == -1 ? frameIn->channel_layout : getSys()->audioManager->forcedChannelLayout(); + if(frameIn->format == AV_SAMPLE_FMT_S16 && sample_rate == codecContext->sample_rate && channel_layout == frameIn->channel_layout) + { + //This is suboptimal but equivalent to what libavcodec + //does for the compatibility version of avcodec_decode_audio3 + memcpy(curTail.samples, frameIn->extended_data[0], frameIn->linesize[0]); + return frameIn->linesize[0]; + } int maxLen; #ifdef HAVE_LIBAVRESAMPLE AVAudioResampleContext * avr = avresample_alloc_context(); av_opt_set_int(avr, "in_channel_layout", frameIn->channel_layout, 0); - av_opt_set_int(avr, "out_channel_layout", frameIn->channel_layout, 0); + av_opt_set_int(avr, "out_channel_layout", channel_layout, 0); av_opt_set_int(avr, "in_sample_rate", codecContext->sample_rate, 0); - av_opt_set_int(avr, "out_sample_rate", codecContext->sample_rate, 0); + av_opt_set_int(avr, "out_sample_rate", sample_rate, 0); av_opt_set_int(avr, "in_sample_fmt", frameIn->format, 0); av_opt_set_int(avr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); avresample_open(avr); uint8_t *output; int out_linesize; - int out_samples = avresample_available(avr) + av_rescale_rnd(avresample_get_delay(avr) + frameIn->linesize[0], codecContext->sample_rate, codecContext->sample_rate, AV_ROUND_UP); + int out_samples = avresample_available(avr) + av_rescale_rnd(avresample_get_delay(avr) + frameIn->linesize[0], sample_rate, sample_rate, AV_ROUND_UP); int res = av_samples_alloc(&output, &out_linesize, frameIn->nb_samples, out_samples, AV_SAMPLE_FMT_S16, 0); if (res >= 0) { - maxLen = avresample_convert(avr, &output, out_linesize, out_samples, frameIn->extended_data, frameIn->linesize[0], frameIn->nb_samples)*2*codecContext->channels; // 2 bytes in AV_SAMPLE_FMT_S16 + maxLen = avresample_convert(avr, &output, out_linesize, out_samples, frameIn->extended_data, frameIn->linesize[0], frameIn->nb_samples)*2*av_get_channel_layout_nb_channels(channel_layout); // 2 bytes in AV_SAMPLE_FMT_S16 memcpy(curTail.samples, output, maxLen); av_freep(&output); } @@ -778,7 +768,7 @@ memset(curTail.samples, 0, frameIn->linesize[0]); maxLen = frameIn->linesize[0]; } - + avresample_free(&avr); #else LOG(LOG_ERROR, "unexpected sample format and can't resample, recompile with libavresample"); @@ -789,7 +779,7 @@ } #endif -uint32_t FFMpegAudioDecoder::decodeStreamSomePackets(std::istream& s, uint32_t time) +uint32_t FFMpegAudioDecoder::decodeStreamSomePackets(std::istream& s, uint32_t time, IThreadJob* callingthread) { const size_t BUF_SIZE = 4096; uint32_t ret; @@ -804,6 +794,8 @@ size_t overflowSize = overflowBuffer.size(); while (overflowSize > BUF_SIZE) { + if (callingthread->threadAborting) + break; ret = decodeData(NULL, 0, time); if (overflowBuffer.size() == overflowSize) break;
View file
lightspark.tar.xz/src/backends/decoder.h
Changed
@@ -322,7 +322,7 @@ uint32_t decodePacket(AVPacket* pkt, uint32_t time); void switchCodec(LS_AUDIO_CODEC audioCodec, uint8_t* initdata, uint32_t datalen); uint32_t decodeData(uint8_t* data, int32_t datalen, uint32_t time); - uint32_t decodeStreamSomePackets(std::istream& s, uint32_t time); + uint32_t decodeStreamSomePackets(std::istream& s, uint32_t time, IThreadJob *callingthread); }; #endif
View file
lightspark.tar.xz/src/backends/geometry.cpp
Changed
@@ -94,6 +94,7 @@ unsigned int i = verticesMap.size(); verticesMap.insert(make_pair(v, i)); + verticesVector.push_back(v); return i; } @@ -158,6 +159,9 @@ const Vector2& ShapesBuilder::getVertex(unsigned int index) { + if (index < verticesVector.size()) + return verticesVector[index]; + /* //Linear lookup map<Vector2, unsigned int>::const_iterator it=verticesMap.begin(); for(;it!=verticesMap.end();++it) @@ -165,6 +169,7 @@ if(it->second==index) return it->first; } + */ ::abort(); }
View file
lightspark.tar.xz/src/backends/geometry.h
Changed
@@ -101,6 +101,8 @@ { private: std::map< Vector2, unsigned int > verticesMap; + // also add a vector of the vertices for performance + std::vector< Vector2> verticesVector; std::map< unsigned int, std::vector< std::vector<ShapePathSegment> > > filledShapesMap; std::map< unsigned int, std::vector< std::vector<ShapePathSegment> > > strokeShapesMap; void joinOutlines();
View file
lightspark.tar.xz/src/backends/interfaces/audio/IAudioPlugin.h
Changed
@@ -74,6 +74,10 @@ virtual void unmuteAll() { muteAllStreams = false; } virtual void toggleMuteAll() { muteAllStreams ? unmuteAll() : muteAll(); } virtual bool allMuted() { return muteAllStreams; } + // if not -1, all streams will be resampled to the provided sample rate + virtual int forcedSampleRate() const { return -1;} + // if not -1, all streams will be resampled to the provided channel_layout + virtual int forcedChannelLayout() const { return -1;} virtual ~IAudioPlugin(); };
View file
lightspark.tar.xz/src/backends/interfaces/audio/sdl/CMakeLists.txt
Changed
@@ -33,7 +33,9 @@ INCLUDE_DIRECTORIES("..") pkg_check_modules(SDL REQUIRED sdl) +pkg_check_modules(SDL_mixer REQUIRED) INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIRS}) +INCLUDE_DIRECTORIES(${SDL_mixer_INCLUDE_DIRS}) if(!Boost_FOUND) find_package(Boost COMPONENTS filesystem system regex) if(Boost_FOUND) @@ -47,7 +49,7 @@ # liblightsparkSDLplugin.so target ADD_LIBRARY(sdlplugin MODULE ${SDLPLUGIN_SOURCES}) TARGET_LINK_LIBRARIES(sdlplugin spark) #Need to link some functions with the decoders -TARGET_LINK_LIBRARIES(sdlplugin ${SDL_LIBRARIES} ${Boost_LIBRARIES}) +TARGET_LINK_LIBRARIES(sdlplugin ${SDL_LIBRARIES} ${SDL_mixer_LIBRARIES} ${Boost_LIBRARIES}) SET_TARGET_PROPERTIES(sdlplugin PROPERTIES OUTPUT_NAME lightsparksdlplugin) INSTALL(TARGETS sdlplugin DESTINATION ${PLUGINSDIR})
View file
lightspark.tar.xz/src/backends/interfaces/audio/sdl/SDLPlugin.cpp
Changed
@@ -1,46 +1,68 @@ /************************************************************************** - Lightspark, a free flash player implementation + Lightspark, a free flash player implementation - Copyright (C) 2011-2013 Alessandro Pignotti (a.pignotti@sssup.it) - Copyright (C) 2011 Ludger Krämer (dbluelle@blau-weissoedingen.de) + Copyright (C) 2011-2013 Alessandro Pignotti (a.pignotti@sssup.it) + Copyright (C) 2011 Ludger Krämer (dbluelle@blau-weissoedingen.de) - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. **************************************************************************/ #include "backends/interfaces/audio/sdl/SDLPlugin.h" #include <SDL.h> -#include <SDL_audio.h> using lightspark::AudioDecoder; using namespace std; +void mixer_effect_ffmpeg_cb(int chan, void * stream, int len, void * udata) +{ + SDLAudioStream *s = (SDLAudioStream*)udata; + if (!s) + return; + + if (!s->decoder->hasDecodedFrames()) + return; + uint32_t readcount = 0; + while (readcount < ((uint32_t)len)) + { + if (!s->decoder->hasDecodedFrames()) + break; + uint32_t ret = s->decoder->copyFrame((int16_t *)(((unsigned char*)stream)+readcount), ((uint32_t)len)-readcount); + if (!ret) + break; + readcount += ret; + } +} SDLPlugin::SDLPlugin(string init_Name, string init_audiobackend, bool init_stopped ) : IAudioPlugin ( init_Name, init_audiobackend, init_stopped ) { sdl_available = 0; - if (SDL_WasInit(0)) // some part of SDL already was initialized + if (SDL_WasInit(0)) // some part of SDL already was initialized sdl_available = !SDL_InitSubSystem ( SDL_INIT_AUDIO ); else sdl_available = !SDL_Init ( SDL_INIT_AUDIO ); - - /* We use SDL_OpenAudio/SDL_CloseAudio in SDLAudioStream's constructor/destructor - * to access the device directly. We _should_ use SDL_mixer instead. - */ - LOG(LOG_NOT_IMPLEMENTED,"The SDL audio plugin does only support one concurrent stream!"); + if (Mix_OpenAudio (LIGHTSPARK_AUDIO_SDL_SAMPLERATE, AUDIO_S16, 2, LIGHTSPARK_AUDIO_SDL_BUFERSIZE) < 0) + { + LOG(LOG_ERROR,"Couldn't open SDL_mixer"); + sdl_available = 0; + SDL_QuitSubSystem ( SDL_INIT_AUDIO ); + if (!SDL_WasInit(0)) + SDL_Quit (); + return; + } + Mix_Pause(-1); } - void SDLPlugin::set_device(std::string desiredDevice, IAudioPlugin::DEVICE_TYPES desiredType) { @@ -52,17 +74,19 @@ if (!sdl_available) return NULL; - SDLAudioStream *stream = new SDLAudioStream(this); - stream->decoder = decoder; - if (!stream->init()) - { + SDLAudioStream *stream = new SDLAudioStream(this); + stream->decoder = decoder; + if (!stream->init()) + { delete stream; return NULL; - } - streams.push_back(stream); - return stream; + } + streams.push_back(stream); + + return stream; } + SDLPlugin::~SDLPlugin() { for (stream_iterator it = streams.begin(); it != streams.end(); ++it) { @@ -70,6 +94,7 @@ } if (sdl_available) { + Mix_CloseAudio(); SDL_QuitSubSystem ( SDL_INIT_AUDIO ); if (!SDL_WasInit(0)) SDL_Quit (); @@ -111,47 +136,24 @@ return ret; } -bool SDLAudioStream::init() +bool SDLAudioStream::init() { - SDL_AudioSpec fmt; - fmt.freq = decoder->sampleRate; - fmt.format = AUDIO_S16; - fmt.channels = decoder->channelCount; - fmt.samples = 4096; - fmt.callback = async_callback; - fmt.userdata = this; - if ( SDL_OpenAudio(&fmt, NULL) < 0 ) { - LOG(LOG_ERROR, "Unable to open SDL audio:" << SDL_GetError()); - return false; - } unmutevolume = curvolume = SDL_MIX_MAXVOLUME; playedtime = 0; gettimeofday(&starttime, NULL); - SDL_PauseAudio(0); - return true; -} -void SDLAudioStream::async_callback(void *unused, uint8_t *stream, int len) -{ - SDLAudioStream *s = static_cast<SDLAudioStream*>(unused); + mixer_channel = -1; - if (!s->decoder->hasDecodedFrames()) - return; + uint32_t len = LIGHTSPARK_AUDIO_SDL_BUFERSIZE; uint8_t *buf = new uint8_t[len]; - int readcount = 0; - while (readcount < len) - { - if (!s->decoder->hasDecodedFrames()) - break; - uint32_t ret = s->decoder->copyFrame((int16_t *)(buf+readcount), len-readcount); - if (!ret) - break; - readcount += ret; - } - SDL_LockAudio(); - SDL_MixAudio(stream, buf, readcount, s->curvolume); - SDL_UnlockAudio(); - delete[] buf; + memset(buf,0,len); + Mix_Chunk* chunk = Mix_QuickLoad_RAW(buf, len); + + + mixer_channel = Mix_PlayChannel(-1, chunk, -1); + Mix_RegisterEffect(mixer_channel, mixer_effect_ffmpeg_cb, NULL, this); + Mix_Resume(mixer_channel); + return true; } void SDLAudioStream::SetPause(bool pause_on) @@ -159,12 +161,15 @@ if (pause_on) { playedtime = getPlayedTime(); + if (mixer_channel != -1) + Mix_Pause(mixer_channel); } else { gettimeofday(&starttime, NULL); + if (mixer_channel != -1) + Mix_Resume(mixer_channel); } - SDL_PauseAudio(pause_on); }
View file
lightspark.tar.xz/src/backends/interfaces/audio/sdl/SDLPlugin.h
Changed
@@ -1,21 +1,21 @@ /************************************************************************** - Lightspark, a free flash player implementation + Lightspark, a free flash player implementation - Copyright (C) 2011-2013 Alessandro Pignotti (a.pignotti@sssup.it) - Copyright (C) 2011 Ludger Krämer (dbluelle@blau-weissoedingen.de) + Copyright (C) 2011-2013 Alessandro Pignotti (a.pignotti@sssup.it) + Copyright (C) 2011 Ludger Krämer (dbluelle@blau-weissoedingen.de) - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. **************************************************************************/ #ifndef BACKENDS_INTERFACES_AUDIO_SDL_SDLPLUGIN_H @@ -25,9 +25,13 @@ #include "backends/decoder.h" #include "compat.h" #include <sys/time.h> +#include <SDL/SDL_mixer.h> using lightspark::AudioDecoder; +#define LIGHTSPARK_AUDIO_SDL_BUFERSIZE 4096 +#define LIGHTSPARK_AUDIO_SDL_SAMPLERATE 44100 + class SDLAudioStream; class SDLPlugin : public IAudioPlugin @@ -45,6 +49,8 @@ void muteAll(); void unmuteAll(); + int forcedSampleRate() const { return LIGHTSPARK_AUDIO_SDL_SAMPLERATE;} + int forcedChannelLayout() const { return AV_CH_LAYOUT_STEREO;} bool isTimingAvailable() const; ~SDLPlugin(); @@ -58,9 +64,9 @@ int unmutevolume; uint32_t playedtime; struct timeval starttime; - static void async_callback(void *unused, uint8_t *stream, int len); + int mixer_channel; public: - bool init(); + bool init(); SDLAudioStream(SDLPlugin* _manager) : manager(_manager) { } void SetPause(bool pause_on);
View file
lightspark.tar.xz/src/parsing/tags.cpp
Changed
@@ -1459,7 +1459,8 @@ Sprite* spr = Class<Sprite>::getInstanceS(); spr->insertLegacyChildAt(curDepth[j],states[j]); states[j] = spr; - spr->name = "Button_spr"; + //spr->name = "Button_spr"; + spr->name = ""; } Sprite* spr = Class<Sprite>::cast(states[j]); spr->insertLegacyChildAt(i->PlaceDepth,state);
View file
lightspark.tar.xz/src/scripting/abc.cpp
Changed
@@ -326,6 +326,7 @@ builtin->registerBuiltin("AVM1Movie","flash.display",Class<AVM1Movie>::getRef()); builtin->registerBuiltin("Shader","flash.display",Class<Shader>::getRef()); builtin->registerBuiltin("BitmapDataChannel","flash.display",Class<BitmapDataChannel>::getRef()); + builtin->registerBuiltin("PixelSnapping","flash.display",Class<PixelSnapping>::getRef()); builtin->registerBuiltin("BitmapFilter","flash.filters",Class<BitmapFilter>::getRef()); builtin->registerBuiltin("BitmapFilterQuality","flash.filters",Class<BitmapFilterQuality>::getRef()); @@ -1305,7 +1306,7 @@ } case ADVANCE_FRAME: { - AdvanceFrameEvent* ev=static_cast<AdvanceFrameEvent*>(e.second.getPtr()); + //AdvanceFrameEvent* ev=static_cast<AdvanceFrameEvent*>(e.second.getPtr()); LOG(LOG_CALLS,"ADVANCE_FRAME"); m_sys->mainClip->getStage()->advanceFrame(); //ev->done.signal(); // Won't this signal twice, wrt to the signal() below? @@ -2170,6 +2171,18 @@ { MemoryAccount* memoryAccount = getSys()->allocateMemoryAccount(className.name); Class_inherit* c=new (getSys()->unaccountedMemory) Class_inherit(className, memoryAccount); + + if(instances[t->classi].supername) + { + // set superclass for classes that are not instantiated by newClass opcode (e.g. buttons) + multiname mnsuper = *getMultiname(instances[t->classi].supername,NULL); + ASObject* superclass=root->applicationDomain->getVariableByMultinameOpportunistic(mnsuper); + if(superclass && superclass->is<Class_base>()) + { + superclass->incRef(); + c->setSuper(_MR(superclass->as<Class_base>())); + } + } root->applicationDomain->classesBeingDefined.insert(make_pair(mname, c)); ret=c; }
View file
lightspark.tar.xz/src/scripting/abc_opcodes.cpp
Changed
@@ -307,7 +307,7 @@ ASObject* obj=th->runtime_stack_pop(); checkDeclaredTraits(obj); - + if(obj->is<Null>()) { LOG(LOG_ERROR,"trying to call property on null:"<<*name); @@ -397,19 +397,35 @@ return; } } - obj->decRef(); for(int i=0;i<m;i++) args[i]->decRef(); //LOG(LOG_NOT_IMPLEMENTED,"callProperty: " << name->qualifiedString() << " not found on " << obj->toDebugString()); if (obj->hasPropertyByMultiname(*name,true,true)) - throwError<ReferenceError>(kWriteOnlyError, name->normalizedName(), obj->getClass()->getQualifiedClassName()); + { + tiny_string clsname = obj->getClass()->getQualifiedClassName(); + obj->decRef(); + throwError<ReferenceError>(kWriteOnlyError, name->normalizedName(), clsname); + } if (obj->getClass() && obj->getClass()->isSealed) - throwError<ReferenceError>(kReadSealedError, name->normalizedName(), obj->getClass()->getQualifiedClassName()); + { + tiny_string clsname = obj->getClass()->getQualifiedClassName(); + obj->decRef(); + throwError<ReferenceError>(kReadSealedError, name->normalizedName(), clsname); + } if (obj->is<Class_base>()) - throwError<TypeError>(kCallNotFoundError, name->qualifiedString(), obj->as<Class_base>()->class_name.getQualifiedName()); + { + tiny_string clsname = obj->as<Class_base>()->class_name.getQualifiedName(); + obj->decRef(); + throwError<TypeError>(kCallNotFoundError, name->qualifiedString(), clsname); + } else - throwError<TypeError>(kCallNotFoundError, name->qualifiedString(), obj->getClassName()); + { + tiny_string clsname = obj->getClassName(); + obj->decRef(); + throwError<TypeError>(kCallNotFoundError, name->qualifiedString(), clsname); + } + obj->decRef(); if(keepReturn) th->runtime_stack_push(getSys()->getUndefinedRef()); @@ -1421,7 +1437,7 @@ if(o==NULL) { LOG(LOG_NOT_IMPLEMENTED,"getLex: " << *name<< " not found"); - throwError<ReferenceError>(kUndefinedVarError); + throwError<ReferenceError>(kUndefinedVarError,name->normalizedNameUnresolved()); th->runtime_stack_push(getSys()->getUndefinedRef()); name->resetNameIfObject(); return;
View file
lightspark.tar.xz/src/scripting/class.cpp
Changed
@@ -96,6 +96,9 @@ void Class_inherit::buildInstanceTraits(ASObject* o) const { + if (class_index == -1 && o->getClass()->is<Class_inherit>() && o->getClass()->as<Class_inherit>()->isBinded()) + return; + assert_and_throw(class_index!=-1); //The class is declared in the script and has an index LOG(LOG_CALLS,_("Building instance traits"));
View file
lightspark.tar.xz/src/scripting/flash/display/flashdisplay.cpp
Changed
@@ -344,12 +344,15 @@ if(cache->hasFailed()) //Check to see if the download failed for some reason { LOG(LOG_ERROR, "Loader::execute(): Download of URL failed: " << url); + loaderInfo->incRef(); getVm()->addEvent(loaderInfo,_MR(Class<IOErrorEvent>::getInstanceS())); + loader->incRef(); getVm()->addEvent(loader,_MR(Class<IOErrorEvent>::getInstanceS())); delete sbuf; // downloader will be deleted in jobFence return; } + loaderInfo->incRef(); getVm()->addEvent(loaderInfo,_MR(Class<Event>::getInstanceS("open"))); } else if(source==BYTES) @@ -386,7 +389,10 @@ { // The stream did not contain RootMovieClip or Bitmap if(!threadAborting) + { + loaderInfo->incRef(); getVm()->addEvent(loaderInfo,_MR(Class<IOErrorEvent>::getInstanceS())); + } return; } } @@ -591,6 +597,7 @@ if(loaded) { + contentLoaderInfo->incRef(); getVm()->addEvent(contentLoaderInfo,_MR(Class<Event>::getInstanceS("unload"))); loaded=false; } @@ -1286,6 +1293,11 @@ assert_and_throw(th->state.FP<th->getFramesLoaded()); th->state.next_FP = th->state.FP+1; th->state.explicit_FP=true; + if (!th->getParent()) + { + th->advanceFrame(); + th->initFrame(); + } return NULL; } @@ -1295,6 +1307,11 @@ assert_and_throw(th->state.FP<th->getFramesLoaded()); th->state.next_FP = th->state.FP-1; th->state.explicit_FP=true; + if (!th->getParent()) + { + th->advanceFrame(); + th->initFrame(); + } return NULL; } @@ -1801,6 +1818,7 @@ th->_addChildAt(d,index); //Notify the object + d->incRef(); getVm()->addEvent(d,_MR(Class<Event>::getInstanceS("added"))); //incRef again as the value is getting returned @@ -1826,6 +1844,7 @@ th->_addChildAt(d,numeric_limits<unsigned int>::max()); //Notify the object + d->incRef(); getVm()->addEvent(d,_MR(Class<Event>::getInstanceS("added"))); d->incRef(); @@ -2530,6 +2549,8 @@ CLASS_SETUP(c, DisplayObject, _constructor, CLASS_SEALED); REGISTER_GETTER_SETTER(c,bitmapData); REGISTER_GETTER_SETTER(c,smoothing); + REGISTER_GETTER_SETTER(c,pixelSnapping); + } ASFUNCTIONBODY(Bitmap,_constructor) @@ -2542,7 +2563,8 @@ DisplayObject::_constructor(obj,NULL,0); if(_pixelSnapping!="auto") - LOG(LOG_NOT_IMPLEMENTED, "Bitmap constructor doesn't support pixelSnapping"); + LOG(LOG_NOT_IMPLEMENTED, "Bitmap constructor doesn't support pixelSnapping:"<<_pixelSnapping); + th->pixelSnapping = _pixelSnapping; if(!_bitmapData.isNull()) { @@ -2568,8 +2590,16 @@ updatedData(); } +void Bitmap::onPixelSnappingChanged(tiny_string snapping) +{ + if(snapping!="auto") + LOG(LOG_NOT_IMPLEMENTED, "Bitmap doesn't support pixelSnapping:"<<snapping); + pixelSnapping = snapping; +} + ASFUNCTIONBODY_GETTER_SETTER_CB(Bitmap,bitmapData,onBitmapData); ASFUNCTIONBODY_GETTER_SETTER_CB(Bitmap,smoothing,onSmoothingChanged); +ASFUNCTIONBODY_GETTER_SETTER_CB(Bitmap,pixelSnapping,onPixelSnappingChanged); void Bitmap::updatedData() { @@ -2924,6 +2954,15 @@ c->setVariableByQName("NON_ZERO","",Class<ASString>::getInstanceS("nonZero"),CONSTANT_TRAIT); } +void PixelSnapping::sinit(Class_base* c) +{ + CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); + c->setVariableByQName("ALWAYS","",Class<ASString>::getInstanceS("always"),CONSTANT_TRAIT); + c->setVariableByQName("AUTO","",Class<ASString>::getInstanceS("auto"),CONSTANT_TRAIT); + c->setVariableByQName("NEVER","",Class<ASString>::getInstanceS("never"),CONSTANT_TRAIT); + +} + /* Go through the hierarchy and add all * legacy objects which are new in the current * frame top-down. At the same time, call their
View file
lightspark.tar.xz/src/scripting/flash/display/flashdisplay.h
Changed
@@ -661,18 +661,27 @@ IntSize(uint32_t w, uint32_t h):width(h),height(h){} }; +class PixelSnapping: public ASObject +{ +public: + PixelSnapping(Class_base* c):ASObject(c){} + static void sinit(Class_base* c); +}; + class Bitmap: public DisplayObject, public TokenContainer { friend class CairoTokenRenderer; private: void onBitmapData(_NR<BitmapData>); void onSmoothingChanged(bool); + void onPixelSnappingChanged(tiny_string snapping); protected: void renderImpl(RenderContext& ctxt) const { TokenContainer::renderImpl(ctxt); } public: ASPROPERTY_GETTER_SETTER(_NR<BitmapData>,bitmapData); ASPROPERTY_GETTER_SETTER(bool, smoothing); + ASPROPERTY_GETTER_SETTER(tiny_string,pixelSnapping); /* Call this after updating any member of 'data' */ void updatedData(); Bitmap(Class_base* c, _NR<LoaderInfo> li=NullRef, std::istream *s = NULL, FILE_TYPE type=FT_UNKNOWN);
View file
lightspark.tar.xz/src/scripting/flash/media/flashmedia.cpp
Changed
@@ -566,7 +566,7 @@ istream stream(sbuf); do { - decoder->decodeStreamSomePackets(stream, 0); + decoder->decodeStreamSomePackets(stream, 0,this); if (decoder->isValid() && (audioStream == NULL)) audioStream=getSys()->audioManager->createStreamPlugin(decoder); } @@ -575,7 +575,7 @@ decoder->setFlushing(); decoder->waitFlushed(); sleep(1); - + delete audioStream; delete decoder; delete sbuf;
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.