Documentation
¶
Overview ¶
Package mpeg2 decodes MPEG-2 video (ISO/IEC 13818-2, Main Profile: 4:2:0, frame and field pictures, every prediction mode) in Go: a fallback where no GPU decodes a Blu-ray's or DVD's MPEG-2.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Accel ¶
type Accel interface {
// NewSurface gives a surface for frames of the size (the coded size:
// whole macroblocks). The surfaces of another size have all been
// released before.
NewSurface(width, height int) (int, error)
// Release gives a surface back.
Release(surface int)
// DecodePicture decodes a picture (a frame, or one field of one) from
// its slices, in order.
DecodePicture(p *AccelPicture, slices []AccelSlice) error
// Output fills the planes of p, a frame given out in display order,
// from the surface.
Output(surface int, p *Picture) error
}
Accel decodes pictures for the decoder.
type AccelPicture ¶
type AccelPicture struct {
Surface int
// Forward and Backward are the reference frames' surfaces (-1: none).
Forward, Backward int
Width, Height int // the sequence's
CodingType int // 1 I, 2 P, 3 B
FCode [2][2]int
DCPrecision int
Structure int // 1 top field, 2 bottom field, 3 frame
TopFieldFirst bool
FramePredFrameDCT bool
Concealment bool
QScaleType bool
IntraVLC bool
AlternateScan bool
RepeatFirstField bool
ProgressiveFrame bool
// FirstField is set for a frame picture, and the first field of a
// frame.
FirstField bool
// The quantiser matrices in zigzag scan order.
IntraQ, NonIntraQ [64]uint8
}
AccelPicture is a picture's parameters, the standard's syntax elements.
type AccelSlice ¶
type AccelSlice struct {
Data []byte
// MacroblockOffset is where the first macroblock starts, in bits from
// the start code.
MacroblockOffset int
MBX, MBY int // the first macroblock's (MBY in the picture: a field's rows)
QuantiserScaleCode int
IntraSlice bool
}
AccelSlice is a slice: its data, from its start code, and its header.
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes an MPEG-2 video elementary stream, access unit by access unit.
func (*Decoder) Decode ¶
Decode decodes an access unit (one or more start code units) given at pts, giving out the pictures that are complete in display order.
func (*Decoder) Errors ¶
Errors is how many slices could not be decoded (and were concealed by what was there).
type Picture ¶
type Picture struct {
Width, Height int
Y, Cb, Cr []byte
StrideY, StrideC int
PTS int64
// Progressive is progressive_frame: the two fields are of one moment.
// TopFieldFirst says which field comes first when not.
Progressive, TopFieldFirst bool
// FrameRateNum and FrameRateDen are the sequence's frame rate.
FrameRateNum, FrameRateDen int
// Primaries, Transfer and Matrix are the sequence display extension's
// colour description (H.273 code points; 2, unspecified, when there is
// none).
Primaries, Transfer, Matrix int
}
Picture is a decoded frame, in display order: 8-bit 4:2:0 planes, the displayed size of a larger buffer.