@mediaway/container 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +48 -9
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,11 +1,27 @@
1
1
  # @mediaway/container
2
2
 
3
- Sans-IO **fragmented MP4 (fMP4) mux and demux** over Mediaway's C ABI. The
4
- muxer/demuxer never touch files or sockets — you push packets in and poll
5
- bytes out, and own every byte of I/O.
3
+ Sans-IO mux and demux over Mediaway's C ABI, covering all 8
4
+ `mediaway-container` formats. Nothing here touches files or sockets — you
5
+ push packets in and poll (or pull) bytes out, and own every byte of I/O.
6
6
 
7
- Backed by the `iso-bmff` core crate (sans-io, unit-tested) and the native
8
- `mediaway_ffi.dll` (shipped by `@mediaway/ffi`).
7
+ | Format | API | Notes |
8
+ | --- | --- | --- |
9
+ | MP4 | `Muxer`, `Demuxer` (default) | fragmented MP4 (fMP4); typestated via `begin()` |
10
+ | WebM | `new Muxer("webm")`, `new Demuxer("webm")` | same `Muxer`/`Demuxer` shape as MP4 |
11
+ | Ogg | `OggMuxer`, `OggDemuxer` | no track registration — `push()` is ready immediately |
12
+ | ADTS (AAC) | `AdtsMuxer`, `AdtsDemuxer` | raw ADTS frame stream |
13
+ | FLV | `FlvMuxer`, `FlvDemuxer` | tag-based, `writeHeader()` before any tag |
14
+ | MPEG-TS | `TsMuxer`, `TsDemuxer` | PAT/PMT + access units |
15
+ | MP3 | `Mp3Muxer`, `Mp3Demuxer` | fixed Layer III frame header |
16
+ | WAV | `WavMuxer`, `parseWav()` | mux via `finish()`; demux is a one-shot function, no class |
17
+
18
+ MP4/WebM share `Muxer`/`Demuxer`; the other 6 formats have dedicated classes because
19
+ their C ABI shape genuinely differs (no track registration, out-buffer-per-call mux, or
20
+ a construction-time stream list — see each module's own top comment:
21
+ `ogg.ts`/`adts.ts`/`flv.ts`/`ts.ts`/`mp3.ts`/`wav.ts`).
22
+
23
+ Backed by the `iso-bmff`/`mediaway-container` core crates (sans-io, unit-tested) and the
24
+ native `mediaway_ffi.dll` (shipped by `@mediaway/ffi`).
9
25
 
10
26
  ## Install
11
27
 
@@ -16,7 +32,7 @@ npm install @mediaway/container
16
32
  Windows x64 (native DLL). The `@mediaway/ffi` dependency is installed
17
33
  automatically.
18
34
 
19
- ## Mux example
35
+ ## MP4 mux example
20
36
 
21
37
  ```ts
22
38
  import { Muxer, Demuxer, type VideoTrackInfo, type AudioTrackInfo, type Packet } from "@mediaway/container";
@@ -56,7 +72,7 @@ muxer.close();
56
72
  // chunks -> concatenate and write to a file / stream
57
73
  ```
58
74
 
59
- ## Demux example
75
+ ## MP4 demux example
60
76
 
61
77
  ```ts
62
78
  const demuxer = new Demuxer();
@@ -70,14 +86,37 @@ for (;;) {
70
86
  demuxer.close();
71
87
  ```
72
88
 
73
- ## API
89
+ WebM works the same way — pass `"webm"` to the `Muxer`/`Demuxer` constructor:
90
+ `new Muxer("webm")` / `new Demuxer("webm")`.
91
+
92
+ ## Other formats
93
+
94
+ Ogg/ADTS/FLV/MPEG-TS/MP3/WAV are exported from the same package but have their own
95
+ classes and functions (see the format table above), not `Muxer`/`Demuxer`:
96
+
97
+ ```ts
98
+ import { OggMuxer, OggDemuxer } from "@mediaway/container";
99
+ import { AdtsMuxer, AdtsDemuxer } from "@mediaway/container";
100
+ import { FlvMuxer, FlvDemuxer } from "@mediaway/container";
101
+ import { TsMuxer, TsDemuxer } from "@mediaway/container";
102
+ import { Mp3Muxer, Mp3Demuxer } from "@mediaway/container";
103
+ import { WavMuxer, parseWav } from "@mediaway/container";
104
+ ```
105
+
106
+ Each has its own DX contract because the underlying C ABI shape differs (e.g. Ogg/ADTS
107
+ have no track registration; FLV needs `writeHeader()`; WAV mux uses a terminal
108
+ `finish()` and WAV demux is the one-shot `parseWav(buffer)` function, not a class) — see
109
+ `src/ogg.ts`, `src/adts.ts`, `src/flv.ts`, `src/ts.ts`, `src/mp3.ts`, `src/wav.ts` for
110
+ each format's full API.
111
+
112
+ ## API (MP4 / WebM)
74
113
 
75
114
  | Class | Methods | Notes |
76
115
  | --- | --- | --- |
77
116
  | `Muxer` | `addVideoTrack`, `addAudioTrack`, `begin`, `push`, `flush`, `pollBytes`, `close` | sans-io: never blocks, never touches I/O |
78
117
  | `Demuxer` | `pushBytes`, `streams`, `pollPacket`, `close` | streaming — feed repeatedly |
79
118
 
80
- Errors surface as `MediawayError` (with an ABI-level code).
119
+ Errors surface as `MediawayError` (with an ABI-level code) across every format.
81
120
 
82
121
  ## License
83
122
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediaway/container",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Rust-based, lightweight, fast — sans-IO fragmented MP4 (fMP4) mux and demux for Node.js — push packets in, poll bytes out",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",