Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into hulu-hacks

  • Loading branch information...
commit bfe54d09102301a7fda18c4e4edd07bcc8b745d9 2 parents 45505d1 + 15036c6
Alessandro Pignotti alexp-sssup authored
1  CMakeLists.txt
View
@@ -116,6 +116,7 @@ SET(COMPILE_TIGHTSPARK TRUE CACHE BOOL "Compile Tightspark?")
SET(COMPILE_PLUGIN FALSE CACHE BOOL "Compile the browser plugin?")
SET(ENABLE_CURL TRUE CACHE BOOL "Enable CURL? (Required for Downloader functionality)")
SET(ENABLE_LIBAVCODEC TRUE CACHE BOOL "Enable libavcodec and dependent functionality?")
+SET(ENABLE_RTMP FALSE CACHE BOOL "Enable librtmp and dependent functionality?")
SET(PLUGIN_DIRECTORY "${LIBDIR}/mozilla/plugins" CACHE STRING "Directory to install Firefox plugin to")
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
3  ChangeLog
View
@@ -5,6 +5,9 @@ Version 0.4.6:
* Vastly improved gradient support
* Fixed a large amount of graphics glitches
* Add support for upcoming Gnash release 0.8.9
+ * Add profiling support for ActionScript code
+ * Add support for muting all sounds using the 'm' key
+ * Add support for copying error messages using the 'c' key in plugin
Version 0.4.5.3
* Fix YouTube breakage
6 backends/audio.cpp
View
@@ -44,11 +44,9 @@ Else
Select and load the good audio plugin lib files
*****************/
-AudioManager::AudioManager ( PluginManager *sharedPluginManager )
+AudioManager::AudioManager ( PluginManager *sharedPluginManager ) :
+ oAudioPlugin(NULL), selectedAudioBackend(""), pluginManager(sharedPluginManager)
{
- pluginManager = sharedPluginManager;
- selectedAudioBackend = "";
- oAudioPlugin = NULL;
// string DesiredAudio = get_audioConfig(); //Looks for the audio selected in the user's config
string DesiredAudio = sys->config->getAudioBackendName();
set_audiobackend ( DesiredAudio );
7 backends/audio.h
View
@@ -46,7 +46,6 @@ class AudioManager
void release_audioplugin();
PluginManager *pluginManager;
-
public:
AudioManager ( PluginManager *sharePluginManager );
bool pluginLoaded() const;
@@ -58,6 +57,12 @@ class AudioManager
void set_audiobackend ( std::string desired_backend );
void get_audioBackendsList();
void refresh_audioplugins_list();
+
+ void muteAll() { oAudioPlugin->muteAll(); }
+ void unmuteAll() { oAudioPlugin->unmuteAll(); }
+ void toggleMuteAll() { oAudioPlugin->toggleMuteAll(); }
+ bool allMuted() { return oAudioPlugin->allMuted(); }
+
~AudioManager();
};
29 backends/input.cpp
View
@@ -92,6 +92,28 @@ gboolean InputThread::gtkplug_worker(GtkWidget *widget, GdkEvent *event, InputTh
case GDK_p:
th->m_sys->showProfilingData=!th->m_sys->showProfilingData;
break;
+ case GDK_m:
+ th->m_sys->audioManager->toggleMuteAll();
+ if(th->m_sys->audioManager->allMuted())
+ LOG(LOG_NO_INFO, "All sounds muted");
+ else
+ LOG(LOG_NO_INFO, "All sounds unmuted");
+ break;
+ case GDK_c:
+ if(th->m_sys->hasError())
+ {
+ GtkClipboard *clipboard;
+ clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
+ gtk_clipboard_set_text(clipboard, th->m_sys->getErrorCause().c_str(),
+ th->m_sys->getErrorCause().size());
+ clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
+ gtk_clipboard_set_text(clipboard, th->m_sys->getErrorCause().c_str(),
+ th->m_sys->getErrorCause().size());
+ LOG(LOG_NO_INFO, "Copied error to clipboard");
+ }
+ else
+ LOG(LOG_NO_INFO, "No error to be coppied to clipboard");
+ break;
default:
break;
}
@@ -203,6 +225,13 @@ void* InputThread::sdl_worker(InputThread* th)
case SDLK_p:
th->m_sys->showProfilingData=!th->m_sys->showProfilingData;
break;
+ case SDLK_m:
+ th->m_sys->audioManager->toggleMuteAll();
+ if(th->m_sys->audioManager->allMuted())
+ LOG(LOG_NO_INFO, "All sounds muted");
+ else
+ LOG(LOG_NO_INFO, "All sounds unmuted");
+ break;
case SDLK_q:
th->m_sys->setShutdownFlag();
if(th->m_sys->currentVm)
2  backends/interfaces/audio/IAudioPlugin.cpp
View
@@ -25,7 +25,7 @@ using namespace std;
IAudioPlugin::IAudioPlugin ( string plugin_name, string backend_name, bool init_stopped ):
- IPlugin(AUDIO, plugin_name, backend_name), stopped(init_stopped)
+ IPlugin(AUDIO, plugin_name, backend_name), stopped(init_stopped), muteAllStreams(false)
{
}
8 backends/interfaces/audio/IAudioPlugin.h
View
@@ -56,6 +56,8 @@ class IAudioPlugin : public IPlugin
volatile bool contextReady;
volatile bool noServer;
bool stopped;
+ bool muteAllStreams;
+
IAudioPlugin ( std::string plugin_name, std::string backend_name, bool init_stopped = false );
public:
@@ -68,6 +70,12 @@ class IAudioPlugin : public IPlugin
virtual void pauseStream( AudioStream *audioStream ) = 0; //Pause the stream (stops time from running, cork)
virtual void resumeStream( AudioStream *audioStream ) = 0; //Resume the stream (restart time, uncork)
virtual bool isTimingAvailable() const = 0;
+
+ virtual void muteAll() { muteAllStreams = true; }
+ virtual void unmuteAll() { muteAllStreams = false; }
+ virtual void toggleMuteAll() { muteAllStreams ? unmuteAll() : muteAll(); }
+ virtual bool allMuted() { return muteAllStreams; }
+
virtual ~IAudioPlugin();
};
42 backends/interfaces/audio/pulse/PulsePlugin.cpp
View
@@ -247,8 +247,11 @@ AudioStream *PulsePlugin::createStream ( AudioDecoder *decoder )
pa_stream_set_underflow_callback ( audioStream->stream, ( pa_stream_notify_cb_t ) underflow_notify, NULL );
pa_stream_set_overflow_callback ( audioStream->stream, ( pa_stream_notify_cb_t ) overflow_notify, NULL );
pa_stream_set_started_callback ( audioStream->stream, ( pa_stream_notify_cb_t ) started_notify, NULL );
+ pa_stream_flags flags = (pa_stream_flags) PA_STREAM_START_CORKED;
+ if(muteAllStreams)
+ flags = (pa_stream_flags) (flags | PA_STREAM_START_MUTED);
pa_stream_connect_playback ( audioStream->stream, NULL, &attrs,
- ( pa_stream_flags ) ( PA_STREAM_START_CORKED ), NULL, NULL );
+ flags, NULL, NULL );
pulseUnlock();
}
else
@@ -341,6 +344,22 @@ void PulsePlugin::stop()
}
}
+void PulsePlugin::muteAll()
+{
+ IAudioPlugin::muteAll();
+ for ( stream_iterator it = streams.begin();it != streams.end(); ++it )
+ {
+ ((PulseAudioStream*) (*it))->mute();
+ }
+}
+void PulsePlugin::unmuteAll()
+{
+ IAudioPlugin::unmuteAll();
+ for ( stream_iterator it = streams.begin();it != streams.end(); ++it )
+ {
+ ((PulseAudioStream*) (*it))->unmute();
+ }
+}
/****************************
@@ -431,6 +450,27 @@ bool PulseAudioStream::isValid()
return streamStatus != STREAM_DEAD;
}
+void PulseAudioStream::mute()
+{
+ pa_context_set_sink_input_mute(
+ pa_stream_get_context(stream),
+ pa_stream_get_index(stream),
+ 1,
+ NULL,
+ NULL
+ );
+}
+void PulseAudioStream::unmute()
+{
+ pa_context_set_sink_input_mute(
+ pa_stream_get_context(stream),
+ pa_stream_get_index(stream),
+ 0,
+ NULL,
+ NULL
+ );
+}
+
// Plugin factory function
extern "C" DLL_PUBLIC IPlugin *create()
9 backends/interfaces/audio/pulse/PulsePlugin.h
View
@@ -45,6 +45,7 @@ class PulsePlugin : public IAudioPlugin
static void streamWriteCB ( pa_stream *stream, size_t nbytes, PulseAudioStream *th );
bool contextReady;
bool noServer;
+
public:
PulsePlugin ( std::string init_Name = "Pulse plugin output only", std::string init_audiobackend = "pulseaudio",
bool init_contextReady = false, bool init_noServer = false, bool init_stopped = false );
@@ -57,6 +58,10 @@ class PulsePlugin : public IAudioPlugin
void pulseLock();
void pulseUnlock();
bool serverAvailable() const;
+
+ void muteAll();
+ void unmuteAll();
+
~PulsePlugin();
};
@@ -74,7 +79,9 @@ class PulseAudioStream: public AudioStream
pa_stream *stream;
PulsePlugin *manager;
volatile STREAM_STATUS streamStatus;
-
+
+ void mute();
+ void unmute();
};
#endif
14 backends/rendering.cpp
View
@@ -343,16 +343,19 @@ void* RenderThread::gtkplug_worker(RenderThread* th)
glColor3f(0.8,0.8,0.8);
font.Render("We're sorry, Lightspark encountered a yet unsupported Flash file",
- -1,FTPoint(0,th->windowHeight/2));
+ -1,FTPoint(0,th->windowHeight/2+20));
stringstream errorMsg;
errorMsg << "SWF file: " << th->m_sys->getOrigin().getParsedURL();
font.Render(errorMsg.str().c_str(),
- -1,FTPoint(0,th->windowHeight/2-20));
+ -1,FTPoint(0,th->windowHeight/2));
errorMsg.str("");
errorMsg << "Cause: " << th->m_sys->errorCause;
font.Render(errorMsg.str().c_str(),
+ -1,FTPoint(0,th->windowHeight/2-20));
+
+ font.Render("Press C to copy this error to clipboard",
-1,FTPoint(0,th->windowHeight/2-40));
glFlush();
@@ -866,16 +869,19 @@ void* RenderThread::sdl_worker(RenderThread* th)
glColor3f(0.8,0.8,0.8);
font.Render("We're sorry, Lightspark encountered a yet unsupported Flash file",
- -1,FTPoint(0,th->windowHeight/2));
+ -1,FTPoint(0,th->windowHeight/2+20));
stringstream errorMsg;
errorMsg << "SWF file: " << th->m_sys->getOrigin().getParsedURL();
font.Render(errorMsg.str().c_str(),
- -1,FTPoint(0,th->windowHeight/2-20));
+ -1,FTPoint(0,th->windowHeight/2));
errorMsg.str("");
errorMsg << "Cause: " << th->m_sys->errorCause;
font.Render(errorMsg.str().c_str(),
+ -1,FTPoint(0,th->windowHeight/2-20));
+
+ font.Render("Please look at the console output to copy this error",
-1,FTPoint(0,th->windowHeight/2-40));
font.Render("Press 'Q' to exit",-1,FTPoint(0,th->windowHeight/2-60));
23 plugin/npscriptobject.cpp
View
@@ -627,23 +627,28 @@ bool NPScriptObject::invoke(NPIdentifier id, const NPVariant* args, uint32_t arg
lightspark::ExtCallback* callback = it->second->copy();
// Set the current root callback only if there isn't one already
- bool resetCurrentCallback = false;
+ bool rootCallback = false;
if(currentCallback == NULL)
{
// Remember to reset the current callback
- resetCurrentCallback = true;
+ rootCallback = true;
currentCallback = callback;
}
+ // Call the callback synchronously if:
+ // - We are not the root callback
+ // (case: BROWSER -> invoke -> VM -> external call -> BROWSER -> invoke)
+ // - We are the root callback AND we are being called from within an external call
+ // (case: VM -> external call -> BROWSER -> invoke)
+ bool synchronous = !rootCallback || (rootCallback && callStatusses.size() == 1);
// Call our callback.
- // If we aren't the root callback, indicate that the VM is suspended.
- // We can assume this since we are in a nested invoke(),
- // which got called from within an external call (which is run from the VM).
- callback->call(*this, objId, objArgs, argc, currentCallback!=NULL);
+ // We can call it synchronously in the cases specified above.
+ // In both cases, the VM is suspended, waiting for the result from another external call.
+ // Thus we don't have to worry about synchronizing with the VM.
+ callback->call(*this, objId, objArgs, argc, synchronous);
// Wait for its result or a forced wake-up
callback->wait();
- // As long as we get forced wake-ups,
- // execute the requested external calls and keep waiting.
+ // As long as we get forced wake-ups, execute the requested external calls and keep waiting.
// Note that only the root callback can be forcibly woken up.
while(externalCallData != NULL)
{
@@ -662,7 +667,7 @@ bool NPScriptObject::invoke(NPIdentifier id, const NPVariant* args, uint32_t arg
bool res = callback->getResult(*this, &objResult);
// Reset the root current callback to NULL, if necessary
- if(resetCurrentCallback)
+ if(rootCallback)
currentCallback = NULL;
// Delete our callback after use
2  swf.h
View
@@ -237,6 +237,8 @@ class SystemState: public RootMovieClip
std::string errorCause;
void setError(const std::string& c);
+ bool hasError() { return error; }
+ std::string& getErrorCause() { return errorCause; }
bool shouldTerminate() const;
bool isShuttingDown() const DLL_PUBLIC;
bool isOnError() const;
Please sign in to comment.
Something went wrong with that request. Please try again.