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.
Changes of Revision 130
lightspark.spec
Changed
x
1
2
%bcond_without librtmp
3
4
Name: lightspark
5
-Version: 0.7.2.99+git20161230.0848
6
+Version: 0.7.2.99+git20170104.1157
7
Release: 0
8
Summary: Modern, free, open-source flash player implementation
9
License: LGPL-3.0+
10
lightspark.tar.xz/src/CMakeLists.txt
Changed
10
1
2
ENDIF()
3
4
PACK_EXECUTABLE(lightspark)
5
- INSTALL(FILES ${PROJECT_SOURCE_DIR}/src/lightspark.frag DESTINATION ${LSDATADIR})
6
- INSTALL(FILES ${PROJECT_SOURCE_DIR}/src/lightspark.vert DESTINATION ${LSDATADIR})
7
INSTALL(TARGETS lightspark RUNTIME DESTINATION ${BINDIR})
8
IF(UNIX)
9
INSTALL(FILES ${PROJECT_SOURCE_DIR}/docs/man/lightspark.1 DESTINATION ${MANUAL_DIRECTORY}/man1/)
10
lightspark.tar.xz/src/backends/audio.cpp
Changed
19
1
2
AudioManager::AudioManager():muteAllStreams(false),sdl_available(0),mixeropened(0)
3
{
4
sdl_available = 0;
5
- if (SDL_WasInit(0)) // some part of SDL already was initialized
6
- sdl_available = !SDL_InitSubSystem ( SDL_INIT_AUDIO );
7
- else
8
- sdl_available = !SDL_Init ( SDL_INIT_AUDIO );
9
+ if (EngineData::sdl_needinit)
10
+ {
11
+ if (SDL_WasInit(0)) // some part of SDL already was initialized
12
+ sdl_available = !SDL_InitSubSystem ( SDL_INIT_AUDIO );
13
+ else
14
+ sdl_available = !SDL_Init ( SDL_INIT_AUDIO );
15
+ }
16
mixeropened = 0;
17
}
18
void AudioManager::muteAll()
19
lightspark.tar.xz/src/backends/config.cpp
Changed
34
1
2
#endif
3
4
//If cache dir doesn't exist, create it
5
- path cacheDirectoryP(cacheDirectory);
6
- if(!is_directory(cacheDirectoryP))
7
+ try
8
{
9
- LOG(LOG_INFO, "Cache directory does not exist, trying to create");
10
- try
11
+ path cacheDirectoryP(cacheDirectory);
12
+ if(!is_directory(cacheDirectoryP))
13
{
14
- create_directories(cacheDirectoryP);
15
- }
16
- catch(const filesystem_error& e)
17
- {
18
- LOG(LOG_INFO, _("Could not create cache directory, falling back to default cache directory: ") <<
19
- defaultCacheDirectory);
20
- cacheDirectory = defaultCacheDirectory;
21
+ LOG(LOG_INFO, "Cache directory does not exist, trying to create");
22
+ create_directories(cacheDirectoryP);
23
}
24
}
25
+ catch(const filesystem_error& e)
26
+ {
27
+ LOG(LOG_INFO, _("Could not create cache directory, falling back to default cache directory: ") <<
28
+ defaultCacheDirectory);
29
+ cacheDirectory = defaultCacheDirectory;
30
+ }
31
32
#ifdef _WIN32
33
std::string regGnashPath = readRegistryEntry("GnashPath");
34
lightspark.tar.xz/src/backends/decoder.cpp
Changed
27
1
2
//NOTE: in FFMpeg 0.7 there is av_probe_input_buffer
3
AVProbeData probeData;
4
probeData.filename="lightspark_stream";
5
+ probeData.mime_type=NULL;
6
probeData.buf=new uint8_t[8192+AVPROBE_PADDING_SIZE];
7
memset(probeData.buf,0,8192+AVPROBE_PADDING_SIZE);
8
stream.read((char*)probeData.buf,8192);
9
10
if(read!=8192)
11
LOG(LOG_ERROR,"Not sufficient data is available from the stream:"<<read);
12
probeData.buf_size=read;
13
-
14
+
15
stream.seekg(0);
16
fmt=av_probe_input_format(&probeData,1);
17
delete[] probeData.buf;
18
19
20
if(audioFound)
21
{
22
- if (format)
23
+ if (format && (format->codec != LS_AUDIO_CODEC::CODEC_NONE))
24
customAudioDecoder=new FFMpegAudioDecoder(format->codec,format->sampleRate,format->channels,true);
25
else
26
#if LIBAVFORMAT_VERSION_MAJOR > 56
27
lightspark.tar.xz/src/backends/extscriptobject.cpp
Changed
13
1
2
if(!synchronous)
3
{
4
func->incRef();
5
- funcEvent = _MR(new (getSys()->unaccountedMemory) ExternalCallEvent(_MR(func), asArgs, argc, &result, &exceptionThrown, &exception));
6
+ funcEvent = _MR(new (func->getSystemState()->unaccountedMemory) ExternalCallEvent(_MR(func), asArgs, argc, &result, &exceptionThrown, &exception));
7
// Add the callback function event to the VM event queue
8
- funcWasCalled=getVm(getSys())->addEvent(NullRef,funcEvent);
9
+ funcWasCalled=getVm(func->getSystemState())->addEvent(NullRef,funcEvent);
10
if(!funcWasCalled)
11
funcEvent = NullRef;
12
}
13
lightspark.tar.xz/src/backends/rendering.cpp
Changed
41
1
2
//Create render program
3
uint32_t f = engineData->exec_glCreateShader_GL_FRAGMENT_SHADER();
4
5
- const char *fs = NULL;
6
- fs = dataFileRead("lightspark.frag");
7
- if(fs==NULL)
8
- {
9
- LOG(LOG_ERROR,_("Shader lightspark.frag not found"));
10
- throw RunTimeException("Fragment shader code not found");
11
- }
12
+ // directly include shader source to avoid filesystem access
13
+ const char *fs =
14
+#include "lightspark.frag"
15
+;
16
engineData->exec_glShaderSource(f, 1, &fs,NULL);
17
- free((void*)fs);
18
uint32_t g = engineData->exec_glCreateShader_GL_VERTEX_SHADER();
19
20
bool ret=true;
21
22
throw RunTimeException("Could not compile fragment shader");
23
}
24
25
- fs = dataFileRead("lightspark.vert");
26
- if(fs==NULL)
27
- {
28
- LOG(LOG_ERROR,_("Shader lightspark.vert not found"));
29
- throw RunTimeException("Vertex shader code not found");
30
- }
31
- engineData->exec_glShaderSource(g, 1, &fs,NULL);
32
- free((void*)fs);
33
+ // directly include shader source to avoid filesystem access
34
+ const char *fs2 =
35
+#include "lightspark.vert"
36
+;
37
+ engineData->exec_glShaderSource(g, 1, &fs2,NULL);
38
39
engineData->exec_glGetShaderInfoLog(g,1024,&a,str);
40
LOG(LOG_INFO,_("Vertex shader compilation ") << str);
41
lightspark.tar.xz/src/backends/streamcache.cpp
Changed
21
1
2
3
handleAppend(buffer, length);
4
5
- if (notifyLoader)
6
{
7
Locker locker(stateMutex);
8
receivedLength += length;
9
10
return new MemoryStreamCache::Reader(_MR(this));
11
}
12
13
+void MemoryStreamCache::openForWriting()
14
+{
15
+ LOG(LOG_ERROR,"openForWriting not implemented in MemoryStreamCache");
16
+}
17
+
18
MemoryStreamCache::Reader::Reader(_R<MemoryStreamCache> b) :
19
buffer(b), chunkIndex(0), chunkStartOffset(0)
20
{
21
lightspark.tar.xz/src/backends/streamcache.h
Changed
37
1
2
*/
3
class DLL_PUBLIC StreamCache : public RefCountable {
4
protected:
5
- StreamCache() DLL_LOCAL;
6
+ StreamCache();
7
8
// stateMutex must be held while receivedLength, failed or
9
// terminated are accessed
10
11
12
// Wait until more than currentOffset bytes has been received
13
// or until terminated
14
- void waitForData(size_t currentOffset) DLL_LOCAL;
15
+ void waitForData(size_t currentOffset);
16
17
// Derived class implements this to store received data
18
virtual void handleAppend(const unsigned char* buffer, size_t length)=0;
19
20
// thread). Every call returns a new, independent streambuf.
21
// The caller must delete the returned value.
22
virtual std::streambuf *createReader()=0;
23
+
24
+ virtual void openForWriting() = 0;
25
};
26
27
class MemoryChunk;
28
29
virtual void reserve(size_t expectedLength);
30
31
virtual std::streambuf *createReader();
32
+
33
+ void openForWriting();
34
};
35
36
/*
37
lightspark.tar.xz/src/lightspark.frag
Changed
11
1
2
+R"(
3
#ifdef GL_ES
4
precision highp float;
5
#endif
6
7
gl_FragColor=(vbase*(1.0-yuv))+(val*yuv);
8
}
9
}
10
+)"
11
lightspark.tar.xz/src/lightspark.vert
Changed
11
1
2
+R"(
3
attribute vec4 ls_Color;
4
attribute vec2 ls_Vertex;
5
attribute vec2 ls_TexCoord;
6
7
ls_TexCoords[0]=vec4(ls_TexCoord, 0, 1);
8
ls_TexCoords[1]=t;
9
}
10
+)"
11
lightspark.tar.xz/src/platforms/engineutils.cpp
Changed
44
1
2
uint32_t EngineData::userevent = (uint32_t)-1;
3
Thread* EngineData::mainLoopThread = NULL;
4
bool EngineData::mainthread_running = false;
5
+bool EngineData::sdl_needinit = true;
6
Semaphore EngineData::mainthread_initialized(0);
7
EngineData::EngineData() : currentPixelBuffer(0),currentPixelBufferOffset(0),currentPixelBufPtr(NULL),pixelBufferWidth(0),pixelBufferHeight(0),widget(0), width(0), height(0),needrenderthread(true),windowID(0),visual(0)
8
{
9
10
/* main loop handling */
11
static void mainloop_runner()
12
{
13
- bool sdl_available = false;
14
- if (SDL_WasInit(0)) // some part of SDL already was initialized
15
- sdl_available = SDL_InitSubSystem ( SDL_INIT_VIDEO );
16
- else
17
- sdl_available = SDL_Init ( SDL_INIT_VIDEO );
18
- if (sdl_available)
19
+ bool sdl_available = !EngineData::sdl_needinit;
20
+
21
+ if (EngineData::sdl_needinit)
22
+ {
23
+ if (SDL_WasInit(0)) // some part of SDL already was initialized
24
+ sdl_available = !SDL_InitSubSystem ( SDL_INIT_VIDEO );
25
+ else
26
+ sdl_available = !SDL_Init ( SDL_INIT_VIDEO );
27
+ }
28
+ if (!sdl_available)
29
{
30
LOG(LOG_ERROR,"Unable to initialize SDL:"<<SDL_GetError());
31
EngineData::mainthread_initialized.signal();
32
33
LOG(LOG_ERROR, "copying text to clipboard failed:"<<SDL_GetError());
34
}
35
36
+StreamCache *EngineData::createFileStreamCache()
37
+{
38
+ return new FileStreamCache();
39
+}
40
+
41
bool EngineData::getGLError(uint32_t &errorCode) const
42
{
43
errorCode=glGetError();
44
lightspark.tar.xz/src/platforms/engineutils.h
Changed
35
1
2
#define LS_USEREVENT_EXEC EngineData::userevent+1
3
#define LS_USEREVENT_QUIT EngineData::userevent+2
4
class SystemState;
5
+class StreamCache;
6
+
7
class DLL_PUBLIC EngineData
8
{
9
friend class RenderThread;
10
11
/* you may not call getWindowForGnash and showWindow on the same EngineData! */
12
virtual uint32_t getWindowForGnash()=0;
13
/* Runs 'func' in the mainLoopThread */
14
- static void runInMainThread(void (*func) (SystemState*) )
15
+ virtual void runInMainThread(SystemState* sys, void (*func) (SystemState*) )
16
{
17
SDL_Event event;
18
SDL_zero(event);
19
20
virtual void grabFocus()=0;
21
virtual void openPageInBrowser(const tiny_string& url, const tiny_string& window)=0;
22
23
+ static bool sdl_needinit;
24
static bool mainthread_running;
25
static Semaphore mainthread_initialized;
26
static bool startSDLMain();
27
28
virtual void setClipboardText(const std::string txt);
29
virtual bool getScreenData(SDL_DisplayMode* screen) = 0;
30
virtual double getScreenDPI() = 0;
31
+ virtual StreamCache* createFileStreamCache();
32
33
virtual void SwapBuffers() = 0;
34
virtual void InitOpenGL() = 0;
35
lightspark.tar.xz/src/plugin_ppapi/plugin.cpp
Changed
201
1
2
3
4
// TODO
5
-// - download
6
// - sound
7
-// - run within sandbox
8
+// - font loading
9
// - register as separate plugin
10
11
#include "version.h"
12
13
#include <algorithm>
14
#include <SDL2/SDL.h>
15
#include "threading.h"
16
-#include "scripting/toplevel/JSON.h"
17
#include "plugin_ppapi/plugin.h"
18
#include "plugin_ppapi/ppextscriptobject.h"
19
20
21
#include "ppapi/c/ppb_graphics_3d.h"
22
#include "ppapi/c/ppb_input_event.h"
23
#include "ppapi/c/private/ppb_flash_clipboard.h"
24
+#include "ppapi/c/ppb_file_io.h"
25
+#include "ppapi/c/ppb_file_ref.h"
26
+#include "ppapi/c/ppb_file_system.h"
27
+
28
#include "GLES2/gl2.h"
29
30
//The interpretation of texture data change with the endianness
31
32
static const PPB_KeyboardInputEvent* g_keyboardinputevent_interface = NULL;
33
static const PPB_WheelInputEvent* g_wheelinputevent_interface = NULL;
34
static const PPB_Flash_Clipboard* g_flashclipboard_interface = NULL;
35
+static const PPB_FileIO* g_fileio_interface = NULL;
36
+static const PPB_FileRef* g_fileref_interface = NULL;
37
+static const PPB_FileSystem* g_filesystem_interface = NULL;
38
+
39
+
40
+
41
+ppFileStreamCache::ppFileStreamCache(ppPluginInstance* instance):cache(0),cacheref(0),writeoffset(0),m_instance(instance)
42
+{
43
+}
44
+
45
+ppFileStreamCache::~ppFileStreamCache()
46
+{
47
+ if (cache != 0)
48
+ {
49
+ g_fileio_interface->Close(cache);
50
+ g_fileref_interface->Delete(cacheref,PP_MakeCompletionCallback(NULL,NULL));
51
+ }
52
+}
53
+
54
+void ppFileStreamCache::handleAppend(const unsigned char* buffer, size_t length)
55
+{
56
+ if (cache == 0)
57
+ openCache();
58
+
59
+ int written = g_fileio_interface->Write(cache,writeoffset,(const char*)buffer,length,PP_MakeCompletionCallback(NULL,NULL));
60
+ if (written < 0)
61
+ {
62
+ LOG(LOG_ERROR,"writing cache file failed, error code:"<<written);
63
+ return;
64
+ }
65
+ writeoffset += written;
66
+}
67
+
68
+/**
69
+ * \brief Creates & opens a temporary cache file
70
+ *
71
+ * Creates a temporary cache file in /tmp and calls \c openExistingCache() with that file.
72
+ * Waits for mutex at start and releases mutex when finished.
73
+ * \throw RunTimeException Temporary file could not be created
74
+ * \throw RunTimeException Called when the cache is already open
75
+ * \see Downloader::openExistingCache()
76
+ */
77
+void ppFileStreamCache::openCache()
78
+{
79
+ if (cache != 0)
80
+ {
81
+ markFinished(true);
82
+ throw RunTimeException("ppFileStreamCache::openCache called twice");
83
+ }
84
+
85
+ //Create a temporary file(name)
86
+
87
+ cacheref = m_instance->createCacheFileRef();
88
+ cache = g_fileio_interface->Create(m_instance->getFileSystem());
89
+ int res = g_fileio_interface->Open(cache,cacheref,PP_FileOpenFlags::PP_FILEOPENFLAG_READ|PP_FileOpenFlags::PP_FILEOPENFLAG_WRITE,PP_MakeCompletionCallback(NULL,NULL));
90
+ if (res != PP_OK)
91
+ {
92
+ LOG(LOG_ERROR,"opening cache file failed, error code:"<<res);
93
+ cache = 0;
94
+ }
95
+
96
+}
97
+
98
+void ppFileStreamCache::openForWriting()
99
+{
100
+ if (cache != 0)
101
+ return;
102
+ openCache();
103
+}
104
+
105
+bool ppFileStreamCache::waitForCache()
106
+{
107
+ if (cache != 0)
108
+ return true;
109
+
110
+ // Cache file will be opened when the first byte is received
111
+ waitForData(0);
112
113
+ return cache != 0;
114
+}
115
+
116
+std::streambuf *ppFileStreamCache::createReader()
117
+{
118
+ if (!waitForCache())
119
+ {
120
+ LOG(LOG_ERROR,"could not open cache file");
121
+ return NULL;
122
+ }
123
+
124
+ incRef();
125
+ ppFileStreamCache::ppFileStreamCacheReader *fbuf = new ppFileStreamCache::ppFileStreamCacheReader(_MR(this));
126
+ return fbuf;
127
+}
128
+
129
+ppFileStreamCache::ppFileStreamCacheReader::ppFileStreamCacheReader(_R<ppFileStreamCache> b) : curpos(-1),buffer(b)
130
+{
131
+}
132
+
133
+int ppFileStreamCache::ppFileStreamCacheReader::underflow()
134
+{
135
+ if (!buffer->hasTerminated())
136
+ buffer->waitForData(seekoff(0, ios_base::cur, ios_base::in));
137
+
138
+ return streambuf::underflow();
139
+}
140
+
141
+streamsize ppFileStreamCache::ppFileStreamCacheReader::xsgetn(char* s, streamsize n)
142
+{
143
+ streamsize read= g_fileio_interface->Read(buffer->cache,curpos,s,n,PP_MakeCompletionCallback(NULL,NULL));
144
+ curpos += read;
145
+ // If not enough data was available, wait for writer
146
+ while (read < n)
147
+ {
148
+ buffer->waitForData(seekoff(0, ios_base::cur, ios_base::in));
149
+
150
+ streamsize b = g_fileio_interface->Read(buffer->cache,curpos,s+read,n-read,PP_MakeCompletionCallback(NULL,NULL));
151
+ curpos += b;
152
+
153
+ // No more data after waiting, this must be EOF
154
+ if (b == 0)
155
+ return read;
156
+
157
+ read += b;
158
+ }
159
+
160
+ return read;
161
+}
162
+
163
+streampos ppFileStreamCache::ppFileStreamCacheReader::seekoff(streamoff off, ios_base::seekdir way, ios_base::openmode which)
164
+{
165
+ switch (way)
166
+ {
167
+ case ios_base::beg:
168
+ curpos = off;
169
+ break;
170
+ case ios_base::cur:
171
+ curpos += off;
172
+ break;
173
+ case ios_base::end:
174
+ curpos = buffer->getReceivedLength() + off;
175
+ break;
176
+ default:
177
+ break;
178
+ }
179
+ return curpos;
180
+}
181
+
182
+streampos ppFileStreamCache::ppFileStreamCacheReader::seekpos(streampos sp, ios_base::openmode which)
183
+{
184
+ curpos = sp;
185
+ return curpos;
186
+}
187
188
189
ppVariantObject::ppVariantObject(std::map<int64_t, std::unique_ptr<ExtObject> > &objectsMap, PP_Var& other)
190
191
return result;
192
}
193
194
-ppDownloadManager::ppDownloadManager(PP_Instance _instance, SystemState *sys):instance(_instance),m_sys(sys)
195
+ppDownloadManager::ppDownloadManager(ppPluginInstance *_instance, SystemState *sys):m_instance(_instance),m_sys(sys)
196
{
197
type = NPAPI;
198
}
199
200
LOG(LOG_INFO, _("NET: PLUGIN: DownloadManager::download '") << url.getParsedURL() <<
201
lightspark.tar.xz/src/plugin_ppapi/plugin.h
Changed
136
1
2
#include "swf.h"
3
#include "ppapi/c/ppp_instance.h"
4
#include "ppapi/c/pp_var.h"
5
+#include "ppapi/c/pp_resource.h"
6
7
namespace lightspark
8
{
9
-
10
class ppDownloader;
11
class ppPluginInstance;
12
13
+
14
+class ppFileStreamCache : public StreamCache {
15
+private:
16
+ class ppFileStreamCacheReader : public std::streambuf {
17
+ private:
18
+ std::streampos curpos;
19
+ _R<ppFileStreamCache> buffer;
20
+ virtual int underflow();
21
+ virtual std::streamsize xsgetn(char* s, std::streamsize n);
22
+
23
+ std::streampos seekoff (std::streamoff off, std::ios_base::seekdir way,std::ios_base::openmode which);
24
+ std::streampos seekpos (std::streampos sp, std::ios_base::openmode which);
25
+ public:
26
+ ppFileStreamCacheReader(_R<ppFileStreamCache> buffer);
27
+ };
28
+
29
+ //Cache filename
30
+ PP_Resource cache;
31
+ PP_Resource cacheref;
32
+ int64_t writeoffset;
33
+ ppPluginInstance* m_instance;
34
+
35
+ void openCache();
36
+ void openExistingCache(const tiny_string& filename, bool forWriting=true);
37
+
38
+ // Block until the cache file is opened by the writer stream
39
+ bool waitForCache();
40
+
41
+ virtual void handleAppend(const unsigned char* buffer, size_t length);
42
+
43
+public:
44
+ ppFileStreamCache(ppPluginInstance* instance);
45
+ virtual ~ppFileStreamCache();
46
+
47
+ virtual std::streambuf *createReader();
48
+
49
+ void openForWriting();
50
+};
51
+
52
class ppDownloadManager: public StandaloneDownloadManager
53
{
54
private:
55
- PP_Instance instance;
56
+ ppPluginInstance* m_instance;
57
SystemState* m_sys;
58
public:
59
- ppDownloadManager(PP_Instance _instance,SystemState* sys);
60
+ ppDownloadManager(ppPluginInstance* _instance,SystemState* sys);
61
Downloader* download(const URLInfo& url,
62
_R<StreamCache> cache,
63
ILoadable* owner);
64
65
66
static void dlStartCallback(void* userdata,int result);
67
static void dlReadResponseCallback(void* userdata,int result);
68
+ static void dlStartDownloadCallback(void* userdata,int result);
69
+ void startDownload();
70
public:
71
enum STATE { INIT=0, STREAM_DESTROYED, ASYNC_DESTROY };
72
STATE state;
73
//Constructor used for the main file
74
- ppDownloader(const tiny_string& _url, PP_Instance _instance, ILoadable* owner, ppPluginInstance* ppinstance);
75
- ppDownloader(const tiny_string& _url, _R<StreamCache> cache, PP_Instance _instance, ILoadable* owner);
76
+ ppDownloader(const tiny_string& _url, ILoadable* owner, ppPluginInstance* ppinstance);
77
+ ppDownloader(const tiny_string& _url, _R<StreamCache> cache, ppPluginInstance* ppinstance, ILoadable* owner);
78
ppDownloader(const tiny_string& _url, _R<StreamCache> cache, const std::vector<uint8_t>& _data,
79
- const std::list<tiny_string>& headers, PP_Instance _instance, ILoadable* owner);
80
+ const std::list<tiny_string>& headers, ppPluginInstance* ppinstance, ILoadable* owner);
81
};
82
83
class ppVariantObject : public ExtVariant
84
85
PP_Instance m_ppinstance;
86
struct PP_Size m_last_size;
87
PP_Resource m_graphics;
88
+ PP_Resource m_cachefilesystem;
89
+ ATOMIC_INT32(m_cachefilename);
90
SystemState* m_sys;
91
std::streambuf *mainDownloaderStreambuf;
92
std::istream mainDownloaderStream;
93
ppDownloader* mainDownloader;
94
ParseThread* m_pt;
95
+
96
public:
97
ppPluginInstance(PP_Instance instance, int16_t argc,const char* argn[],const char* argv[]);
98
virtual ~ppPluginInstance();
99
100
SystemState* getSystemState() const { return m_sys;}
101
void startMainParser();
102
PP_Instance getppInstance() { return m_ppinstance; }
103
+ PP_Resource getFileSystem() { return m_cachefilesystem; }
104
+ PP_Resource createCacheFileRef();
105
};
106
107
class ppPluginEngineData: public EngineData
108
109
ppPluginInstance* instance;
110
public:
111
SystemState* sys;
112
- ACQUIRE_RELEASE_FLAG(inRendering);
113
- ppPluginEngineData(ppPluginInstance* i, uint32_t w, uint32_t h,SystemState* _sys) : EngineData(), instance(i),sys(_sys),inRendering(false)
114
+ Semaphore swapbuffer_rendering;
115
+ ppPluginEngineData(ppPluginInstance* i, uint32_t w, uint32_t h,SystemState* _sys) : EngineData(), instance(i),sys(_sys),swapbuffer_rendering(0)
116
{
117
width = w;
118
height = h;
119
120
void stopMainDownload();
121
bool isSizable() const { return false; }
122
uint32_t getWindowForGnash();
123
+ void runInMainThread(SystemState* sys, void (*func) (SystemState*) );
124
/* must be called within mainLoopThread */
125
SDL_Window* createWidget(uint32_t w,uint32_t h);
126
/* must be called within mainLoopThread */
127
128
void setClipboardText(const std::string txt);
129
bool getScreenData(SDL_DisplayMode* screen);
130
double getScreenDPI();
131
+ StreamCache* createFileStreamCache();
132
+
133
void SwapBuffers();
134
void InitOpenGL();
135
void DeinitOpenGL();
136
lightspark.tar.xz/src/scripting/flash/net/flashnet.cpp
Changed
28
1
2
// Parameter Null means data is generated by calls to "appendBytes"
3
if (args[0]->is<Null>())
4
{
5
- th->datagenerationfile = new FileStreamCache;
6
+ th->datagenerationfile = th->getSystemState()->getEngineData()->createFileStreamCache();
7
th->datagenerationfile->openForWriting();
8
th->streamTime=0;
9
return NULL;
10
11
}
12
else //The URL is valid so we can start the download and add ourself as a job
13
{
14
- StreamCache *cache = new FileStreamCache;
15
+ StreamCache *cache = th->getSystemState()->getEngineData()->createFileStreamCache();
16
th->downloader=getSys()->downloadManager->download(th->url, _MR(cache), NULL);
17
th->streamTime=0;
18
//To be decreffed in jobFence
19
20
LOG(LOG_INFO,"resetBegin");
21
if (th->datagenerationfile)
22
delete th->datagenerationfile;
23
- th->datagenerationfile = new FileStreamCache;
24
+ th->datagenerationfile = th->getSystemState()->getEngineData()->createFileStreamCache();
25
th->datagenerationfile->openForWriting();
26
th->datagenerationbuffer->setLength(0);
27
th->datagenerationthreadstarted = false;
28
lightspark.tar.xz/src/scripting/flash/net/flashnet.h
Changed
10
1
2
AudioDecoder* audioDecoder;
3
AudioStream *audioStream;
4
// only used when in DataGenerationMode
5
- FileStreamCache* datagenerationfile;
6
+ StreamCache* datagenerationfile;
7
bool datagenerationthreadstarted;
8
Mutex mutex;
9
Mutex countermutex;
10
lightspark.tar.xz/src/swf.cpp
Changed
76
1
2
inputThread=new InputThread(this);
3
4
EngineData::userevent = SDL_RegisterEvents(3);
5
- SDL_Event event;
6
- SDL_zero(event);
7
- event.type = LS_USEREVENT_INIT;
8
- event.user.data1 = this;
9
- SDL_PushEvent(&event);
10
+ if (EngineData::sdl_needinit)
11
+ {
12
+ SDL_Event event;
13
+ SDL_zero(event);
14
+ event.type = LS_USEREVENT_INIT;
15
+ event.user.data1 = this;
16
+ SDL_PushEvent(&event);
17
+ }
18
}
19
20
void SystemState::setDownloadedPath(const tiny_string& p)
21
22
}
23
24
//The engines must be created in the context of the main thread
25
- engineData->runInMainThread(&SystemState::delayedCreation);
26
+ engineData->runInMainThread(this,&SystemState::delayedCreation);
27
28
//Wait for delayedCreation to finish so it is protected by our 'mutex'
29
//Otherwise SystemState::destroy may delete this object before delayedCreation is scheduled.
30
31
return;
32
}
33
//Check if this clip is the main clip then honour its FileAttributesTag
34
- if(root == getSys()->mainClip)
35
+ if(root == root->getSystemState()->mainClip)
36
{
37
- getSys()->needsAVM2(fat->ActionScript3);
38
+ root->getSystemState()->needsAVM2(fat->ActionScript3);
39
if(!fat->ActionScript3)
40
{
41
- delete fat;
42
+ delete fat;
43
return; /* no more parsing necessary, handled by fallback */
44
- }
45
+ }
46
if(fat->UseNetwork
47
- && getSys()->securityManager->getSandboxType() == SecurityManager::LOCAL_WITH_FILE)
48
+ && root->getSystemState()->securityManager->getSandboxType() == SecurityManager::LOCAL_WITH_FILE)
49
{
50
- getSys()->securityManager->setSandboxType(SecurityManager::LOCAL_WITH_NETWORK);
51
+ root->getSystemState()->securityManager->setSandboxType(SecurityManager::LOCAL_WITH_NETWORK);
52
LOG(LOG_INFO, _("Switched to local-with-networking sandbox by FileAttributesTag"));
53
}
54
}
55
56
delete tag;
57
break;
58
}
59
- if(getSys()->shouldTerminate() || threadAborting)
60
+ if(root->getSystemState()->shouldTerminate() || threadAborting)
61
break;
62
}
63
}
64
65
void SystemState::showMouseCursor(bool visible)
66
{
67
if (visible)
68
- EngineData::runInMainThread(&EngineData::showMouseCursor);
69
+ engineData->runInMainThread(this,&EngineData::showMouseCursor);
70
else
71
- EngineData::runInMainThread(&EngineData::hideMouseCursor);
72
+ engineData->runInMainThread(this,&EngineData::hideMouseCursor);
73
}
74
75
void SystemState::waitRendering()
76