MP3 data in an SWF can be of a different sample rate than
indicated in the SWF tag, so grab the sample rate from the MP3
decoder instead of passing it in from the SWF tag.
Also, a general clean up of the MP3 decoders.
Fixes#335.
Fix various issues with `SoundChannel`:
* Change `avm2::Object::as_sound_instance` to `as_sound_channel`.
* Cache sound position in `SoundChannelObject`.
* `SoundInfo::in_sample` is in units of 44100Hz.
* Clamp `num_loops` to 1.
* Change `AudioBackend::get_sound_position` to return `f64` to
match `AudioBackend::get_sound_duration`.
* Wire up `AudioBackend::get_sound_position` to `Sound.position`.
* Remove unimplmeneted warning from `Sound.position`.
This is a temporary hack to calculate depth from `base_proto` and
`this`, so that changing `this.__proto__` will affect `super`.
In the future, `depth` should be passed instead of `base_proto`.
In case the method is found directly on `this` (normally it shouldn't
because it's usually defined on `this.__proto__`), it seems like the
`super` object behaves identically as-if the method was found on
the object's prototype.
Previously constructions had `base_proto` set to the newly-created
object (`this`). However this doesn't match the `base_proto` of method
calls, which is `this.__proto__` (or more precisely where the function
is found on the prototype chain). This caused wrong behavior when using
the `super` object from within constructors.
Change `base_proto` in that case to be `this.__proto__`, which aligns
with method calls.
In order to keep things working, `SuperObject::call` needs to look-up
one level less than before.
An alternative can be changing `base_proto` for method calls instead,
but that seems to be harder because this would require `search_prototype`
to return the before-last visited object in the prototype chain.
When a function is defined, the base clip is stored in the function
object, and used when the function is called in SWFv6+. This
affects the target clip for GotoFrame and other actions.
However, if that base clip no longer exists when the function is
called, the base clip should default to the `this` display object.
Previously Ruffle would still use the previously unloaded base clip.
If a movieclip calls a seek operation like `gotoAndStop` on
itself while executing a frame script, this goto is not executed
until the frame script has completed. In contrast, calling a goto
on other clips will execute the goto immediately.
Slots and const traits should initialize to an appropriate value
for their type if no default is specified. Remove the `Option`
from `default_value`, and always set it to an appropriate null-ish
value (`0` for ints, `NaN` for `Number`, `null` for objects, etc.)
Gated behind the "vp6" feature, enabled by default.
Utilizing a heavily stripped-down version of the NihAV project,
retaining only the VP6 decoder, relicensed under MIT.
Including VP6WithAlpha decoding, proper FrameDependency reporting,
and cropping the unwanted encoded pixels on the right/bottom manually.