Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 89
View file
lightspark.spec
Changed
@@ -20,7 +20,7 @@ %bcond_without rtmp Name: lightspark -Version: 0.7.2.99+git20151107.1914 +Version: 0.7.2.99+git20151206.1521 Release: 0 Summary: Modern, free, open-source flash player implementation License: LGPL-3.0+
View file
lightspark.tar.xz/src/asobject.cpp
Changed
@@ -547,6 +547,7 @@ break; } } + o->functionname = nameId; } bool ASObject::deleteVariableByMultiname(const multiname& name)
View file
lightspark.tar.xz/src/backends/decoder.cpp
Changed
@@ -752,19 +752,29 @@ 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, "in_sample_rate", frameIn->sample_rate, 0); - av_opt_set_int(avr, "out_sample_rate", frameIn->sample_rate, 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, "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], frameIn->sample_rate, frameIn->sample_rate, AV_ROUND_UP); - av_samples_alloc(&output, &out_linesize, frameIn->nb_samples, out_samples, AV_SAMPLE_FMT_S16, 0); - maxLen = avresample_convert(avr, &output, out_linesize, out_samples, frameIn->extended_data, frameIn->linesize[0], frameIn->nb_samples)*2*frameIn->channels; // 2 bytes in AV_SAMPLE_FMT_S16 - memcpy(curTail.samples, output, maxLen); - av_freep(&output); + 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 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 + memcpy(curTail.samples, output, maxLen); + av_freep(&output); + } + else + { + LOG(LOG_ERROR, "resampling failed, error code:"<<res); + 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"); @@ -826,7 +836,7 @@ #else avioContext->is_streamed=1; #endif - + //Probe the stream format. //NOTE: in FFMpeg 0.7 there is av_probe_input_buffer AVProbeData probeData;
View file
lightspark.tar.xz/src/backends/input.cpp
Changed
@@ -346,8 +346,7 @@ bool InputThread::handleKeyboardShortcuts(const GdkEventKey *keyevent) { bool handled = false; - - if ((keyevent->state & GDK_MODIFIER_MASK) != GDK_CONTROL_MASK) + if ((keyevent->state & GDK_CONTROL_MASK) != GDK_CONTROL_MASK) return handled; switch(keyevent->keyval)
View file
lightspark.tar.xz/src/backends/rendering.cpp
Changed
@@ -789,28 +789,38 @@ cairo_paint(cr); cairo_set_source_rgb(cr, 0.8, 0.8, 0.8); + int y = th->windowHeight-20; renderText(cr, "We're sorry, Lightspark encountered a yet unsupported Flash file", - 0,th->windowHeight/2+20); + 0,y); + y -= 20; stringstream errorMsg; errorMsg << "SWF file: " << th->m_sys->mainClip->getOrigin().getParsedURL(); - renderText(cr, errorMsg.str().c_str(),0,th->windowHeight/2); + renderText(cr, errorMsg.str().c_str(),0,y); + y -= 20; errorMsg.str(""); errorMsg << "Cause: " << th->m_sys->errorCause; - renderText(cr, errorMsg.str().c_str(),0,th->windowHeight/2-20); + tiny_string s = errorMsg.str(); + std::list<tiny_string> msglist = s.split('\n'); + for (auto it = msglist.begin(); it != msglist.end(); it++) + { + renderText(cr, (*it).raw_buf(),0,y); + y -= 20; + } if (standalone) { renderText(cr, "Please look at the console output to copy this error", - 0,th->windowHeight/2-40); + 0,y); + y -= 20; - renderText(cr, "Press 'Ctrl+Q' to exit",0,th->windowHeight/2-60); + renderText(cr, "Press 'Ctrl+Q' to exit",0,y); } else { renderText(cr, "Press Ctrl+C to copy this error to clipboard", - 0,th->windowHeight/2-40); + 0,y); } glUniform1f(alphaUniform, 1);
View file
lightspark.tar.xz/src/parsing/amf3_generator.cpp
Changed
@@ -555,8 +555,7 @@ case amf0_ecma_array_marker: return parseECMAArrayAMF0(stringMap,objMap,traitsMap); case amf0_strict_array_marker: - LOG(LOG_ERROR,"unimplemented marker " << (uint32_t)marker); - throw UnsupportedException("unimplemented marker"); + return parseStrictArrayAMF0(stringMap,objMap,traitsMap); case amf0_date_marker: LOG(LOG_ERROR,"unimplemented marker " << (uint32_t)marker); throw UnsupportedException("unimplemented marker"); @@ -621,6 +620,28 @@ } return ret; } +_R<ASObject> Amf3Deserializer::parseStrictArrayAMF0(std::vector<tiny_string>& stringMap, + std::vector<ASObject*>& objMap, + std::vector<TraitsRef>& traitsMap) const +{ + uint32_t count; + if(!input->readUnsignedInt(count)) + throw ParseException("Not enough data to parse AMF3 strict array"); + + _R<lightspark::Array> ret=_MR(Class<lightspark::Array>::getInstanceS()); + //Add object to the map + objMap.push_back(ret.getPtr()); + + while(count) + { + _R<ASObject> value=parseValue(stringMap, objMap, traitsMap); + value->incRef(); + ret->push(value); + count--; + } + return ret; +} + _R<ASObject> Amf3Deserializer::parseObjectAMF0(std::vector<tiny_string>& stringMap, std::vector<ASObject*>& objMap, std::vector<TraitsRef>& traitsMap) const
View file
lightspark.tar.xz/src/parsing/amf3_generator.h
Changed
@@ -120,6 +120,9 @@ _R<ASObject> parseECMAArrayAMF0(std::vector<tiny_string>& stringMap, std::vector<ASObject*>& objMap, std::vector<TraitsRef>& traitsMap) const; + _R<ASObject> parseStrictArrayAMF0(std::vector<tiny_string>& stringMap, + std::vector<ASObject*>& objMap, + std::vector<TraitsRef>& traitsMap) const; _R<ASObject> parseObjectAMF0(std::vector<tiny_string>& stringMap, std::vector<ASObject*>& objMap, std::vector<TraitsRef>& traitsMap) const;
View file
lightspark.tar.xz/src/scripting/abc.cpp
Changed
@@ -1308,7 +1308,7 @@ 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? + //ev->done.signal(); // Won't this signal twice, wrt to the signal() below? break; } case FLUSH_INVALIDATION_QUEUE: @@ -1763,7 +1763,13 @@ LOG(LOG_ERROR,_("Unhandled ActionScript exception in VM ") << e->toString()); else LOG(LOG_ERROR,_("Unhandled ActionScript exception in VM (no type)")); - th->m_sys->setError(_("Unhandled ActionScript exception")); + if (e->is<ASError>()) + { + th->m_sys->setError(e->as<ASError>()->getStackTraceString()); + LOG(LOG_ERROR,_("Unhandled ActionScript exception in VM ") << e->as<ASError>()->getStackTraceString()); + } + else + th->m_sys->setError(_("Unhandled ActionScript exception")); /* do not allow any more event to be enqueued */ th->shuttingdown = true; th->signalEventWaiters();
View file
lightspark.tar.xz/src/scripting/abc.h
Changed
@@ -545,6 +545,7 @@ /* The current recursion level. Each call increases this by one, * each return from a call decreases this. */ uint32_t cur_recursion; + std::list<std::pair<uint32_t,ASObject*> > stacktrace; struct abc_limits { /* maxmium number of recursion allowed. See ScriptLimitsTag */
View file
lightspark.tar.xz/src/scripting/flash/display/DisplayObject.cpp
Changed
@@ -410,13 +410,6 @@ ABCVm::publicHandleEvent(_MR(this),e); else getVm()->addEvent(_MR(this),e); - if (getStage()) - { - // it seems that DisplayObjects can expect a StageVideoAvailabilityEvent after - // they are added to the stage - getStage()->incRef(); - getVm()->addEvent(_MR(getStage()),_MR(Class<StageVideoAvailabilityEvent>::getInstanceS())); - } } else if(onStage==false) {
View file
lightspark.tar.xz/src/scripting/flash/display/flashdisplay.cpp
Changed
@@ -141,8 +141,11 @@ if(loadStatus==INIT_SENT || (bytesLoaded == bytesTotal)) { //The clip is also complete now - this->incRef(); - getVm()->addEvent(_MR(this),_MR(Class<Event>::getInstanceS("complete"))); + if(getVm()) + { + this->incRef(); + getVm()->addEvent(_MR(this),_MR(Class<Event>::getInstanceS("complete"))); + } loadStatus=COMPLETE; } } @@ -2165,6 +2168,17 @@ fullScreenSourceRect.reset(); } +void Stage::eventListenerAdded(const tiny_string& eventName) +{ + if (eventName == "stageVideoAvailability") + { + // StageVideoAvailabilityEvent is dispatched directly after an eventListener is added added + // see https://www.adobe.com/devnet/flashplayer/articles/stage_video.html + this->incRef(); + getVm()->addEvent(_MR(this),_MR(Class<StageVideoAvailabilityEvent>::getInstanceS())); + } +} + void Stage::buildTraits(ASObject* o) { }
View file
lightspark.tar.xz/src/scripting/flash/display/flashdisplay.h
Changed
@@ -528,6 +528,8 @@ // code) and the input thread and is protected focusSpinlock Spinlock focusSpinlock; _NR<InteractiveObject> focus; +protected: + virtual void eventListenerAdded(const tiny_string& eventName); public: _NR<DisplayObject> hitTestImpl(_NR<DisplayObject> last, number_t x, number_t y, DisplayObject::HIT_TYPE type); void setOnStage(bool staged) { assert(false); /* we are the stage */}
View file
lightspark.tar.xz/src/scripting/flash/events/flashevents.cpp
Changed
@@ -592,6 +592,7 @@ list<listener>::iterator insertionPoint=upper_bound(listeners.begin(),listeners.end(),newListener); listeners.insert(insertionPoint,newListener); } + th->eventListenerAdded(eventName); return NULL; }
View file
lightspark.tar.xz/src/scripting/flash/events/flashevents.h
Changed
@@ -257,7 +257,7 @@ { public: TimerEvent(Class_base* c):Event(c, "DEPRECATED"){} - TimerEvent(Class_base* c,const tiny_string& t):Event(c,t,true){}; + TimerEvent(Class_base* c,const tiny_string& t):Event(c,t,true){} static void sinit(Class_base*); static void buildTraits(ASObject* o) { @@ -315,7 +315,7 @@ bool use_capture; public: explicit listener(_R<IFunction> _f, int32_t _p, bool _c) - :f(_f),priority(_p),use_capture(_c){}; + :f(_f),priority(_p),use_capture(_c){} bool operator==(std::pair<IFunction*,bool> r) { /* One can register the same handle for the same event with @@ -345,6 +345,8 @@ * This will be used when a target is passed to EventDispatcher constructor */ _NR<ASObject> forcedTarget; +protected: + virtual void eventListenerAdded(const tiny_string& eventName) {} public: EventDispatcher(Class_base* c); void finalize(); @@ -353,7 +355,7 @@ void handleEvent(_R<Event> e); void dumpHandlers(); bool hasEventListener(const tiny_string& eventName); - virtual void defaultEventBehavior(_R<Event> e) {}; + virtual void defaultEventBehavior(_R<Event> e) {} ASFUNCTION(_constructor); ASFUNCTION(addEventListener); ASFUNCTION(removeEventListener); @@ -475,8 +477,8 @@ class FlushInvalidationQueueEvent: public Event { public: - FlushInvalidationQueueEvent():Event(NULL, "FlushInvalidationQueueEvent"){}; - EVENT_TYPE getEventType() const { return FLUSH_INVALIDATION_QUEUE; }; + FlushInvalidationQueueEvent():Event(NULL, "FlushInvalidationQueueEvent"){} + EVENT_TYPE getEventType() const { return FLUSH_INVALIDATION_QUEUE; } }; class ParseRPCMessageEvent: public Event @@ -486,7 +488,7 @@ _NR<ASObject> client; _NR<Responder> responder; ParseRPCMessageEvent(_R<ByteArray> ba, _NR<ASObject> client, _NR<Responder> responder); - EVENT_TYPE getEventType() const { return PARSE_RPC_MESSAGE; }; + EVENT_TYPE getEventType() const { return PARSE_RPC_MESSAGE; } void finalize(); };
View file
lightspark.tar.xz/src/scripting/flash/text/flashtext.cpp
Changed
@@ -71,7 +71,8 @@ bool enumerateDeviceFonts=false; ARG_UNPACK(enumerateDeviceFonts,false); - LOG(LOG_NOT_IMPLEMENTED,"Font::enumerateFonts: flag enumerateDeviceFonts is not handled"); + if (enumerateDeviceFonts) + LOG(LOG_NOT_IMPLEMENTED,"Font::enumerateFonts: flag enumerateDeviceFonts is not handled"); Array* ret = Class<Array>::getInstanceS(); std::vector<ASObject*>* fontlist = getFontList(); for(auto i = fontlist->begin(); i != fontlist->end(); ++i) @@ -1070,6 +1071,8 @@ } } } + else if (name == "" || name == "root" || name == "body") + return true; else if (name == "a" || name == "img" || name == "u" || name == "li" || name == "b" || name == "i" || name == "span" || name == "textformat" || name == "tab")
View file
lightspark.tar.xz/src/scripting/toplevel/Error.cpp
Changed
@@ -23,6 +23,7 @@ #include "scripting/toplevel/toplevel.h" #include "scripting/class.h" #include "scripting/argconv.h" +#include "scripting/abc.h" using namespace std; using namespace lightspark; @@ -69,24 +70,52 @@ msgtemplate++; } - + if (Log::getLevel() >= LOG_INFO) + { + tiny_string stacktrace; + for (auto it = getVm()->stacktrace.crbegin(); it != getVm()->stacktrace.crend(); it++) + { + stacktrace += " at "; + stacktrace += (*it).second->getClassName(); + stacktrace += "/"; + stacktrace += getSys()->getStringFromUniqueId((*it).first); + stacktrace += "()\n"; + } + LOG(LOG_INFO,"throwing exception:"<<errorID<<" "<<msg.str()<< "\n" << stacktrace); + } return msg.str(); } ASError::ASError(Class_base* c, const tiny_string& error_message, int id, const tiny_string& error_name): ASObject(c),errorID(id),name(error_name),message(error_message) { + stacktrace = ""; + for (auto it = getVm()->stacktrace.crbegin(); it != getVm()->stacktrace.crend(); it++) + { + stacktrace += " at "; + stacktrace += (*it).second->getClassName(); + stacktrace += "/"; + stacktrace += getSys()->getStringFromUniqueId((*it).first); + stacktrace += "()\n"; + } } -ASFUNCTIONBODY(ASError,getStackTrace) +ASFUNCTIONBODY(ASError,_getStackTrace) { ASError* th=static_cast<ASError*>(obj); - ASString* ret=Class<ASString>::getInstanceS(th->toString(true)); - LOG(LOG_NOT_IMPLEMENTED,_("Error.getStackTrace not yet implemented.")); + + ASString* ret=Class<ASString>::getInstanceS(th->getStackTraceString()); + return ret; +} +tiny_string ASError::getStackTraceString() +{ + tiny_string ret = toString(); + ret += "\n"; + ret += stacktrace; return ret; } -tiny_string ASError::toString(bool debugMsg) +tiny_string ASError::toString() { tiny_string ret; ret = name; @@ -100,7 +129,7 @@ ASFUNCTIONBODY(ASError,_toString) { ASError* th=static_cast<ASError*>(obj); - return Class<ASString>::getInstanceS(th->ASError::toString(false)); + return Class<ASString>::getInstanceS(th->ASError::toString()); } ASFUNCTIONBODY(ASError,_constructor) @@ -141,7 +170,7 @@ void ASError::sinit(Class_base* c) { CLASS_SETUP(c, ASObject, _constructor, CLASS_DYNAMIC_NOT_FINAL); - c->setDeclaredMethodByQName("getStackTrace","",Class<IFunction>::getFunction(getStackTrace),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("getStackTrace","",Class<IFunction>::getFunction(_getStackTrace),NORMAL_METHOD,true); c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(_toString),DYNAMIC_TRAIT); c->setDeclaredMethodByQName("toString","",Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true); REGISTER_GETTER(c, errorID);
View file
lightspark.tar.xz/src/scripting/toplevel/Error.h
Changed
@@ -36,13 +36,13 @@ void throwError(int errorID, const tiny_string& arg1="", const tiny_string& arg2="", const tiny_string& arg3="") { tiny_string message = createErrorMessage(errorID, arg1, arg2, arg3); - LOG(LOG_INFO,"throwing exception:"<<errorID<<" "<<message); throw Class<T>::getInstanceS(message, errorID); } class ASError: public ASObject { private: + tiny_string stacktrace; ASPROPERTY_GETTER(int32_t, errorID); ASPROPERTY_GETTER_SETTER(tiny_string, name); protected: @@ -53,11 +53,12 @@ ASError(Class_base* c, const tiny_string& error_message = "", int id = 0, const tiny_string& error_name="Error"); ASFUNCTION(_constructor); ASFUNCTION(generator); - ASFUNCTION(getStackTrace); + ASFUNCTION(_getStackTrace); ASFUNCTION(_toString); - tiny_string toString(bool debugMsg=false); + tiny_string toString(); static void sinit(Class_base* c); static void buildTraits(ASObject* o); + tiny_string getStackTraceString(); }; class SecurityError: public ASError
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.cpp
Changed
@@ -129,7 +129,7 @@ throwError<TypeError>(kConvertUndefinedToObjectError); } -IFunction::IFunction(Class_base* c):ASObject(c),length(0),inClass(NULL) +IFunction::IFunction(Class_base* c):ASObject(c),length(0),inClass(NULL),functionname(0) { type=T_FUNCTION; } @@ -451,6 +451,12 @@ cur_recursion++; //increment current recursion depth Log::calls_indent++; + + std::pair<uint32_t,ASObject*> s; + s.first = this->functionname; + s.second = obj; + + getVm()->stacktrace.push_back(s); while (true) { try @@ -504,6 +510,7 @@ { cur_recursion--; //decrement current recursion depth Log::calls_indent--; + getVm()->stacktrace.pop_back(); getVm()->currentCallContext = saved_cc; throw; } @@ -512,6 +519,7 @@ break; } cur_recursion--; //decrement current recursion depth + getVm()->stacktrace.pop_back(); Log::calls_indent--; getVm()->currentCallContext = saved_cc; @@ -1162,8 +1170,8 @@ // it seems that classes with the same name from different applicationDomains // are treated as equal, so we test for same names - if (this->getQualifiedClassName() == cls->getQualifiedClassName()) - return true; + //if (this->getQualifiedClassName() == cls->getQualifiedClassName()) + // return true; //Now check the interfaces if (considerInterfaces)
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.h
Changed
@@ -385,6 +385,7 @@ } virtual method_info* getMethodInfo() const=0; virtual ASObject *describeType() const; + uint32_t functionname; }; /*
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
.