gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r12289: Remove another phantom propf


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r12289: Remove another phantom propflag. Fix the small number of properties that were
Date: Sat, 10 Jul 2010 12:26:30 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 12289 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Sat 2010-07-10 12:26:30 +0200
message:
  Remove another phantom propflag. Fix the small number of properties that were
  relying on it.
  
  Correct Sound class properties, clean up class. Embedded sounds are
  still not individually trackable, so this isn't very clean.
modified:
  libcore/PropFlags.h
  libcore/as_object.cpp
  libcore/as_object.h
  libcore/asobj/Sound_as.cpp
  libcore/asobj/Sound_as.h
  libcore/asobj/XMLNode_as.cpp
  libcore/asobj/flash/geom/Transform_as.cpp
  libsound/EmbedSoundInst.cpp
  testsuite/actionscript.all/Sound.as
  testsuite/libcore.all/PropFlagsTest.cpp
  testsuite/misc-ming.all/EmbeddedSoundTest.c
=== modified file 'libcore/PropFlags.h'
--- a/libcore/PropFlags.h       2010-07-09 10:03:54 +0000
+++ b/libcore/PropFlags.h       2010-07-09 14:25:07 +0000
@@ -47,9 +47,6 @@
                /// Protect from assigning a value
                readOnly        = 1 << 2, // 4
 
-               /// Flags are protected from changes
-               isProtected     = 1 << 4, // 16
-
                /// Only visible by VM initialized for version 6 or higher 
                onlySWF6Up      = 1 << 7, // 128
 
@@ -163,11 +160,6 @@
        /// accesor to the numerical flags value
        int get_flags() const { return _flags; }
 
-       /// Get "protected" flag
-       bool get_is_protected() const {
-        return (_flags & isProtected);
-    }
-
        /// set the numerical flags value (return the new value )
        /// If unlocked is false, you cannot un-protect from over-write,
        /// you cannot un-protect from deletion and you cannot
@@ -183,11 +175,8 @@
        ///
        bool set_flags(const int setTrue, const int setFalse = 0)
        {
-               if (get_is_protected()) return false;
-
                _flags &= ~setFalse;
                _flags |= setTrue;
-
                return true;
        }
 };
@@ -199,7 +188,6 @@
        if ( fl.get_read_only() ) os << " readonly";
        if ( fl.get_dont_delete() ) os << " nodelete";
        if ( fl.get_dont_enum() ) os << " noenum";
-       if ( fl.get_is_protected() ) os << " protected";
        os << " )";
        // TODO: visibility flags
        return os;

=== modified file 'libcore/as_object.cpp'
--- a/libcore/as_object.cpp     2010-07-09 10:57:44 +0000
+++ b/libcore/as_object.cpp     2010-07-09 14:25:07 +0000
@@ -558,7 +558,7 @@
     
     // This is a particularly clear and concise way of removing dead triggers.
     EraseIf(*_trigs, boost::bind(boost::mem_fn(&Trigger::dead), 
-                                 
boost::bind(SecondElement<TriggerContainer::value_type>(), _1)));
+             boost::bind(SecondElement<TriggerContainer::value_type>(), _1)));
                     
     // The trigger call could have deleted the property,
     // so we check for its existence again, and do NOT put
@@ -744,8 +744,7 @@
 {
     string_table::key k = getStringTable(*this).find(key);
 
-    init_property(k, getter, getter,
-                  initflags | PropFlags::readOnly | PropFlags::isProtected);
+    init_property(k, getter, getter, initflags | PropFlags::readOnly);
     assert(_members.getProperty(k));
 }
 
@@ -753,8 +752,7 @@
 as_object::init_readonly_property(const ObjectURI& uri, as_function& getter,
                                   int initflags)
 {
-    init_property(uri, getter, getter,
-                  initflags | PropFlags::readOnly | PropFlags::isProtected);
+    init_property(uri, getter, getter, initflags | PropFlags::readOnly);
     assert(_members.getProperty(uri));
 }
 
@@ -764,8 +762,7 @@
 {
     string_table::key k = getStringTable(*this).find(key);
 
-    init_property(k, getter, getter,
-                  initflags | PropFlags::readOnly | PropFlags::isProtected);
+    init_property(k, getter, getter, initflags | PropFlags::readOnly);
     assert(_members.getProperty(k));
 }
 
@@ -773,8 +770,7 @@
 as_object::init_readonly_property(const ObjectURI& uri,
                                   as_c_function_ptr getter, int initflags)
 {
-    init_property(uri, getter, getter, initflags | PropFlags::readOnly
-                  | PropFlags::isProtected);
+    init_property(uri, getter, getter, initflags | PropFlags::readOnly);
     assert(_members.getProperty(uri));
 }
 

=== modified file 'libcore/as_object.h'
--- a/libcore/as_object.h       2010-07-09 10:57:44 +0000
+++ b/libcore/as_object.h       2010-07-09 14:25:07 +0000
@@ -257,11 +257,6 @@
     virtual bool set_member(const ObjectURI& uri, const as_value& val,
         bool ifFound = false);
 
-    /// Reserve a slot
-    ///
-    /// Reserves a slot for a property to follow.
-    void reserveSlot(const ObjectURI& uri, boost::uint16_t slotId);
-
     /// Initialize a member value by string
     //
     /// This is just a wrapper around the other init_member method
@@ -290,9 +285,6 @@
     ///
     /// @param flags    Flags for the new member. By default dontDelete
     ///                 and dontEnum.
-    /// @param slotId   If this is a non-negative value which will fit in
-    ///                 an unsigned short, this is used as the slotId and
-    ///                 can be subsequently found with get_slot
     void init_member(const ObjectURI& uri, const as_value& val, 
         int flags = DefaultFlags);
 

=== modified file 'libcore/asobj/Sound_as.cpp'
--- a/libcore/asobj/Sound_as.cpp        2010-07-09 06:42:56 +0000
+++ b/libcore/asobj/Sound_as.cpp        2010-07-10 06:46:47 +0000
@@ -17,9 +17,15 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
+#include "Sound_as.h"
+
+#include <string>
+#include <boost/scoped_ptr.hpp>
+#include <boost/scoped_array.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/cstdint.hpp>
 
 #include "RunResources.h"
-#include "Sound_as.h"
 #include "log.h"
 #include "sound_handler.h"
 #include "AudioDecoder.h"
@@ -36,9 +42,8 @@
 #include "VM.h"
 #include "namedStrings.h"
 #include "StreamProvider.h"
-
-#include <string>
-
+#include "ObjectURI.h"
+#include "Relay.h"
 
 
 namespace gnash {
@@ -50,8 +55,6 @@
     as_value sound_getbytesloaded(const fn_call& fn);
     as_value sound_setPosition(const fn_call& fn);
     as_value sound_areSoundsInaccessible(const fn_call& fn);
-    as_value sound_duration(const fn_call& fn);
-    as_value sound_position(const fn_call& fn);
     as_value sound_getbytestotal(const fn_call& fn);
     as_value sound_getpan(const fn_call& fn);
     as_value sound_setpan(const fn_call& fn);
@@ -66,17 +69,182 @@
     as_value sound_start(const fn_call& fn);
     as_value sound_stop(const fn_call& fn);
     as_value checkPolicyFile_getset(const fn_call& fn);
-    as_value sound_load(const fn_call& fn);
-    as_value sound_play(const fn_call& fn);
-    as_value sound_complete(const fn_call& fn);
-    as_value sound_id3(const fn_call& fn);
-    as_value sound_ioError(const fn_call& fn);
-    as_value sound_open(const fn_call& fn);
-    as_value sound_progress(const fn_call& fn);
     as_value sound_ctor(const fn_call& fn);
     void attachSoundInterface(as_object& o);
 }
 
+/// A Sound object in ActionScript can control and play sound
+//
+/// Two types of sound are handled:
+///
+/// 1. external sounds, either loaded or streamed
+/// 2. embedded sounds, referenced by library (export) symbol.
+//
+/// Sound objects also control volume, pan, and other properties for a target
+/// movieclip.
+//
+/// Sound_as objects
+//
+/// 1. May be associated with a particular DisplayObject.
+/// 2. May be associated with one or more playing sounds.
+//
+/// A Sound_as that is not associated with a particular DisplayObject controls
+/// the sound properties of the whole Movie.
+class Sound_as : public ActiveRelay
+{
+
+public:
+
+    Sound_as(as_object* owner);
+    
+    ~Sound_as();
+    
+    /// Make this sound control the given DisplayObject
+    //
+    /// NOTE: 0 is accepted, to implement an "invalid"
+    ///       controller type.
+    ///
+    void attachCharacter(DisplayObject* attachedChar);
+
+    void attachSound(int si, const std::string& name);
+
+    /// Get number of bytes loaded.
+    //
+    /// This only applies to external sounds. If unknown or not external, -1
+    /// is returned.
+    long getBytesLoaded();
+
+    /// Get total number of bytes in the external sound being loaded
+    //
+    /// This only applies to external sounds. If unknown or not external, -1
+    /// is returned.
+    long getBytesTotal();
+
+    /// Whether the Sound_as has any sound data
+    bool active() const {
+        return soundId >= 0 || isStreaming;
+    }
+
+    /// Get the pan setting of the attached DisplayObject.
+    //
+    /// If no object is attached, this retrieves settings for the whole Movie.
+    void getPan();
+
+    /// Get the sound transform of the attached DisplayObject.
+    //
+    /// If no object is attached, this retrieves settings for the whole Movie.
+    void getTransform();
+
+    /// Get volume from associated resource
+    //
+    /// @return true of volume was obtained, false
+    ///         otherwise (for example if the associated
+    ///         DisplayObject was unloaded).
+    ///
+    bool getVolume(int& volume);
+    void setVolume(int volume);
+
+    /// Load an external sound.
+    //
+    /// The Sound object is then associated with the external sound.
+    void loadSound(const std::string& file, bool streaming);
+
+    void setPan();
+
+    void setTransform();
+
+    void start(double secsStart, int loops);
+
+    void stop(int si);
+
+    /// Get the duration of the sound.
+    //
+    /// This is only meaningful when the Sound_as object has an associated
+    /// sound, that is after attachSound or loadSound has been called.
+    size_t getDuration() const;
+
+    /// Get the position within the sound.
+    //
+    /// This is only meaningful when the Sound_as object has an associated
+    /// sound, that is after attachSound or loadSound has been called.
+    size_t getPosition() const;
+
+    std::string soundName;  
+
+private:
+
+    void markReachableResources() const;
+
+    boost::scoped_ptr<CharacterProxy> _attachedCharacter;
+    int soundId;
+    bool externalSound;
+    bool isStreaming;
+
+    sound::sound_handler* _soundHandler;
+
+    media::MediaHandler* _mediaHandler;
+
+    boost::scoped_ptr<media::MediaParser> _mediaParser;
+
+    boost::scoped_ptr<media::AudioDecoder> _audioDecoder;
+
+    /// Number of milliseconds into the sound to start it
+    //
+    /// This is set by start()
+    boost::uint64_t _startTime;
+
+    boost::scoped_array<boost::uint8_t> _leftOverData;
+    boost::uint8_t* _leftOverPtr;
+    boost::uint32_t _leftOverSize;
+
+    /// This is a sound_handler::aux_streamer_ptr type.
+    static unsigned int getAudioWrapper(void *owner, boost::int16_t* samples,
+            unsigned int nSamples, bool& etEOF);
+
+    unsigned int getAudio(boost::int16_t* samples, unsigned int nSamples,
+            bool& atEOF);
+
+    /// The aux streamer for sound handler
+    sound::InputStream* _inputStream;
+
+    int remainingLoops;
+
+    /// Query media parser for audio info, create decoder and attach aux 
streamer
+    /// if found.
+    ///
+    /// @return  an InputStream* if audio found and aux streamer attached,
+    ///          0 if no audio found.
+    ///
+    /// May throw a MediaException if audio was found but
+    /// audio decoder could not be created
+    /// 
+    sound::InputStream* attachAuxStreamerIfNeeded();
+
+    /// Register a timer for audio info probing
+    void startProbeTimer();
+
+    /// Unregister the probe timer
+    void stopProbeTimer();
+
+    virtual void update();
+
+    /// Probe audio
+    void probeAudio();
+
+    bool _soundCompleted;
+
+    boost::mutex _soundCompletedMutex;
+
+    /// Thread-safe setter for _soundCompleted
+    void markSoundCompleted(bool completed);
+    
+    // Does this sound have a live input stream?
+    bool isAttached() const {
+        return (_inputStream);
+    }
+
+};
+
 Sound_as::Sound_as(as_object* owner) 
     :
     ActiveRelay(owner),
@@ -92,14 +260,15 @@
     _leftOverSize(0),
     _inputStream(0),
     remainingLoops(0),
-    _probeTimer(0),
     _soundCompleted(false)
 {
 }
 
 Sound_as::~Sound_as()
 {
-    //GNASH_REPORT_FUNCTION;
+
+    // Just in case...
+    stopProbeTimer();
 
     if (_inputStream && _soundHandler) {
         _soundHandler->unplugInputStream(_inputStream);
@@ -152,7 +321,6 @@
 void
 Sound_as::startProbeTimer()
 {
-    _probeTimer = 1;
     getRoot(owner()).addAdvanceCallback(this);
 }
 
@@ -163,25 +331,27 @@
 #ifdef GNASH_DEBUG_SOUND_AS
     log_debug("stopProbeTimer called");
 #endif
-
-    if ( _probeTimer ) {
-        getRoot(owner()).removeAdvanceCallback(this);
-        log_debug(" sound callback removed");
-        _probeTimer = 0;
-    }
+    getRoot(owner()).removeAdvanceCallback(this);
 }
 
 void
 Sound_as::update()
 {
     probeAudio();
+
+    string_table& st = getStringTable(owner());
+
+    if (active()) {
+        owner().set_member(st.find("duration"), getDuration());
+        owner().set_member(st.find("position"), getPosition());
+    }
 }
 
-/*private*/
 void
 Sound_as::probeAudio()
 {
-    if ( isAttached() ) {
+
+    if (isAttached()) {
 #ifdef GNASH_DEBUG_SOUND_AS
         log_debug("Probing audio for end");
 #endif
@@ -191,14 +361,15 @@
             // when _soundCompleted is true we're
             // NOT attached !
             _mediaParser.reset(); // no use for this anymore...
-            _inputStream=0;
-            _soundCompleted=false;
+            _inputStream = 0;
+            _soundCompleted = false;
             stopProbeTimer();
 
             // dispatch onSoundComplete 
             callMethod(&owner(), NSV::PROP_ON_SOUND_COMPLETE);
         }
-    } else {
+    }
+    else if (_mediaParser) {
 #ifdef GNASH_DEBUG_SOUND_AS
         log_debug("Probing audio for start");
 #endif
@@ -206,7 +377,8 @@
         bool parsingCompleted = _mediaParser->parsingCompleted();
         try {
             _inputStream = attachAuxStreamerIfNeeded();
-        } catch (MediaException& e) {
+        } 
+        catch (MediaException& e) {
             assert(!_inputStream);
             assert(!_audioDecoder.get());
             log_error(_("Could not create audio decoder: %s"), e.what());
@@ -258,6 +430,11 @@
 {
     soundId = si;
     soundName = name;
+    
+    string_table& st = getStringTable(owner());
+    owner().set_member(st.find("duration"), getDuration());
+    owner().set_member(st.find("position"), getPosition());
+
 }
 
 long
@@ -380,13 +557,18 @@
     // TODO: use global _soundbuftime
     _mediaParser->setBufferTime(60000); // one minute buffer... should be fine
 
-    if ( isStreaming ) {
+    if (isStreaming) {
         startProbeTimer();
-    } else {
+    } 
+    else {
         LOG_ONCE(log_unimpl("Non-streaming Sound.loadSound: will behave "
                     "as a streaming one"));
         // if not streaming, we'll probe on .start()
     }
+
+    string_table& st = getStringTable(owner());
+    owner().set_member(st.find("duration"), getDuration());
+    owner().set_member(st.find("position"), getPosition());
 }
 
 sound::InputStream*
@@ -490,9 +672,6 @@
         //       loaded before starting to play it (!isStreaming case)
         startProbeTimer();
 
-        //if ( ! _inputStream ) {
-        //  _inputStream=_soundHandler->attach_aux_streamer(getAudioWrapper, 
(void*) this);
-        //}
     } else {
         unsigned int inPoint = 0;
 
@@ -509,6 +688,7 @@
                     true, // allow multiple instances (checked)
                     inPoint
                     );
+        startProbeTimer();
     }
 }
 
@@ -535,8 +715,8 @@
     }
 }
 
-unsigned int
-Sound_as::getDuration()
+size_t
+Sound_as::getDuration() const
 {
     if ( ! _soundHandler ) {
         log_error("No sound handler, can't check duration...");
@@ -560,11 +740,12 @@
     return 0;
 }
 
-unsigned int
-Sound_as::getPosition()
+size_t
+Sound_as::getPosition() const
 {
-    if ( ! _soundHandler ) {
-        log_error("No sound handler, can't check position (we're likely not 
playing anyway)...");
+    if (!_soundHandler) {
+        log_error("No sound handler, can't check position (we're "
+                "likely not playing anyway)...");
         return 0;
     }
 
@@ -573,7 +754,7 @@
         return _soundHandler->tell(soundId);
     }
 
-    if ( _mediaParser ) {
+    if (_mediaParser) {
         boost::uint64_t ts;
         if ( _mediaParser->nextAudioFrameTimestamp(ts) ) {
             return ts;
@@ -711,11 +892,6 @@
 
     o.init_member("areSoundsInaccessible", vm.getNative(500, 16), flagsn9);
 
-    // Properties
-    //there's no such thing as an ID3 member (swfdec shows)
-    o.init_readonly_property("duration", &sound_duration);
-    o.init_readonly_property("position", &sound_position);
-
     int fl_hp = PropFlags::dontEnum | PropFlags::dontDelete;
 
     o.init_property("checkPolicyFile", &checkPolicyFile_getset, 
@@ -726,7 +902,6 @@
 as_value
 sound_new(const fn_call& fn)
 {
-
     as_object* so = fn.this_ptr;
     Sound_as* s(new Sound_as(so));
     so->setRelay(s);
@@ -742,18 +917,21 @@
 
 
         const as_value& arg0 = fn.arg(0);
-        if ( ! arg0.is_null() && ! arg0.is_undefined() ) {
+
+        if (!arg0.is_null() && !arg0.is_undefined()) {
+
             as_object* obj = arg0.to_object(getGlobal(fn));
             DisplayObject* ch = get<DisplayObject>(obj);
             IF_VERBOSE_ASCODING_ERRORS(
-            if (!ch) {
-                std::stringstream ss; fn.dump_args(ss);
-                log_aserror("new Sound(%s) : first argument isn't null "
-                    "or undefined, and isn't a DisplayObject. "
-                    "We'll take as an invalid DisplayObject ref.",
-                    ss.str());
-            }
+                if (!ch) {
+                    std::stringstream ss; fn.dump_args(ss);
+                    log_aserror("new Sound(%s) : first argument isn't null "
+                        "or undefined, and isn't a DisplayObject. "
+                        "We'll take as an invalid DisplayObject ref.",
+                        ss.str());
+                }
             );
+
             s->attachCharacter(ch);
         }
     }
@@ -830,9 +1008,10 @@
 as_value
 sound_attachsound(const fn_call& fn)
 {
-    IF_VERBOSE_ACTION (
-    log_action(_("-- attach sound"));
+    IF_VERBOSE_ACTION(
+        log_action(_("-- attach sound"));
     )
+
     if (fn.nargs < 1) {
         IF_VERBOSE_ASCODING_ERRORS(
         log_aserror(_("attach sound needs one argument"));
@@ -879,6 +1058,7 @@
     // sanity check
     assert(si >= 0);
     so->attachSound(si, name);
+
     return as_value();
 }
 
@@ -908,10 +1088,11 @@
 }
 
 as_value
-sound_getDuration(const fn_call& /*fn*/)
+sound_getDuration(const fn_call& fn)
 {
-    LOG_ONCE( log_unimpl ("Sound.getDuration()") );
-    return as_value();
+    Sound_as* so = ensure<ThisIsNative<Sound_as> >(fn);
+    if (!so->active()) return as_value();
+    return as_value(so->getDuration());
 }
 
 as_value
@@ -922,10 +1103,11 @@
 }
 
 as_value
-sound_getPosition(const fn_call& /*fn*/)
+sound_getPosition(const fn_call& fn)
 {
-    LOG_ONCE( log_unimpl ("Sound.getPosition()") );
-    return as_value();
+    Sound_as* so = ensure<ThisIsNative<Sound_as> >(fn);
+    if (!so->active()) return as_value();
+    return as_value(so->getPosition());
 }
 
 as_value
@@ -1025,13 +1207,6 @@
 }
 
 as_value
-sound_duration(const fn_call& fn)
-{
-    Sound_as* so = ensure<ThisIsNative<Sound_as> >(fn);
-    return as_value(so->getDuration());
-}
-
-as_value
 checkPolicyFile_getset(const fn_call& /*fn*/)
 {
     LOG_ONCE( log_unimpl ("Sound.checkPolicyFile") );
@@ -1052,78 +1227,6 @@
 }
 
 as_value
-sound_position(const fn_call& fn)
-{
-    Sound_as* so = ensure<ThisIsNative<Sound_as> >(fn);
-
-    return as_value(so->getPosition());
-}
-
-
-as_value
-sound_load(const fn_call& fn)
-{
-    Sound_as* ptr = ensure<ThisIsNative<Sound_as> >(fn);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-sound_play(const fn_call& fn)
-{
-    Sound_as* ptr = ensure<ThisIsNative<Sound_as> >(fn);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-sound_complete(const fn_call& fn)
-{
-    Sound_as* ptr = ensure<ThisIsNative<Sound_as> >(fn);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-sound_id3(const fn_call& fn)
-{
-    Sound_as* ptr = ensure<ThisIsNative<Sound_as> >(fn);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-sound_ioError(const fn_call& fn)
-{
-    Sound_as* ptr = ensure<ThisIsNative<Sound_as> >(fn);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-sound_open(const fn_call& fn)
-{
-    Sound_as* ptr = ensure<ThisIsNative<Sound_as> >(fn);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-sound_progress(const fn_call& fn)
-{
-    Sound_as* ptr = ensure<ThisIsNative<Sound_as> >(fn);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
 sound_ctor(const fn_call& fn)
 {
     as_object* obj = fn.this_ptr;

=== modified file 'libcore/asobj/Sound_as.h'
--- a/libcore/asobj/Sound_as.h  2010-07-09 06:42:56 +0000
+++ b/libcore/asobj/Sound_as.h  2010-07-10 06:31:54 +0000
@@ -20,172 +20,12 @@
 #ifndef GNASH_ASOBJ3_SOUND_H
 #define GNASH_ASOBJ3_SOUND_H
 
-
-#include "smart_ptr.h" //GNASH_USE_GC
-#include "Relay.h"
-
-#include <string>
-#include <boost/scoped_ptr.hpp>
-#include <boost/scoped_array.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/cstdint.hpp> // For C99 int types
-
 namespace gnash {
-
-// Forward declarations
-class CharacterProxy;
-       namespace sound {
-               class sound_handler;
-               class InputStream;
-       }
-       namespace media {
-               class MediaHandler;
-               class MediaParser;
-               class AudioDecoder;
-       }
-       
-       class fn_call;
-       class as_object;
     struct ObjectURI;
-    class DisplayObject;
-
-class Sound_as : public ActiveRelay
-{
-
-public:
-    Sound_as(as_object* owner);
-    
-    ~Sound_as();
-    
-    /// Make this sound control the given DisplayObject
-    //
-    /// NOTE: 0 is accepted, to implement an "invalid"
-    ///       controller type.
-    ///
-    void attachCharacter(DisplayObject* attachedChar);
-
-    void attachSound(int si, const std::string& name);
-
-    /// Get number of bytes loaded from the external sound (if any)
-    long getBytesLoaded();
-
-    /// Get total number of bytes in the external sound being loaded
-    //
-    /// @return -1 if unknown
-    ///
-    long getBytesTotal();
-
-    void getPan();
-    void getTransform();
-
-    /// Get volume from associated resource
-    //
-    /// @return true of volume was obtained, false
-    ///         otherwise (for example if the associated
-    ///         DisplayObject was unloaded).
-    ///
-    bool getVolume(int& volume);
-    void setVolume(int volume);
-
-    void loadSound(const std::string& file, bool streaming);
-    void setPan();
-    void setTransform();
-    void start(double secsStart, int loops);
-    void stop(int si);
-    unsigned int getDuration();
-    unsigned int getPosition();
-
-    std::string soundName;  
-
-private:
-
-#ifdef GNASH_USE_GC
-    /// Mark all reachable resources of a Sound, for the GC
-    //
-    /// Reachable resources are:
-    /// - attached DisplayObject object (attachedCharacter)
-    ///
-    void markReachableResources() const;
-#endif // GNASH_USE_GC
-
-    bool _duration;
-    bool _id3;
-    bool _onID3;
-    bool _onLoad;
-    bool _onComplete;
-    bool _position;
-
-    boost::scoped_ptr<CharacterProxy> _attachedCharacter;
-    int soundId;
-    bool externalSound;
-    std::string externalURL;
-    bool isStreaming;
-
-    sound::sound_handler* _soundHandler;
-
-    media::MediaHandler* _mediaHandler;
-
-    boost::scoped_ptr<media::MediaParser> _mediaParser;
-
-    boost::scoped_ptr<media::AudioDecoder> _audioDecoder;
-
-    /// Number of milliseconds into the sound to start it
-    //
-    /// This is set by start()
-    boost::uint64_t _startTime;
-
-    boost::scoped_array<boost::uint8_t> _leftOverData;
-    boost::uint8_t* _leftOverPtr;
-    boost::uint32_t _leftOverSize;
-
-    /// This is a sound_handler::aux_streamer_ptr type.
-    static unsigned int getAudioWrapper(void *owner, boost::int16_t* samples,
-            unsigned int nSamples, bool& etEOF);
-
-    unsigned int getAudio(boost::int16_t* samples, unsigned int nSamples,
-            bool& atEOF);
-
-    /// The aux streamer for sound handler
-    sound::InputStream* _inputStream;
-
-    int remainingLoops;
-
-    /// Query media parser for audio info, create decoder and attach aux 
streamer
-    /// if found.
-    ///
-    /// @return  an InputStream* if audio found and aux streamer attached,
-    ///          0 if no audio found.
-    ///
-    /// May throw a MediaException if audio was found but
-    /// audio decoder could not be created
-    /// 
-    sound::InputStream* attachAuxStreamerIfNeeded();
-
-    /// Register a timer for audio info probing
-    void startProbeTimer();
-
-    /// Unregister the probe timer
-    void stopProbeTimer();
-
-    virtual void update();
-
-    /// Probe audio
-    void probeAudio();
-
-    int _probeTimer;
-
-    bool _soundCompleted;
-
-    boost::mutex _soundCompletedMutex;
-
-    /// Thread-safe setter for _soundCompleted
-    void markSoundCompleted(bool completed);
-
-    /// Is this sound attached to the soundhandler?
-    bool isAttached() const {
-        return _inputStream!=0;
-    }
-};
+    class as_object;
+}
+
+namespace gnash {
 
 void sound_class_init(as_object& where, const ObjectURI& uri);
 
@@ -193,7 +33,6 @@
 
 } // gnash namespace
 
-// GNASH_ASOBJ3_SOUND_H
 #endif
 
 // local Variables:

=== modified file 'libcore/asobj/XMLNode_as.cpp'
--- a/libcore/asobj/XMLNode_as.cpp      2010-07-09 07:11:32 +0000
+++ b/libcore/asobj/XMLNode_as.cpp      2010-07-09 14:25:07 +0000
@@ -523,7 +523,7 @@
     o.init_member("getNamespaceForPrefix", vm.getNative(253, 7), noFlags);
     o.init_member("getPrefixForNamespace", vm.getNative(253, 8), noFlags);
 
-    const int protectedFlags = PropFlags::isProtected;
+    const int protectedFlags = 0;
 
     // Just the protected flag:
     o.init_property("nodeValue", &xmlnode_nodeValue, 

=== modified file 'libcore/asobj/flash/geom/Transform_as.cpp'
--- a/libcore/asobj/flash/geom/Transform_as.cpp 2010-03-11 01:47:08 +0000
+++ b/libcore/asobj/flash/geom/Transform_as.cpp 2010-07-09 14:25:07 +0000
@@ -426,7 +426,7 @@
 void
 attachTransformInterface(as_object& o)
 {
-    const int protectedFlags = PropFlags::isProtected;
+    const int protectedFlags = 0;
 
     o.init_property("matrix", transform_matrix, transform_matrix,
             protectedFlags);

=== modified file 'libsound/EmbedSoundInst.cpp'
--- a/libsound/EmbedSoundInst.cpp       2010-01-25 18:52:20 +0000
+++ b/libsound/EmbedSoundInst.cpp       2010-07-09 15:49:25 +0000
@@ -74,7 +74,6 @@
         envelopes(env),
         current_env(0),
         _samplesFetched(0),
-
         _decoder(0),
         _soundDef(soundData),
         _decodedData(0)
@@ -192,6 +191,7 @@
 
                 // Start next loop
                 playbackPosition = _inPoint; 
+                _samplesFetched = 0;
 
                 continue;
             }

=== modified file 'testsuite/actionscript.all/Sound.as'
--- a/testsuite/actionscript.all/Sound.as       2010-01-11 06:41:38 +0000
+++ b/testsuite/actionscript.all/Sound.as       2010-07-09 15:23:08 +0000
@@ -113,9 +113,9 @@
 
 // The following are undefined in SWF5..SWF8, chances are
 // some ASSetPropFlag to drop SWF9-only flag would expose
-xcheck_equals(typeof(s1.duration), 'undefined');
+check_equals(typeof(s1.duration), 'undefined');
 check_equals(typeof(s1.ID3), 'undefined');
-xcheck_equals(typeof(s1.position), 'undefined');
+check_equals(typeof(s1.position), 'undefined');
 
 
 //
@@ -137,9 +137,9 @@
 
 // The following are undefined in SWF5..SWF8, chances are
 // some ASSetPropFlag to drop SWF9-only flag would expose
-xcheck_equals(typeof(s2.duration), 'undefined');
+check_equals(typeof(s2.duration), 'undefined');
 check_equals(typeof(s2.ID3), 'undefined');
-xcheck_equals(typeof(s2.position), 'undefined');
+check_equals(typeof(s2.position), 'undefined');
 
 // this is still valid, altought getVolume would return undefined
 s3 = new Sound(33);
@@ -254,7 +254,7 @@
 
 check_equals(typeof(s.getBytesLoaded()), "undefined");
 check_equals(typeof(s.getBytesTotal()), "undefined");
-xcheck_equals(typeof(s.duration), "undefined");
+check_equals(typeof(s.duration), "undefined");
 check_equals(typeof(s.getPosition()), "undefined");
 check_equals(typeof(s.getDuration()), "undefined");
 
@@ -264,9 +264,9 @@
 
 check_equals(typeof(s.getBytesTotal()), "number");
 check_equals(typeof(s.getBytesLoaded()), "number");
-xcheck_equals(typeof(s.getPosition()), "number");
+check_equals(typeof(s.getPosition()), "number");
 check_equals(typeof(s.duration), "number");
-xcheck_equals(typeof(s.getDuration()), "number");
+check_equals(typeof(s.getDuration()), "number");
 
 //s.loadSound(MEDIA(brokenchord.wav), true); 
 

=== modified file 'testsuite/libcore.all/PropFlagsTest.cpp'
--- a/testsuite/libcore.all/PropFlagsTest.cpp   2010-01-11 06:41:38 +0000
+++ b/testsuite/libcore.all/PropFlagsTest.cpp   2010-07-09 15:02:03 +0000
@@ -39,7 +39,6 @@
        PropFlags flags;
 
        // Check initial state
-       check(!flags.get_is_protected());
        check(!flags.get_read_only());
        check(!flags.get_dont_enum());
        check(!flags.get_dont_delete());

=== modified file 'testsuite/misc-ming.all/EmbeddedSoundTest.c'
--- a/testsuite/misc-ming.all/EmbeddedSoundTest.c       2010-05-25 11:47:19 
+0000
+++ b/testsuite/misc-ming.all/EmbeddedSoundTest.c       2010-07-09 15:23:08 
+0000
@@ -132,7 +132,11 @@
     add_actions(mo, "d_soundComplete = 0;");
     add_actions(mo, "e_soundComplete = 0;");
 
-    add_actions(mo, "a = new Sound(); a.attachSound('mono22_mp2');");
+    add_actions(mo, "a = new Sound();");
+    check_equals(mo, "a.duration", "undefined");
+    add_actions(mo, "a.attachSound('mono22_mp2');");
+    check_equals(mo, "a.duration", "13740");
+
     add_actions(mo, "b = new Sound(); b.attachSound('mono22_mp2b');");
     add_actions(mo, "c = new Sound(); c.attachSound('stereo8_mp3');");
 
@@ -140,7 +144,6 @@
     add_actions(mo, "d = new Sound(); d.attachSound('stereo8_mp3b');");
     add_actions(mo, "e = new Sound(); e.attachSound('stereo8_mp3b');");
 
-    check_equals(mo, "a.duration", "13740");
     add_actions(mo, "check_equals(a.getBytesTotal(), undefined);");
     add_actions(mo, "check_equals(a.getBytesLoaded(), undefined);");
     add_actions(mo, "check_equals(a.id3, undefined);");


reply via email to

[Prev in Thread] Current Thread [Next in Thread]