diff --git a/libcore/Button.cpp b/libcore/Button.cpp
index 6487fff..435ba67 100644
--- a/libcore/Button.cpp
+++ b/libcore/Button.cpp
@@ -535,6 +535,7 @@ Button::mouseEvent(const event_id& event)
                     bs.soundInfo.loopCount,
                     env, // envelopes
                     !sinfo.noMultiple, // allow multiple instances ?
+                    stage(),
                     sinfo.inPoint,
                     sinfo.outPoint
                     );
diff --git a/libcore/Video.cpp b/libcore/Video.cpp
index 6666bae..c474844 100644
--- a/libcore/Video.cpp
+++ b/libcore/Video.cpp
@@ -63,7 +63,7 @@ Video::Video(as_object* object,
 	if (!info) return;
 
     try {
-	    _decoder = mh->createVideoDecoder(*info);
+	    _decoder = mh->createVideoDecoder(*info, getRoot(*object));
 	}
 	catch (const MediaException& e) {
 	    log_error(_("Could not create Video Decoder: %s"), e.what());
diff --git a/libcore/asobj/NetStream_as.cpp b/libcore/asobj/NetStream_as.cpp
index bd2cd4b..1e4af36 100644
--- a/libcore/asobj/NetStream_as.cpp
+++ b/libcore/asobj/NetStream_as.cpp
@@ -423,8 +423,10 @@ NetStream_as::initVideoDecoder(const media::VideoInfo& info)
 
     _videoInfoKnown = true; 
 
+    movie_root& m = getRoot(owner());
+
     try {
-        _videoDecoder = _mediaHandler->createVideoDecoder(info);
+        _videoDecoder = _mediaHandler->createVideoDecoder(info, m);
         assert ( _videoDecoder.get() ); 
         log_debug(_("NetStream_as::initVideoDecoder: hot-plugging "
                     "video consumer"));
@@ -434,7 +436,6 @@ NetStream_as::initVideoDecoder(const media::VideoInfo& info)
         log_error(_("NetStream: Could not create Video decoder: %s"), e.what());
 
         // This is important enough to let the user know.
-        movie_root& m = getRoot(owner());
         m.callInterface(HostMessage(HostMessage::NOTIFY_ERROR,
                 std::string(e.what())));
     }
@@ -451,9 +452,10 @@ NetStream_as::initAudioDecoder(const media::AudioInfo& info)
     assert ( !_audioDecoder.get() );
 
     _audioInfoKnown = true; 
+    movie_root& m = getRoot(owner());
 
     try {
-        _audioDecoder = _mediaHandler->createAudioDecoder(info);
+        _audioDecoder = _mediaHandler->createAudioDecoder(info, m);
         assert ( _audioDecoder.get() );
         log_debug(_("NetStream_as::initAudioDecoder: hot-plugging "
                     "audio consumer"));
@@ -465,7 +467,6 @@ NetStream_as::initAudioDecoder(const media::AudioInfo& info)
         log_error(_("Could not create Audio decoder: %s"), err);
 
         // This is important enough to let the user know.
-        movie_root& m = getRoot(owner());
         m.callInterface(HostMessage(HostMessage::NOTIFY_ERROR, err));
     }
 
diff --git a/libcore/asobj/Sound_as.cpp b/libcore/asobj/Sound_as.cpp
index 106cd79..63e8cd5 100644
--- a/libcore/asobj/Sound_as.cpp
+++ b/libcore/asobj/Sound_as.cpp
@@ -625,8 +625,9 @@ Sound_as::attachAuxStreamerIfNeeded()
     media::AudioInfo* audioInfo =  _mediaParser->getAudioInfo();
     if (!audioInfo) return nullptr;
 
+    movie_root& m = getRoot(owner());
     // the following may throw an exception
-    _audioDecoder.reset(_mediaHandler->createAudioDecoder(*audioInfo).release());
+    _audioDecoder.reset(_mediaHandler->createAudioDecoder(*audioInfo, m).release());
 
     // start playing ASAP, a call to ::start will just change _startTime
 #ifdef GNASH_DEBUG_SOUND_AS
@@ -736,6 +737,7 @@ Sound_as::start(double secOff, int loops)
                     loops,
                     nullptr, // envelopes
                     true, // allow multiple instances (checked)
+                    getRoot(owner()),
                     inPoint
                     );
 
diff --git a/libcore/swf/StartSoundTag.cpp b/libcore/swf/StartSoundTag.cpp
index 0e1ae40..082bd18 100644
--- a/libcore/swf/StartSoundTag.cpp
+++ b/libcore/swf/StartSoundTag.cpp
@@ -98,6 +98,7 @@ StartSoundTag::executeActions(MovieClip* m, DisplayList& /* dlist */) const
                     _soundInfo.loopCount,
                     env, // envelopes
                     !_soundInfo.noMultiple, // allow multiple instances ?
+		    getRoot(*getObject(m)),
                     _soundInfo.inPoint,
                     _soundInfo.outPoint
                 );
diff --git a/libcore/swf/StreamSoundBlockTag.cpp b/libcore/swf/StreamSoundBlockTag.cpp
index eea639c..ed65c98 100644
--- a/libcore/swf/StreamSoundBlockTag.cpp
+++ b/libcore/swf/StreamSoundBlockTag.cpp
@@ -47,8 +47,9 @@ StreamSoundBlockTag::executeActions(MovieClip* m, DisplayList& /*dlist*/) const
     if (handler) {
         // This makes it possible to stop only the stream when framejumping.
         m->setStreamSoundId(_handler_id);
-        handler->playStream(_handler_id, _blockId);
-        getRoot(*getObject(m)).setStreamBlock(_handler_id, _blockId);
+        movie_root& mr = getRoot(*getObject(m));
+        handler->playStream(_handler_id, _blockId, mr);
+        mr.setStreamBlock(_handler_id, _blockId);
     }
 #endif  // USE_SOUND
 }
diff --git a/libmedia/Makefile.am b/libmedia/Makefile.am
index 985e034..ba7e940 100644
--- a/libmedia/Makefile.am
+++ b/libmedia/Makefile.am
@@ -126,6 +126,10 @@ endif
 
 libgnashmedia_la_CPPFLAGS = \
 	-I$(top_srcdir)/libbase	\
+	-I$(top_srcdir)/libcore	\
+	-I$(top_srcdir)/libcore/swf	\
+	-I$(top_srcdir)/libcore/parser	\
+	-I$(top_srcdir)/libcore/vm	\
 	$(PTHREAD_CFLAGS) \
 	$(BOOST_CFLAGS) \
 	$(NULL)
diff --git a/libmedia/MediaHandler.h b/libmedia/MediaHandler.h
index cf0465b..94282de 100644
--- a/libmedia/MediaHandler.h
+++ b/libmedia/MediaHandler.h
@@ -29,6 +29,7 @@
 #include <string>
 
 #include "GnashFactory.h"
+#include "movie_root.h"
 
 // Forward declarations
 namespace gnash {
@@ -95,7 +96,7 @@ public:
     /// @return     Will always return a valid VideoDecoder or throw a
     ///             gnash::MediaException if a fatal error occurs.
     virtual std::unique_ptr<VideoDecoder>
-        createVideoDecoder(const VideoInfo& info)=0;
+        createVideoDecoder(const VideoInfo& info, movie_root& mr)=0;
 
     /// Create an AudioDecoder for decoding what's specified in the AudioInfo
     //
@@ -104,7 +105,7 @@ public:
     /// @return     Will always return a valid AudioDecoder or throw a
     ///             gnash::MediaException if a fatal error occurs.
     virtual std::unique_ptr<AudioDecoder>
-        createAudioDecoder(const AudioInfo& info)=0;
+	createAudioDecoder(const AudioInfo& info, movie_root& mr)=0;
 
     /// Create an VideoConverter for converting between color spaces.
     //
diff --git a/libmedia/gst/AudioDecoderGst.cpp b/libmedia/gst/AudioDecoderGst.cpp
index ea275c9..59d488c 100644
--- a/libmedia/gst/AudioDecoderGst.cpp
+++ b/libmedia/gst/AudioDecoderGst.cpp
@@ -29,7 +29,8 @@ namespace media {
 namespace gst {
 
 
-AudioDecoderGst::AudioDecoderGst(SoundInfo& info)
+AudioDecoderGst::AudioDecoderGst(SoundInfo& info, movie_root& mr):
+    _mr(mr)
 {
     // init GStreamer. TODO: what about doing this in MediaHandlerGst ctor?
     gst_init (nullptr, nullptr);
@@ -45,7 +46,8 @@ AudioDecoderGst::AudioDecoderGst(SoundInfo& info)
     // FIXME: should we handle other types?
 }
 
-AudioDecoderGst::AudioDecoderGst(const AudioInfo& info)
+AudioDecoderGst::AudioDecoderGst(const AudioInfo& info, movie_root& mr):
+    _mr(mr)
 {
     // init GStreamer. TODO: what about doing this in MediaHandlerGst ctor?
     gst_init (nullptr, nullptr);
@@ -168,7 +170,7 @@ void AudioDecoderGst::setup(GstCaps* srccaps)
         throw MediaException(_("AudioDecoderGst: internal error (caps creation failed)"));      
     }
 
-    bool success = GstUtil::check_missing_plugins(srccaps);
+    bool success = GstUtil::check_missing_plugins(srccaps, _mr);
     if (!success) {
         GstStructure* sct = gst_caps_get_structure(srccaps, 0);
         std::string type(gst_structure_get_name(sct));
diff --git a/libmedia/gst/AudioDecoderGst.h b/libmedia/gst/AudioDecoderGst.h
index 4ff299c..4764c33 100644
--- a/libmedia/gst/AudioDecoderGst.h
+++ b/libmedia/gst/AudioDecoderGst.h
@@ -25,6 +25,7 @@
 
 #include <gst/gst.h>
 #include "GnashImage.h"
+#include "movie_root.h"
 
 #include "swfdec_codec_gst.h"
 
@@ -44,8 +45,8 @@ namespace gst {
 class DSOEXPORT AudioDecoderGst : public AudioDecoder {
 	
 public:
-    AudioDecoderGst(const AudioInfo& info);
-    AudioDecoderGst(SoundInfo& info);
+    AudioDecoderGst(const AudioInfo& info, movie_root& mr);
+    AudioDecoderGst(SoundInfo& info, movie_root& mr);
 
     ~AudioDecoderGst();
 
@@ -55,6 +56,8 @@ public:
 
 private:
 
+    movie_root& _mr;
+
     std::uint8_t* pullBuffers(std::uint32_t&  outputSize);
 
     void setup(GstCaps* caps);
diff --git a/libmedia/gst/GstUtil.cpp b/libmedia/gst/GstUtil.cpp
index 580bc11..150994d 100644
--- a/libmedia/gst/GstUtil.cpp
+++ b/libmedia/gst/GstUtil.cpp
@@ -24,6 +24,7 @@
 #endif
 
 #include <sstream>
+#include <vector>
 
 #include "GstUtil.h"
 #include "log.h"
@@ -97,9 +98,8 @@ GstElement* GstUtil::get_audiosink_element()
     return element;
 }
 
-// static
 bool
-GstUtil::check_missing_plugins(GstCaps* caps)
+GstUtil::check_missing_plugins(GstCaps* caps, movie_root& mr)
 {
     GstElementFactory * factory = swfdec_gst_get_element_factory(caps);
 
@@ -109,6 +109,11 @@ GstUtil::check_missing_plugins(GstCaps* caps)
     }
 
 #ifdef HAVE_GST_PBUTILS_INSTALL_PLUGINS_H
+
+    if (GstUtil::plugin_install_aborted){
+        return true;
+    }
+
     gst_pb_utils_init();
 
 
@@ -121,31 +126,102 @@ GstUtil::check_missing_plugins(GstCaps* caps)
     if (!detail) {
         log_error(_("Missing plugin, but failed to convert it to gst"
                     " missing plugin detail."));
+	g_free(detail);
         return false;
     }
 
     char* details[] =  { detail, nullptr };
 
-    GstInstallPluginsReturn ret = gst_install_plugins_sync(details, nullptr);
-    g_free(details[0]);
+    std::vector<void*> * callback_data = new std::vector<void*>;
+    callback_data->push_back(detail);
+    callback_data->push_back(&mr);
 
-    // FIXME: what about partial success?
-    if (ret == GST_INSTALL_PLUGINS_SUCCESS) {
-        if (! gst_update_registry()) {
-            log_error(_("gst_update_registry failed. You'll need to "
-                        "restart Gnash to use the new plugins."));
-        }
+    GstInstallPluginsReturn ret = gst_install_plugins_async(details, nullptr, GstUtil::plugin_installer_return, callback_data);
 
-        return true;
+    if (ret == GST_INSTALL_PLUGINS_STARTED_OK) {
+	 mr.callInterface(HostMessage(HostMessage::EXTERNALINTERFACE_STOPPLAY));
+	return true;
+    } else {
+	log_error(_("gst_install_plugins_async failed. Please report."));
+	return false;
     }
+
 #else
     log_error(_("Missing plugin, but automatic plugin installation not "
                 "available."));
+    return false;
 #endif  // end of HAVE_GST_PBUTILS_INSTALL_PLUGINS_H
 
-    return false;
 }
 
+#ifdef HAVE_GST_PBUTILS_INSTALL_PLUGINS_H
+
+// static
+bool GstUtil::plugin_install_aborted = false;
+
+
+
+// Helper function for plugin_installer_return below.
+// Called when all or some plugins where successully installed
+// static
+void
+GstUtil::plugin_success_dialog(const char* success_msg,
+			       const char* fail_msg,
+			       movie_root& mr)
+{
+    if (! gst_update_registry()) {
+        log_error(_("gst_update_registry failed. You'll need to "
+		    "restart Gnash to use the new plugins."));
+	mr.callInterface(HostMessage(HostMessage::NOTIFY_ERROR,
+				      std::string(fail_msg)));
+    } else {
+        bool restart = mr.callInterface<bool>(HostMessage(HostMessage::QUERY,
+							   std::string(success_msg)));
+	if(restart){
+	    mr.callInterface(HostMessage(HostMessage::EXTERNALINTERFACE_REWIND));
+	}
+    }
+}
+
+// Callback function for use by the plugin installer
+void
+GstUtil::plugin_installer_return(GstInstallPluginsReturn result,
+				 gpointer user_data)
+{
+    std::vector<void*> * v((std::vector<void*> *) (user_data));
+    movie_root* mr = (movie_root*) (v->at(1));
+    char* detail = (char*) v->at(0);
+
+    g_free(detail);
+    // FIXME: what about partial success?
+    switch(result) {
+    case GST_INSTALL_PLUGINS_SUCCESS:
+	plugin_success_dialog(_("Plugin installation succeeded. Do you wish to restart the movie?"),_("Plugin installation succeeded, but could not be registered by Gnash. You will need to restart Gnash to see all content in this file."), *mr);
+	break;
+    case GST_INSTALL_PLUGINS_NOT_FOUND:
+	mr->callInterface(HostMessage(HostMessage::NOTIFY_ERROR,
+				      std::string(_("A plugin needed for playing this file was not found. You may still play the file, but some content may not be shown."))));
+	break;
+    case GST_INSTALL_PLUGINS_ERROR:
+	mr->callInterface(HostMessage(HostMessage::NOTIFY_ERROR,
+				      std::string(_("There was an error during installation of a plugin needed for playing this file. You may still play the file, but some content may not be shown."))));
+	break;
+    case GST_INSTALL_PLUGINS_PARTIAL_SUCCESS:
+	plugin_success_dialog(_("Some plugins could not be installed. To see all content here you will need to install these. Do you wish to restart the movie?"),_("Some plugins were installed, but could not be registered by Gnash. You will need to restart gnash to see more content in this file. To see all content in this file you also need to install the remaining plugins"), *mr);
+	break;
+    case GST_INSTALL_PLUGINS_USER_ABORT:
+	GstUtil::plugin_install_aborted = true;
+	break;
+    default:
+	throw new GnashException("Gst plugin installer returned unrecognized error code.");
+    }
+    mr->callInterface(HostMessage(HostMessage::EXTERNALINTERFACE_PLAY));
+    g_free(v);
+    return;
+}
+
+#endif  // end of HAVE_GST_PBUTILS_INSTALL_PLUGINS_H
+
 } // gnash.media.gst namespace
 } // gnash.media namespace 
 } // namespace gnash
diff --git a/libmedia/gst/GstUtil.h b/libmedia/gst/GstUtil.h
index 1537ad4..9170b29 100644
--- a/libmedia/gst/GstUtil.h
+++ b/libmedia/gst/GstUtil.h
@@ -22,6 +22,10 @@
 
 #include <gst/gst.h>
 #include "dsodefs.h" // DSOEXPORT
+#include "movie_root.h"
+
+// Needed for declaration of the thread functions to install plugins
+#include <gst/pbutils/install-plugins.h>
 
 // GST_TIME_AS_MSECONDS not defined as of gst 0.10.9
 // is defined as of gst 0.10.19
@@ -73,12 +77,26 @@ public:
     /// @return if there is a decoder available to decode the passed type,
     ///         or if we succeeded in installing one, returns true. Otherwise,
     ///         returns false.
-    static bool check_missing_plugins(GstCaps* caps);
+    static bool check_missing_plugins(GstCaps* caps, movie_root& mr);
         
 private:
 
-  GstUtil();
-  ~GstUtil();
+
+    GstUtil();
+    ~GstUtil();
+
+#ifdef HAVE_GST_PBUTILS_INSTALL_PLUGINS_H
+    // Set to true by plugin_installer_return if user has cancelled installation
+    // Read by check_missing_plugins, if true, prevents more plugin installations
+    static bool plugin_install_aborted;
+
+    // Callback function for the gst plugin installer
+    static void plugin_installer_return(GstInstallPluginsReturn, gpointer);
+    // Helper for the callback. Displays diaplog in case of installation success
+    static void plugin_success_dialog(const char* success_msg,
+				      const char* fail_msg,
+				      movie_root& mr);
+#endif  // end of HAVE_GST_PBUTILS_INSTALL_PLUGINS_H
 };
 
 } // gnash.media.gst namespace
diff --git a/libmedia/gst/MediaHandlerGst.cpp b/libmedia/gst/MediaHandlerGst.cpp
index 21613eb..c37ff7c 100644
--- a/libmedia/gst/MediaHandlerGst.cpp
+++ b/libmedia/gst/MediaHandlerGst.cpp
@@ -81,18 +81,18 @@ MediaHandlerGst::createMediaParser(std::unique_ptr<IOChannel> stream)
 }
 
 std::unique_ptr<VideoDecoder>
-MediaHandlerGst::createVideoDecoder(const VideoInfo& info)
+MediaHandlerGst::createVideoDecoder(const VideoInfo& info, movie_root& mr)
 {
     if (info.type != CODEC_TYPE_FLASH) {
 
         ExtraInfoGst* extrainfo = dynamic_cast<ExtraInfoGst*>(info.extra.get());
 
         if (!extrainfo) {
-            log_error(_("Wrong arguments given to GST VideoDecoder"));
+	    log_error(_("Wrong arguments given to GST VideoDecoder"));
             return std::unique_ptr<VideoDecoder>();
         }
         return std::unique_ptr<VideoDecoder>(
-            new VideoDecoderGst(extrainfo->caps));
+	    new VideoDecoderGst(extrainfo->caps, mr));
     }
     videoCodecType format = static_cast<videoCodecType>(info.codec);
     int width = info.width;
@@ -107,12 +107,12 @@ MediaHandlerGst::createVideoDecoder(const VideoInfo& info)
         datasize = extrainfo->size;
     }
 
-    std::unique_ptr<VideoDecoder> ret( new VideoDecoderGst(format, width, height, extradata, datasize) );
+    std::unique_ptr<VideoDecoder> ret( new VideoDecoderGst(format, width, height, extradata, datasize, mr) );
     return ret;
 }
 
 std::unique_ptr<AudioDecoder>
-MediaHandlerGst::createAudioDecoder(const AudioInfo& info)
+MediaHandlerGst::createAudioDecoder(const AudioInfo& info, movie_root& mr)
 {
     std::unique_ptr<AudioDecoder> ret;
 
@@ -124,7 +124,7 @@ MediaHandlerGst::createAudioDecoder(const AudioInfo& info)
 #endif
     {
         try {
-            ret.reset(new AudioDecoderGst(info));
+	    ret.reset(new AudioDecoderGst(info, mr));
         }
         catch (const MediaException& ex) {
 
diff --git a/libmedia/gst/MediaHandlerGst.h b/libmedia/gst/MediaHandlerGst.h
index 85e2fd0..2a5ffbe 100644
--- a/libmedia/gst/MediaHandlerGst.h
+++ b/libmedia/gst/MediaHandlerGst.h
@@ -25,6 +25,8 @@
 #include <vector>
 #include <memory>
 
+#include "movie_root.h"
+
 namespace gnash {
 namespace media {
 
@@ -49,10 +51,10 @@ public:
         createMediaParser(std::unique_ptr<IOChannel> stream);
 
 	virtual std::unique_ptr<VideoDecoder>
-        createVideoDecoder(const VideoInfo& info);
+	createVideoDecoder(const VideoInfo& info, movie_root& mr);
 
 	virtual std::unique_ptr<AudioDecoder>
-        createAudioDecoder(const AudioInfo& info);
+	createAudioDecoder(const AudioInfo& info, movie_root& mr);
 	
 	virtual std::unique_ptr<VideoConverter>
         createVideoConverter(ImgBuf::Type4CC srcFormat,
diff --git a/libmedia/gst/VideoDecoderGst.cpp b/libmedia/gst/VideoDecoderGst.cpp
index 27d6a59..6fe482f 100644
--- a/libmedia/gst/VideoDecoderGst.cpp
+++ b/libmedia/gst/VideoDecoderGst.cpp
@@ -27,10 +27,11 @@ namespace gst {
 
 // TODO: implement proper seeking.
 
-VideoDecoderGst::VideoDecoderGst(GstCaps* caps)
+VideoDecoderGst::VideoDecoderGst(GstCaps* caps, movie_root& mr)
     :
     _width(0),
-    _height(0)
+    _height(0),
+    _mr(mr)
 {
     // init GStreamer. TODO: what about doing this in MediaHandlerGst ctor?
     gst_init (nullptr, nullptr);
@@ -52,11 +53,13 @@ VideoDecoderGst::height() const
 
 // TODO: either use width and height or remove them!
 VideoDecoderGst::VideoDecoderGst(videoCodecType codec_type,
-        int /*width*/, int /*height*/,
-        const std::uint8_t* extradata, size_t extradatasize)
+	int /*width*/, int /*height*/,
+	const std::uint8_t* extradata, size_t extradatasize,
+	movie_root& mr)
     :
     _width(0),
-    _height(0)
+    _height(0),
+    _mr(mr)
 {
     // init GStreamer. TODO: what about doing this in MediaHandlerGst ctor?
     gst_init (nullptr, nullptr);
@@ -123,7 +126,7 @@ VideoDecoderGst::setup(GstCaps* srccaps)
                     "(caps creation failed)"));      
     }
 
-    bool success = GstUtil::check_missing_plugins(srccaps);
+    bool success = GstUtil::check_missing_plugins(srccaps, _mr);
     if (!success) {
         GstStructure* sct = gst_caps_get_structure(srccaps, 0);
         std::string type(gst_structure_get_name(sct));
diff --git a/libmedia/gst/VideoDecoderGst.h b/libmedia/gst/VideoDecoderGst.h
index 193a309..4b560a2 100644
--- a/libmedia/gst/VideoDecoderGst.h
+++ b/libmedia/gst/VideoDecoderGst.h
@@ -25,6 +25,7 @@
 #include "VideoDecoder.h"
 #include "dsodefs.h"
 #include "MediaParser.h" // for videoCodecType enum
+#include "movie_root.h"
 
 #include <gst/gst.h>
 
@@ -74,8 +75,9 @@ class DSOEXPORT VideoDecoderGst : public VideoDecoder
 {
 public:
     VideoDecoderGst(videoCodecType codec_type, int width, int height,
-                    const std::uint8_t* extradata, size_t extradatasize);
-    VideoDecoderGst(GstCaps* caps);
+                    const std::uint8_t* extradata, size_t extradatasize,
+		    movie_root& mr);
+    VideoDecoderGst(GstCaps* caps, movie_root& mr);
     ~VideoDecoderGst();
 
     void push(const EncodedVideoFrame& buffer);
@@ -98,6 +100,7 @@ private:
 
     int _width;
     int _height;
+    movie_root& _mr;
 
     void setup(GstCaps* caps);
 
diff --git a/libsound/EmbedSound.cpp b/libsound/EmbedSound.cpp
index a4853d8..31b0f30 100644
--- a/libsound/EmbedSound.cpp
+++ b/libsound/EmbedSound.cpp
@@ -59,10 +59,10 @@ EmbedSound::eraseActiveSound(Instances::iterator i)
 std::unique_ptr<EmbedSoundInst>
 EmbedSound::createInstance(media::MediaHandler& mh, unsigned int inPoint,
         unsigned int outPoint, const SoundEnvelopes* envelopes,
-        int loopCount)
+	int loopCount, movie_root& mr)
 {
     std::unique_ptr<EmbedSoundInst> ret(
-        new EmbedSoundInst(*this, mh, inPoint, outPoint, envelopes, loopCount));
+        new EmbedSoundInst(*this, mh, inPoint, outPoint, envelopes, loopCount, mr));
 
     std::lock_guard<std::mutex> lock(_soundInstancesMutex);
 
diff --git a/libsound/EmbedSound.h b/libsound/EmbedSound.h
index 5a6063e..d46535a 100644
--- a/libsound/EmbedSound.h
+++ b/libsound/EmbedSound.h
@@ -30,7 +30,7 @@
 #include "SimpleBuffer.h" // for composition
 #include "SoundInfo.h" // for composition
 #include "SoundEnvelope.h" // for SoundEnvelopes define
-
+#include "movie_root.h"
 // Forward declarations
 namespace gnash {
     namespace sound {
@@ -139,7 +139,7 @@ public:
     ///
     std::unique_ptr<EmbedSoundInst> createInstance(media::MediaHandler& mh,
             unsigned int inPoint, unsigned int outPoint,
-            const SoundEnvelopes* envelopes, int loopCount);
+            const SoundEnvelopes* envelopes, int loopCount, movie_root& mr);
 
     /// Drop all active sounds
     //
diff --git a/libsound/EmbedSoundInst.cpp b/libsound/EmbedSoundInst.cpp
index 2661794..63ef505 100644
--- a/libsound/EmbedSoundInst.cpp
+++ b/libsound/EmbedSoundInst.cpp
@@ -41,9 +41,10 @@ namespace sound {
 EmbedSoundInst::EmbedSoundInst(EmbedSound& soundData,
             media::MediaHandler& mediaHandler,
             unsigned int inPoint, unsigned int outPoint,
-            const SoundEnvelopes* env, int loopCount)
+	    const SoundEnvelopes* env, int loopCount,
+	    movie_root& mr)
         :
-        LiveSound(mediaHandler, soundData.soundinfo, inPoint),
+        LiveSound(mediaHandler, soundData.soundinfo, inPoint, mr),
         decodingPosition(0),
         loopCount(loopCount),
         // parameters are in stereo samples (44100 per second)
diff --git a/libsound/EmbedSoundInst.h b/libsound/EmbedSoundInst.h
index de88ada..15c1f66 100644
--- a/libsound/EmbedSoundInst.h
+++ b/libsound/EmbedSoundInst.h
@@ -27,6 +27,7 @@
 #include "EmbedSound.h"
 #include "LiveSound.h"
 #include "SoundEnvelope.h" 
+#include "movie_root.h"
 
 // Forward declarations
 namespace gnash {
@@ -64,7 +65,8 @@ public:
     ///                  at the range given by inPoint and outPoint.
     EmbedSoundInst(EmbedSound& def, media::MediaHandler& mh,
             unsigned int inPoint, unsigned int outPoint,
-            const SoundEnvelopes* envelopes, int loopCount);
+	    const SoundEnvelopes* envelopes, int loopCount,
+	    movie_root& mr);
 
     // See dox in sound_handler.h (InputStream)
     virtual bool eof() const;
diff --git a/libsound/LiveSound.cpp b/libsound/LiveSound.cpp
index 843d719..8363177 100644
--- a/libsound/LiveSound.cpp
+++ b/libsound/LiveSound.cpp
@@ -31,23 +31,23 @@ namespace gnash {
 namespace sound {
 
 LiveSound::LiveSound(media::MediaHandler& mh, const media::SoundInfo& info,
-        size_t inPoint)
+		     size_t inPoint, movie_root& mr)
     :
     _inPoint(inPoint * 4),
     _playbackPosition(_inPoint),
     _samplesFetched(0)
 {
-    createDecoder(mh, info);
+    createDecoder(mh, info, mr);
 }
 
 void
-LiveSound::createDecoder(media::MediaHandler& mh, const media::SoundInfo& si)
+LiveSound::createDecoder(media::MediaHandler& mh, const media::SoundInfo& si, movie_root& mr)
 {
 
     media::AudioInfo info(si.getFormat(), si.getSampleRate(), 
         si.is16bit() ? 2 : 1, si.isStereo(), 0, media::CODEC_TYPE_FLASH);
 
-    _decoder.reset(mh.createAudioDecoder(info).release());
+    _decoder.reset(mh.createAudioDecoder(info, mr).release());
 }
 
 unsigned int 
diff --git a/libsound/LiveSound.h b/libsound/LiveSound.h
index 82df6a5..b05d91b 100644
--- a/libsound/LiveSound.h
+++ b/libsound/LiveSound.h
@@ -27,6 +27,7 @@
 #include "InputStream.h" 
 #include "AudioDecoder.h" 
 #include "SimpleBuffer.h" 
+#include "movie_root.h"
 
 // Forward declarations
 namespace gnash {
@@ -55,7 +56,7 @@ protected:
     ///                 for one second of samples).
     /// @param info     The media::SoundInfo for this sound.
     LiveSound(media::MediaHandler& mh, const media::SoundInfo& info,
-            size_t inPoint);
+	      size_t inPoint, movie_root& mr);
 
     // Pointer handling and checking functions
     const std::int16_t* getDecodedData(unsigned long int pos) const {
@@ -131,7 +132,7 @@ private:
     unsigned int fetchSamples(std::int16_t* to, unsigned int nSamples);
 
     void createDecoder(media::MediaHandler& mediaHandler,
-            const media::SoundInfo& info);
+		       const media::SoundInfo& info, movie_root& mr);
 
     virtual bool decodingCompleted() const = 0;
 
diff --git a/libsound/Makefile.am b/libsound/Makefile.am
index 1d0e092..2e567ad 100644
--- a/libsound/Makefile.am
+++ b/libsound/Makefile.am
@@ -67,6 +67,10 @@ noinst_HEADERS = \
 
 libgnashsound_la_CPPFLAGS = \
 	-I$(top_srcdir)/libbase	\
+	-I$(top_srcdir)/libcore	\
+	-I$(top_srcdir)/libcore/swf \
+	-I$(top_srcdir)/libcore/vm \
+	-I$(top_srcdir)/libcore/parser \
 	-I$(top_srcdir)/libmedia \
 	$(PTHREAD_CFLAGS) \
 	$(BOOST_CFLAGS) \
diff --git a/libsound/StreamingSound.cpp b/libsound/StreamingSound.cpp
index 1284ac5..edb4d36 100644
--- a/libsound/StreamingSound.cpp
+++ b/libsound/StreamingSound.cpp
@@ -49,9 +49,9 @@ getInPoint(StreamingSoundData& data, size_t block)
 }
 
 StreamingSound::StreamingSound(StreamingSoundData& sd,
-            media::MediaHandler& mh, sound_handler::StreamBlockId block)
+			       media::MediaHandler& mh, sound_handler::StreamBlockId block, movie_root& mr)
         :
-        LiveSound(mh, sd.soundinfo, getInPoint(sd, block)),
+  LiveSound(mh, sd.soundinfo, getInPoint(sd, block), mr),
         _currentBlock(block),
         _positionInBlock(0),
         _soundDef(sd)
diff --git a/libsound/StreamingSound.h b/libsound/StreamingSound.h
index 6b5276d..a71f7c3 100644
--- a/libsound/StreamingSound.h
+++ b/libsound/StreamingSound.h
@@ -56,7 +56,7 @@ public:
     /// @param blockId  Identifier of the encoded block to start decoding from.
     ///                 @see gnash::swf::StreamSoundBlockTag
     StreamingSound(StreamingSoundData& def, media::MediaHandler& mh,
-            sound_handler::StreamBlockId blockId);
+		   sound_handler::StreamBlockId blockId, movie_root& mr);
 
     // See dox in sound_handler.h (InputStream)
     virtual bool eof() const;
diff --git a/libsound/StreamingSoundData.cpp b/libsound/StreamingSoundData.cpp
index d02c07f..be046d6 100644
--- a/libsound/StreamingSoundData.cpp
+++ b/libsound/StreamingSoundData.cpp
@@ -74,9 +74,9 @@ StreamingSoundData::eraseActiveSound(Instances::iterator i)
 }
 
 std::unique_ptr<StreamingSound>
-StreamingSoundData::createInstance(media::MediaHandler& mh, unsigned long block)
+StreamingSoundData::createInstance(media::MediaHandler& mh, unsigned long block, movie_root& mr)
 {
-    std::unique_ptr<StreamingSound> ret(new StreamingSound(*this, mh, block));
+  std::unique_ptr<StreamingSound> ret(new StreamingSound(*this, mh, block, mr));
 
     std::lock_guard<std::mutex> lock(_soundInstancesMutex);
 
diff --git a/libsound/StreamingSoundData.h b/libsound/StreamingSoundData.h
index 997b4b8..098bf46 100644
--- a/libsound/StreamingSoundData.h
+++ b/libsound/StreamingSoundData.h
@@ -27,6 +27,7 @@
 #include <mutex>
 
 #include "SoundInfo.h" 
+#include "movie_root.h"
 
 // Forward declarations
 namespace gnash {
@@ -125,7 +126,7 @@ public:
     ///                         @see gnash::swf::StreamSoundBlockTag
     /// Locks the _soundInstancesMutex when pushing to it
     std::unique_ptr<StreamingSound> createInstance(media::MediaHandler& mh,
-            unsigned long blockOffset);
+	   unsigned long blockOffset, movie_root& mr);
 
     /// Drop all active sounds
     //
diff --git a/libsound/sound_handler.cpp b/libsound/sound_handler.cpp
index 744bccc..71667c2 100644
--- a/libsound/sound_handler.cpp
+++ b/libsound/sound_handler.cpp
@@ -494,7 +494,7 @@ sound_handler::isSoundPlaying(int handle) const
 }
 
 void
-sound_handler::playStream(int soundId, StreamBlockId blockId)
+sound_handler::playStream(int soundId, StreamBlockId blockId, movie_root& mr)
 {
     StreamingSoundData& s = *_streamingSounds[soundId];
     if (s.isPlaying() || s.empty()) return;
@@ -505,7 +505,7 @@ sound_handler::playStream(int soundId, StreamBlockId blockId)
         }
 
         std::unique_ptr<InputStream> is(
-                s.createInstance(*_mediaHandler, blockId));
+					s.createInstance(*_mediaHandler, blockId, mr));
         plugInputStream(std::move(is));
     }
     catch (const MediaException& e) {
@@ -515,8 +515,8 @@ sound_handler::playStream(int soundId, StreamBlockId blockId)
 
 void
 sound_handler::startSound(int handle, int loops, const SoundEnvelopes* env,
-	               bool allowMultiple, unsigned int inPoint,
-                   unsigned int outPoint)
+			  bool allowMultiple, movie_root& mr, unsigned int inPoint,
+			  unsigned int outPoint)
 {
     // Check if the sound exists
     if (!validHandle(_sounds, handle)) {
@@ -600,7 +600,7 @@ sound_handler::startSound(int handle, int loops, const SoundEnvelopes* env,
         // the set of InputStream channels
         std::unique_ptr<InputStream> sound(
                 sounddata.createInstance(*_mediaHandler, inPoint, outPoint,
-                    env, loops));
+					 env, loops, mr));
         plugInputStream(std::move(sound));
     }
     catch (const MediaException& e) {
diff --git a/libsound/sound_handler.h b/libsound/sound_handler.h
index ea993f3..abe2a76 100644
--- a/libsound/sound_handler.h
+++ b/libsound/sound_handler.h
@@ -34,6 +34,7 @@
 #include "SoundEnvelope.h" // for SoundEnvelopes typedef
 #include "AuxStream.h" // for aux_streamer_ptr typedef
 #include "WAVWriter.h"
+#include "movie_root.h"
 
 namespace gnash {
     namespace media {
@@ -174,9 +175,9 @@ public:
     ///     If false, the sound will not be scheduled if there's another
     ///     instance of it already playing.
     void startSound(int id, int loops, const SoundEnvelopes* env,
-                   bool allowMultiple, unsigned int inPoint = 0,
-                   unsigned int outPoint = 
-                   std::numeric_limits<unsigned int>::max());
+		    bool allowMultiple, movie_root& mr, unsigned int inPoint = 0,
+                    unsigned int outPoint =
+		    std::numeric_limits<unsigned int>::max());
 
     /// Check if an event sound is playing
     //
@@ -270,7 +271,7 @@ public:
     //
     /// @param handle   Id of the sound buffer slot schedule playback of.
     /// @param blockId    Identifier of the block to start decoding from.
-    void playStream(int handle, StreamBlockId blockId);
+    void playStream(int handle, StreamBlockId blockId, movie_root& mr);
 
     /// Get the identifier for the block playing in a specific stream.
     //
