Commit Graph

10454 Commits

Author SHA1 Message Date
David Wendt 6e3c468592 core: When reading part of a `Substream` slice for the tag reader, don't throw out the rest of it 2023-08-23 15:36:20 -06:00
David Wendt 046a1f0efc core: When loading new data into a `NetStream` you must always clear the existing data out first.
`init_buffer` will remove all existing buffer state and prepare the `NetStream` to accept a new/different video.
2023-08-23 15:36:20 -06:00
David Wendt 3b90e75b17 core: AVM1 streams do not need to be attached to a movie clip in order to play audio 2023-08-23 15:36:20 -06:00
David Wendt 3fd31f1739 core: Fix #12502.
This would ordinarily be a separate branch but the fix deadlocks without the new buffer type.
2023-08-23 15:36:20 -06:00
David Wendt 2d0815c013 tests: Add test cases for `SliceCursor` 2023-08-23 15:36:20 -06:00
David Wendt 4ee721e5c2 chore: Fix various cargo errors 2023-08-23 15:36:20 -06:00
David Wendt 304f04952d core: `get_sound_duration` does not accept `SoundInstanceHandles` and I don't know why the compiler didn't flag this 2023-08-23 15:36:20 -06:00
David Wendt a55ba16c29 core: When playing audio, queue all the tags first and then start the sound.
This prevents the sound from finishing before we can add a second slice to it.
2023-08-23 15:36:20 -06:00
David Wendt 8113b3a5f8 core: Allow the MP3 decoder to look ahead by up to 5 tags in the FLV to try and get rid of audio stuttering
Spolier alert: this doesn't work, I'm just committing this for archival purposes.
2023-08-23 15:36:20 -06:00
David Wendt 1b7eb646b6 core: Split all FLV audio, video, and script tag processing into separate functions. 2023-08-23 15:36:20 -06:00
David Wendt 257aabe4c0 core: `SubstreamChunksIter` must always advance on `next`! 2023-08-23 15:36:20 -06:00
David Wendt 782181557b core: Fix `SubstreamTagReader`'s chunk resizing 2023-08-23 15:36:20 -06:00
David Wendt cfe8b3c464 core: Add `LowerHex` and `UpperHex` representations of `Slice` and `SliceRef` for debugging. 2023-08-23 15:36:20 -06:00
David Wendt 7158039135 audio: Audio streamed from FLVs do not have the SWF MP3 header 2023-08-23 15:36:20 -06:00
David Wendt dde4579a9e core: `Substream` sounds must be started with at least one data block in them 2023-08-23 15:36:20 -06:00
David Wendt 438f53a936 core: Explicitly report a `TooManySounds` error instead of coercing all failure modes into returning `None` in `AudioManager` 2023-08-23 15:36:20 -06:00
David Wendt be3787a489 core: Fix `SubstreamCursor` not accounting for consumed bytes properly 2023-08-23 15:36:20 -06:00
David Wendt 9b29791eeb avm1: Implement `MovieClip.attachAudio`.
`NetStream`s in AVM1 do not play audio unless attached to a `MovieClip`. As far as I can tell there doesn't seem to be any equivalent API in AVM2.
2023-08-23 15:36:20 -06:00
David Wendt dbee260d79 core: Stream audio data from FLVs into the audio backend 2023-08-23 15:36:20 -06:00
David Wendt f5d6bf9fb9 audio: Add support for playing substream sounds through the audio manager 2023-08-23 15:36:20 -06:00
David Wendt 4b5398e122 audio: Implement `start_substream`.
This also removes `append_substream` since `Substream` now handles that internally.

This requires duplicating a huge chunk of the decoder code to work with `Buffer` types instead of `SwfMovie` types. Eventually we'll want to wipe out all the SWF-specific stuff and use `Buffer` exclusively.
2023-08-23 15:36:20 -06:00
David Wendt 21cedcee2e core: `Substream` now holds a shared chunk list 2023-08-23 15:36:20 -06:00
David Wendt e411dbeee5 core: Add a `Cursor` equivalent for `Slice`s 2023-08-23 15:36:20 -06:00
David Wendt b46ef355fd core: Add two new methods for managing streaming audio:
* `start_substream` plays audio data from a `Substream`, giving back a `SoundInstanceHandle` that can be manipulated the same way as the one from `start_stream`

 * `append_substream` adds more data to an already playing `Substream` backed `SoundInstance`. In the event that a sound has finished playing, `append_substream` will fail, and you have to start a new sound stream.

This is ultimately intended to replace the current streaming audio setup, which is SWF-specific and has a number of unused parameters. It is also designed to support progressive download in the future.

We also include stub impls for `NullAudioBackend`.
2023-08-23 15:36:20 -06:00
David Wendt c03aa31b21 core: Add a `Substream` type for referencing multiple slices of a `Buffer`.
A `Substream` can be read in one of two ways:

 * Converting it to an iterator that yields individual chunks of the substream in `Slice` form.
 * Converting it to a `SubstreamCursor`, which implements `Read` for bytewise read access.

Chunk-based reading is intended for code that needs to know about chunk boundaries. Self-terminating chunk formats should be read with the cursor type.
2023-08-23 15:36:20 -06:00
David Wendt 6f646f618b core: Add a new `Buffer` type for shared ownership of data.
This is ultimately intended to replace `Vec<u8>` in both `SwfMovie` and `NetStream`, but for the time being we only apply this to streams. SWF-related types are deeply embedded elsewhere and the changes to slice dereferencing will be quite invasive.

We also remove some unnecessary reader drops in `NetStream.tick` at the same time.
2023-08-23 15:36:20 -06:00
Crowdin Bot d55cc23f55 chore: Update translations from Crowdin 2023-08-22 23:06:46 +02:00
Daniel Jacobs acc315ebfb extension: Fix check for scripting permission 2023-08-22 22:47:28 +02:00
Daniel Jacobs eef65da345 extension: Remove unnecessary lambda functions 2023-08-22 22:17:18 +02:00
nosamu 89d94ae098 avm2: getStackTrace() returns null when the stack trace is unavailable
Fixes #12572
2023-08-22 20:57:10 +02:00
Nathan Adams 9d05a37f34 web: Make open-in-new-tab open the local player directly, and disable takeover of all SWF urls 2023-08-22 19:35:05 +02:00
Daniel Jacobs ba52438c27 extension: Fix-ups for extension player page 2023-08-22 17:50:37 +02:00
nosamu 20b07ff147 avm1: Fix XML=>String coercion mangling non-ascii chars
Fixes #12859
2023-08-22 17:23:56 +02:00
nosamu 2f40f0093a avm1: Unescape + to space 2023-08-22 16:38:24 +02:00
sleepycatcoding 991976e437 avm2: Implement XML pretty printing 2023-08-22 09:57:59 -04:00
sleepycatcoding 34295f25ff chore: Appease beta Clippy 2023-08-22 15:29:01 +02:00
Crowdin Bot 3de4b4e989 chore: Update translations from Crowdin 2023-08-21 23:09:03 +02:00
renovate[bot] 2f4c7d2fe3 fix(deps): update rust dependencies 2023-08-21 08:59:07 +02:00
Nathan Adams 89cc0eb31d core: EditText::is_link_at doesn't need to evaluate fonts 2023-08-20 22:31:27 +02:00
Nathan Adams 385c2d7cb0 core: Fix links in TextEdits when scrolled down 2023-08-20 22:31:27 +02:00
Nathan Adams f0d356589a core: Implement avm2 event: links in texts 2023-08-20 22:31:27 +02:00
Nathan Adams 814a900b03 avm1: asfunction goes by the parent, not root 2023-08-20 22:31:27 +02:00
Nathan Adams b8cda975f3 core: Allow clicking EditTexts if we're clicking links 2023-08-20 22:31:27 +02:00
Nathan Adams 658ac2dd9f core: Implement url handling (+asfunction) in textedits 2023-08-20 22:31:27 +02:00
Nathan Adams d32867d992 core: Fix getting correct text position by coordinates, in multiline text 2023-08-20 22:31:27 +02:00
Nathan Adams 506d1918dd core: Add span list to debug window of EditTexts 2023-08-20 22:31:27 +02:00
Daniel Jacobs 1a28f83229 extension: Address review feedback 2023-08-20 19:51:14 +02:00
Nathan Adams d5fa0f56ea web: Make loadedConfig private again, add reload() method instead 2023-08-20 19:51:14 +02:00
Daniel Jacobs e7df6d890e extension: Make the player page a local Ruffle demo 2023-08-20 19:51:14 +02:00
TÖRÖK Attila a11725c27c tests: Exclude WARP from running the acid_gradient_2 visual test (ported from Shumway)
This was the culprit for most of our recent Windows CI failures.
2023-08-20 12:49:37 +02:00