video formats: comments are specs only
This commit is contained in:
1 parent
e7421a8829
commit
151cac4ed4
16 files changed
+103
-276
No files matched your search
@@ -1,12 +1,7 @@
|
||||
--!strict
|
||||
-- video/mpegps: MPEG program streams (ISO/IEC 11172-1 system streams and 13818-1 program streams: .mpg / .mpeg /
|
||||
-- .vob / VCD .dat). New in rosetta, on containers/MpegPs. Video PES payloads are joined into the elementary
|
||||
-- stream and cut into pictures (containers/MpegEs: one packet per picture with its sequence / GOP headers, both
|
||||
-- fields of a field-coded frame in one); a picture takes the PTS of the PES it starts in, pictures without one get
|
||||
-- theirs from the GOP's temporal references. Audio packets are the PES payloads (MP1 / MP2 / MP3 frames, AC-3, LPCM).
|
||||
-- open() returns a VideoDecoder: MPEG-1 / MPEG-2 video through the codecs/video/Video registry (MPEG-2 told by its
|
||||
-- sequence extension), audio through the api's opts.openAudio hook.
|
||||
-- Timescale 90 kHz. Not supported: writing, H.264 in PS (packets are whole PES payloads), DVD navigation packets.
|
||||
-- video/mpegps: MPEG program streams (ISO/IEC 11172-1, 13818-1: .mpg / .vob / VCD .dat), on containers/MpegPs and
|
||||
-- containers/MpegEs: a packet per picture (the PTS of the PES it starts in, else from the GOP's temporal references),
|
||||
-- audio packets = PES payloads; 90 kHz. Not supported: writing, H.264 in PS, DVD navigation packets.
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ requires
|
||||
local Err = require("@rosetta/core/Err")
|
||||
@@ -30,7 +25,7 @@ local Ps = {
|
||||
-- ------------------------------------------------------------------------------------------------ types
|
||||
export type OpenOptions = {
|
||||
rgba: boolean?,
|
||||
track: number?, -- the video stream id to decode (0xE0.. ; default: the first video stream)
|
||||
track: number?, -- 0xE0..; default: the first video stream
|
||||
audio: boolean?,
|
||||
maxPixels: number?,
|
||||
openAudio: any?, -- set by the api
|
||||
@@ -48,7 +43,6 @@ function Ps.sniff(r: Bytes.Reader): number
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ decode
|
||||
-- the pictures of a video stream as packets: join the PES payloads, cut at pictures, place the timestamps
|
||||
local function videoPackets(dmx: any, buf: buffer, s: MpegPs.Stream, t: any)
|
||||
local total = 0
|
||||
for _, p in s.pes do
|
||||
@@ -119,7 +113,6 @@ local function videoPackets(dmx: any, buf: buffer, s: MpegPs.Stream, t: any)
|
||||
end
|
||||
end
|
||||
|
||||
-- demux(r, opts?) -> the Demuxer | nil, Err
|
||||
function Ps.demux(r: Bytes.Reader, _opts: OpenOptions?): (any, Err.Err?)
|
||||
if r:peek(4) == "\0\0\1\179" then
|
||||
-- an MPEG-1 / 2 video elementary stream (.m1v): one video stream, no timestamps
|
||||
@@ -181,7 +174,6 @@ function Ps.demux(r: Bytes.Reader, _opts: OpenOptions?): (any, Err.Err?)
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ open
|
||||
-- open(r, opts?) -> a VideoDecoder | nil, Err
|
||||
function Ps.open(r: Bytes.Reader, opts: OpenOptions?): (Types.VideoDecoder?, Err.Err?)
|
||||
local dmx, err = Ps.demux(r, opts)
|
||||
if not dmx then
|
||||
|
||||
Reference in new issue
Block a user