Commit Graph

9753 Commits

Author SHA1 Message Date
David Wendt ab21b5b106 core: The stop event is `NetStream.Play.Stop` 2023-06-30 16:14:28 -06:00
David Wendt 61c269c636 docs: Document `num_ticks` and `tick_rate` 2023-06-30 16:14:28 -06:00
David Wendt 16c9cb4fdd tests: Add option to send ticks to the player instead of calling `run_frame`.
You can also specify a `tick_rate` in order to get ticks faster or slower than the stage frame rate.

We also enable video decode and ticks on the netstream tests, since our netstream impl requires ticks.
2023-06-30 16:14:28 -06:00
David Wendt fc50a688fb core: Update stream time after processing tags 2023-06-30 16:14:28 -06:00
David Wendt 4dd9508471 avm1: Implement onStatus events for NetStream 2023-06-30 16:14:28 -06:00
David Wendt 63b27a4a20 avm2: Pass status events through to AVM2. 2023-06-30 16:14:28 -06:00
David Wendt 757ae40abc core: Add stubs for stream event triggers 2023-06-30 16:14:28 -06:00
David Wendt da2ef5392e core: Make the `NetStream`/AVM link bidirectional 2023-06-30 16:14:28 -06:00
David Wendt 067474dea5 chore: Remove unused variables from stream.rs 2023-06-30 16:14:28 -06:00
David Wendt 4944d81dd7 tests: Update the AVM1 test output to include event data. 2023-06-30 16:14:28 -06:00
David Wendt d498a412e5 core: Retain original SWF dimensions for self bounds 2023-06-30 16:14:28 -06:00
David Wendt b164319e32 core: FLV metadata is stored as an array, not an object. 2023-06-30 16:14:28 -06:00
David Wendt 643b053e8d core: Don't mark the video stream as corrupt if we haven't gotten the full header yet 2023-06-30 16:14:28 -06:00
David Wendt 587a99fae7 core: Netstream loaders are... well, netstream loaders. 2023-06-30 16:14:28 -06:00
David Wendt 0e207cce8d core: Actually spawn the loader future for the netstream 2023-06-30 16:14:28 -06:00
David Wendt 7e986bd90d avm1: `NetStream` constructor must return itself 2023-06-30 16:14:28 -06:00
David Wendt 766ee5302d core: Properly expose AVM1/2 objects for videos. 2023-06-30 16:14:28 -06:00
David Wendt a52f738009 core: Silence various errors triggered by loading an empty video stream 2023-06-30 16:14:28 -06:00
David Wendt 34625524ad swf: Zero is a valid video codec and it indicates no codec. 2023-06-30 16:14:28 -06:00
David Wendt 257403d04e core: Errors in tag parsing should include the explanation of the underlying error 2023-06-30 16:14:28 -06:00
David Wendt f690162a4f avm2: Actually create an unconnected `Video` when one is constructed via `new Video` 2023-06-30 16:14:28 -06:00
David Wendt c86360a10b core: `Video`s attached to a `NetStream` get their bitmap size and data from the attached `NetStream`. 2023-06-30 16:14:28 -06:00
David Wendt 9e318fc8e8 core: Process basic FLV video data tags and funnel them to the video backend.
This works a bit differently from SWF videos, we do not retain decoded video frames or valid seek points indefinitely. This assumes code interacting with `NetStream` is at least mildly aware of how a video codec is supposed to work and what the performance implications of that are.
2023-06-30 16:14:28 -06:00
David Wendt 3d5156b90d core: Update the stream offset after each tag is processed.
The `preload_offset` is only ever moved forward, of course.
2023-06-30 16:14:28 -06:00
David Wendt 3410d9fcf8 core: Process `onMetaData` to get our stream definition with.
We use `preload_offset` to avoid processing the same metadata multiple times.
2023-06-30 16:14:28 -06:00
David Wendt 286acddfea core: Introduce the notion of a separate preload step.
We don't actually process tags out of order, we're just tracking what tags have already been processed. FLV embeds critical video metadata in a ScriptData tag that we need to pull data out of and process.
2023-06-30 16:14:28 -06:00
David Wendt bc9fd3613e core: Add stub FLV processing 2023-06-30 16:14:28 -06:00
David Wendt c00cd0537c tests: Add tests for AVM1 and AVM2 host FLV players. 2023-06-30 16:14:28 -06:00
David Wendt ea9c5ae830 flv: Break `io::Error` into kind and string at construction time to avoid having to do so when cloning. 2023-06-30 16:14:28 -06:00
David Wendt 0f176484ea flv: Refactor tag parsing to use error codes instead of `None`. 2023-06-30 16:14:28 -06:00
David Wendt e4b76ac149 flv: Sound format bits are ALSO specified backwards! 2023-06-30 16:14:28 -06:00
David Wendt c61b27a41b flv: Codec ID and frame type are specified backwards 2023-06-30 16:14:28 -06:00
David Wendt 4b81d65dc5 flv: Hitting the end of the script data block is treated like the variable terminator.
Add a test case with real FLV data to enforce this.
2023-06-30 16:14:28 -06:00
David Wendt 4f831b4351 flv: Script data blocks appear to start with a trash byte `0x02` 2023-06-30 16:14:28 -06:00
David Wendt 6358d3162b flv: The type flag bits in the FLV spec are written backwards. 2023-06-30 16:14:28 -06:00
David Wendt eed1ab492d flv: All relevant output data types need to be public. 2023-06-30 16:14:28 -06:00
David Wendt 0c145253b6 flv: `Tag` fields should be public. 2023-06-30 16:14:28 -06:00
David Wendt b2dd4d8305 flv: Add `Clone` to `Tag` and `Header`.
Some types also get `Copy` by virtue of being plain data with no pointers.
2023-06-30 16:14:28 -06:00
David Wendt 8fd80cd173 flv: `Tag` should be public as well. 2023-06-30 16:14:28 -06:00
David Wendt d23378dd80 flv: `Header::parse` should always leave the stream reader in a reasonable position 2023-06-30 16:14:28 -06:00
David Wendt 20d33df458 flv: Add `skip_back` method for reverse tag parsing 2023-06-30 16:14:28 -06:00
David Wendt 7bf28074c0 flv: `parse` now consumes the back pointer.
We also guarantee that when parsing fails we leave the reader where it is to allow reading later.
2023-06-30 16:14:28 -06:00
David Wendt 3e2a5eb43b flv: Impl `Seek` for `FlvReader` 2023-06-30 16:14:28 -06:00
David Wendt 0edfecfea0 flv: Allow breaking a Reader down into parts or building one up from parts. 2023-06-30 16:14:28 -06:00
David Wendt 4d829768a1 tests: Add integration tests for full tag parsing 2023-06-30 16:14:28 -06:00
David Wendt e50ee7c139 chore: errant & 2023-06-30 16:14:28 -06:00
David Wendt f115326f3e flv: Implement Script Data parsing.
Yes, FLVs support embedded ActionScript data. Who knew?!
2023-06-30 16:14:28 -06:00
David Wendt 65583a7173 flv: Add video tag parsing support 2023-06-30 16:14:28 -06:00
David Wendt 43aa4abe0e flv: Check for the AAC sequence header byte.
Note that we don't actually parse the sequence header yet.
2023-06-30 16:14:28 -06:00
David Wendt f998ec20e8 flv: Implement `AudioData` parsing 2023-06-30 16:14:28 -06:00