go-astits: github.com/asticode/go-astits Index | Files | Directories

package astits

import "github.com/asticode/go-astits"


Package Files

clock_reference.go data.go data_eit.go data_nit.go data_pat.go data_pes.go data_pmt.go data_psi.go data_sdt.go data_tot.go demuxer.go descriptor.go dvb.go packet.go packet_buffer.go packet_pool.go program_map.go


const (
    PIDPAT  = 0x0    // Program Association Table (PAT) contains a directory listing of all Program Map Tables.
    PIDCAT  = 0x1    // Conditional Access Table (CAT) contains a directory listing of all ITU-T Rec. H.222 entitlement management message streams used by Program Map Tables.
    PIDTSDT = 0x2    // Transport Stream Description Table (TSDT) contains descriptors related to the overall transport stream
    PIDNull = 0x1fff // Null Packet (used for fixed bandwidth padding)


const (
    PSTDBufferScale128Bytes  = 0
    PSTDBufferScale1024Bytes = 1

P-STD buffer scales

const (
    PTSDTSIndicatorBothPresent = 3
    PTSDTSIndicatorIsForbidden = 1
    PTSDTSIndicatorNoPTSOrDTS  = 0
    PTSDTSIndicatorOnlyPTS     = 2

PTS DTS indicator

const (
    StreamIDPrivateStream1 = 189
    StreamIDPaddingStream  = 190
    StreamIDPrivateStream2 = 191

Stream IDs

const (
    TrickModeControlFastForward = 0
    TrickModeControlFastReverse = 3
    TrickModeControlFreezeFrame = 2
    TrickModeControlSlowMotion  = 1
    TrickModeControlSlowReverse = 4

Trick mode controls

const (
    StreamTypeLowerBitrateVideo          = 27 // ITU-T Rec. H.264 and ISO/IEC 14496-10
    StreamTypeMPEG1Audio                 = 3  // ISO/IEC 11172-3
    StreamTypeMPEG2HalvedSampleRateAudio = 4  // ISO/IEC 13818-3
    StreamTypeMPEG2PacketizedData        = 6  // ITU-T Rec. H.222 and ISO/IEC 13818-1 i.e., DVB subtitles/VBI and AC-3

Stream types

const (
    PSITableTypeBAT     = "BAT"
    PSITableTypeDIT     = "DIT"
    PSITableTypeEIT     = "EIT"
    PSITableTypeNIT     = "NIT"
    PSITableTypeNull    = "Null"
    PSITableTypePAT     = "PAT"
    PSITableTypePMT     = "PMT"
    PSITableTypeRST     = "RST"
    PSITableTypeSDT     = "SDT"
    PSITableTypeSIT     = "SIT"
    PSITableTypeST      = "ST"
    PSITableTypeTDT     = "TDT"
    PSITableTypeTOT     = "TOT"
    PSITableTypeUnknown = "Unknown"

PSI table IDs

const (
    RunningStatusNotRunning          = 1
    RunningStatusPausing             = 3
    RunningStatusRunning             = 4
    RunningStatusServiceOffAir       = 5
    RunningStatusStartsInAFewSeconds = 2
    RunningStatusUndefined           = 0

Running statuses

const (
    AudioTypeCleanEffects             = 0x1
    AudioTypeHearingImpaired          = 0x2
    AudioTypeVisualImpairedCommentary = 0x3

Audio types Page: 683 | https://books.google.fr/books?id=6dgWB3-rChYC&printsec=frontcover&hl=fr

const (
    DataStreamAligmentAudioSyncWord          = 0x1
    DataStreamAligmentVideoSliceOrAccessUnit = 0x1
    DataStreamAligmentVideoAccessUnit        = 0x2
    DataStreamAligmentVideoGOPOrSEQ          = 0x3
    DataStreamAligmentVideoSEQ               = 0x4

Data stream alignments Page: 85 | Chapter:2.6.11 | Link: http://ecee.colorado.edu/~ecen5653/ecen5653/papers/iso13818-1.pdf

const (
    DescriptorTagAC3                        = 0x6a
    DescriptorTagAVCVideo                   = 0x28
    DescriptorTagComponent                  = 0x50
    DescriptorTagContent                    = 0x54
    DescriptorTagDataStreamAlignment        = 0x6
    DescriptorTagEnhancedAC3                = 0x7a
    DescriptorTagExtendedEvent              = 0x4e
    DescriptorTagExtension                  = 0x7f
    DescriptorTagISO639LanguageAndAudioType = 0xa
    DescriptorTagLocalTimeOffset            = 0x58
    DescriptorTagMaximumBitrate             = 0xe
    DescriptorTagNetworkName                = 0x40
    DescriptorTagParentalRating             = 0x55
    DescriptorTagPrivateDataIndicator       = 0xf
    DescriptorTagPrivateDataSpecifier       = 0x5f
    DescriptorTagRegistration               = 0x5
    DescriptorTagService                    = 0x48
    DescriptorTagShortEvent                 = 0x4d
    DescriptorTagStreamIdentifier           = 0x52
    DescriptorTagSubtitling                 = 0x59
    DescriptorTagTeletext                   = 0x56
    DescriptorTagVBIData                    = 0x45
    DescriptorTagVBITeletext                = 0x46

Descriptor tags Chapter: 6.1 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

const (
    TeletextTypeAdditionalInformationPage                    = 0x3
    TeletextTypeInitialTeletextPage                          = 0x1
    TeletextTypeProgramSchedulePage                          = 0x4
    TeletextTypeTeletextSubtitlePage                         = 0x2
    TeletextTypeTeletextSubtitlePageForHearingImpairedPeople = 0x5

Teletext types Chapter: 6.2.43 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

const (
    VBIDataServiceIDClosedCaptioning     = 0x6
    VBIDataServiceIDEBUTeletext          = 0x1
    VBIDataServiceIDInvertedTeletext     = 0x2
    VBIDataServiceIDMonochrome442Samples = 0x7
    VBIDataServiceIDVPS                  = 0x4
    VBIDataServiceIDWSS                  = 0x5

VBI data service id Chapter: 6.2.47 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

const (
    ScramblingControlNotScrambled         = 0
    ScramblingControlReservedForFutureUse = 1
    ScramblingControlScrambledWithEvenKey = 2
    ScramblingControlScrambledWithOddKey  = 3

Scrambling Controls

const (
    DescriptorTagExtensionSupplementaryAudio = 0x6

Descriptor extension tags Chapter: 6.3 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

const (
    ServiceTypeDigitalTelevisionService = 0x1

Service types Chapter: 6.2.33 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf


var (
    ErrNoMorePackets                = errors.New("astits: no more packets")
    ErrPacketMustStartWithASyncByte = errors.New("astits: packet must start with a sync byte")


func OptPacketSize Uses

func OptPacketSize(packetSize int) func(*Demuxer)

OptPacketSize returns the option to set the packet size

func OptPacketsParser Uses

func OptPacketsParser(p PacketsParser) func(*Demuxer)

OptPacketsParser returns the option to set the packets parser

type ClockReference Uses

type ClockReference struct {
    Base, Extension int64

ClockReference represents a clock reference Base is based on a 90 kHz clock and extension is based on a 27 MHz clock

func (ClockReference) Duration Uses

func (p ClockReference) Duration() time.Duration

Duration converts the clock reference into duration

func (ClockReference) Time Uses

func (p ClockReference) Time() time.Time

Time converts the clock reference into time

type DSMTrickMode Uses

type DSMTrickMode struct {
    FieldID             uint8
    FrequencyTruncation uint8
    IntraSliceRefresh   uint8
    RepeatControl       uint8
    TrickModeControl    uint8

DSMTrickMode represents a DSM trick mode https://books.google.fr/books?id=vwUrAwAAQBAJ&pg=PT501&lpg=PT501&dq=dsm+trick+mode+control&source=bl&ots=fI-9IHXMRL&sig=PWnhxrsoMWNQcl1rMCPmJGNO9Ds&hl=fr&sa=X&ved=0ahUKEwjogafD8bjXAhVQ3KQKHeHKD5oQ6AEINDAB#v=onepage&q=dsm%20trick%20mode%20control&f=false

type Data Uses

type Data struct {
    EIT         *EITData
    FirstPacket *Packet
    NIT         *NITData
    PAT         *PATData
    PES         *PESData
    PID         uint16
    PMT         *PMTData
    SDT         *SDTData
    TOT         *TOTData

Data represents a data

type Demuxer Uses

type Demuxer struct {
    // contains filtered or unexported fields

Demuxer represents a demuxer https://en.wikipedia.org/wiki/MPEG_transport_stream http://seidl.cs.vsb.cz/download/dvb/DVB_Poster.pdf http://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.13.01_40/en_300468v011301o.pdf

func New Uses

func New(ctx context.Context, r io.Reader, opts ...func(*Demuxer)) (d *Demuxer)

New creates a new transport stream based on a reader

func (*Demuxer) NextData Uses

func (dmx *Demuxer) NextData() (d *Data, err error)

NextData retrieves the next data

func (*Demuxer) NextPacket Uses

func (dmx *Demuxer) NextPacket() (p *Packet, err error)

NextPacket retrieves the next packet

func (*Demuxer) Rewind Uses

func (dmx *Demuxer) Rewind() (n int64, err error)

Rewind rewinds the demuxer reader

type Descriptor Uses

type Descriptor struct {
    AC3                        *DescriptorAC3
    AVCVideo                   *DescriptorAVCVideo
    Component                  *DescriptorComponent
    Content                    *DescriptorContent
    DataStreamAlignment        *DescriptorDataStreamAlignment
    EnhancedAC3                *DescriptorEnhancedAC3
    ExtendedEvent              *DescriptorExtendedEvent
    Extension                  *DescriptorExtension
    ISO639LanguageAndAudioType *DescriptorISO639LanguageAndAudioType
    Length                     uint8
    LocalTimeOffset            *DescriptorLocalTimeOffset
    MaximumBitrate             *DescriptorMaximumBitrate
    NetworkName                *DescriptorNetworkName
    ParentalRating             *DescriptorParentalRating
    PrivateDataIndicator       *DescriptorPrivateDataIndicator
    PrivateDataSpecifier       *DescriptorPrivateDataSpecifier
    Registration               *DescriptorRegistration
    Service                    *DescriptorService
    ShortEvent                 *DescriptorShortEvent
    StreamIdentifier           *DescriptorStreamIdentifier
    Subtitling                 *DescriptorSubtitling
    Tag                        uint8 // the tag defines the structure of the contained data following the descriptor length.
    Teletext                   *DescriptorTeletext
    UserDefined                []byte
    VBIData                    *DescriptorVBIData
    VBITeletext                *DescriptorTeletext

Descriptor represents a descriptor TODO Handle UTF8

type DescriptorAC3 Uses

type DescriptorAC3 struct {
    AdditionalInfo   []byte
    ASVC             uint8
    BSID             uint8
    ComponentType    uint8
    HasASVC          bool
    HasBSID          bool
    HasComponentType bool
    HasMainID        bool
    MainID           uint8

DescriptorAC3 represents an AC3 descriptor Chapter: Annex D | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorAVCVideo Uses

type DescriptorAVCVideo struct {
    AVC24HourPictureFlag bool
    AVCStillPresent      bool
    CompatibleFlags      uint8
    ConstraintSet0Flag   bool
    ConstraintSet1Flag   bool
    ConstraintSet2Flag   bool
    LevelIDC             uint8
    ProfileIDC           uint8

DescriptorAVCVideo represents an AVC video descriptor No doc found unfortunately, basing the implementation on https://github.com/gfto/bitstream/blob/master/mpeg/psi/desc_28.h

type DescriptorComponent Uses

type DescriptorComponent struct {
    ComponentTag       uint8
    ComponentType      uint8
    ISO639LanguageCode []byte
    StreamContent      uint8
    StreamContentExt   uint8
    Text               []byte

DescriptorComponent represents a component descriptor Chapter: 6.2.8 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorContent Uses

type DescriptorContent struct {
    Items []*DescriptorContentItem

DescriptorContent represents a content descriptor Chapter: 6.2.9 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorContentItem Uses

type DescriptorContentItem struct {
    ContentNibbleLevel1 uint8
    ContentNibbleLevel2 uint8
    UserByte            uint8

DescriptorContentItem represents a content item descriptor Chapter: 6.2.9 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorDataStreamAlignment Uses

type DescriptorDataStreamAlignment struct {
    Type uint8

DescriptorDataStreamAlignment represents a data stream alignment descriptor

type DescriptorEnhancedAC3 Uses

type DescriptorEnhancedAC3 struct {
    AdditionalInfo   []byte
    ASVC             uint8
    BSID             uint8
    ComponentType    uint8
    HasASVC          bool
    HasBSID          bool
    HasComponentType bool
    HasMainID        bool
    HasSubStream1    bool
    HasSubStream2    bool
    HasSubStream3    bool
    MainID           uint8
    MixInfoExists    bool
    SubStream1       uint8
    SubStream2       uint8
    SubStream3       uint8

DescriptorEnhancedAC3 represents an enhanced AC3 descriptor Chapter: Annex D | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorExtendedEvent Uses

type DescriptorExtendedEvent struct {
    ISO639LanguageCode   []byte
    Items                []*DescriptorExtendedEventItem
    LastDescriptorNumber uint8
    Number               uint8
    Text                 []byte

DescriptorExtendedEvent represents an extended event descriptor Chapter: 6.2.15 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorExtendedEventItem Uses

type DescriptorExtendedEventItem struct {
    Content     []byte
    Description []byte

DescriptorExtendedEventItem represents an extended event item descriptor Chapter: 6.2.15 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorExtension Uses

type DescriptorExtension struct {
    SupplementaryAudio *DescriptorExtensionSupplementaryAudio
    Tag                uint8

DescriptorExtension represents an extension descriptor Chapter: 6.2.16 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorExtensionSupplementaryAudio Uses

type DescriptorExtensionSupplementaryAudio struct {
    EditorialClassification uint8
    HasLanguageCode         bool
    LanguageCode            []byte
    MixType                 bool
    PrivateData             []byte

DescriptorExtensionSupplementaryAudio represents a supplementary audio extension descriptor Chapter: 6.4.10 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorISO639LanguageAndAudioType Uses

type DescriptorISO639LanguageAndAudioType struct {
    Language []byte
    Type     uint8

DescriptorISO639LanguageAndAudioType represents an ISO639 language descriptor https://github.com/gfto/bitstream/blob/master/mpeg/psi/desc_0a.h

type DescriptorLocalTimeOffset Uses

type DescriptorLocalTimeOffset struct {
    Items []*DescriptorLocalTimeOffsetItem

DescriptorLocalTimeOffset represents a local time offset descriptor Chapter: 6.2.20 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorLocalTimeOffsetItem Uses

type DescriptorLocalTimeOffsetItem struct {
    CountryCode             []byte
    CountryRegionID         uint8
    LocalTimeOffset         time.Duration
    LocalTimeOffsetPolarity bool
    NextTimeOffset          time.Duration
    TimeOfChange            time.Time

DescriptorLocalTimeOffsetItem represents a local time offset item descriptor Chapter: 6.2.20 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorMaximumBitrate Uses

type DescriptorMaximumBitrate struct {
    Bitrate uint32 // In bytes/second

DescriptorMaximumBitrate represents a maximum bitrate descriptor

type DescriptorNetworkName Uses

type DescriptorNetworkName struct {
    Name []byte

DescriptorNetworkName represents a network name descriptor Chapter: 6.2.27 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorParentalRating Uses

type DescriptorParentalRating struct {
    Items []*DescriptorParentalRatingItem

DescriptorParentalRating represents a parental rating descriptor Chapter: 6.2.28 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorParentalRatingItem Uses

type DescriptorParentalRatingItem struct {
    CountryCode []byte
    Rating      uint8

DescriptorParentalRatingItem represents a parental rating item descriptor Chapter: 6.2.28 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

func (DescriptorParentalRatingItem) MinimumAge Uses

func (d DescriptorParentalRatingItem) MinimumAge() int

MinimumAge returns the minimum age for the parental rating

type DescriptorPrivateDataIndicator Uses

type DescriptorPrivateDataIndicator struct {
    Indicator uint32

DescriptorPrivateDataIndicator represents a private data Indicator descriptor

type DescriptorPrivateDataSpecifier Uses

type DescriptorPrivateDataSpecifier struct {
    Specifier uint32

DescriptorPrivateDataSpecifier represents a private data specifier descriptor

type DescriptorRegistration Uses

type DescriptorRegistration struct {
    AdditionalIdentificationInfo []byte
    FormatIdentifier             uint32

DescriptorRegistration represents a registration descriptor Page: 84 | http://ecee.colorado.edu/~ecen5653/ecen5653/papers/iso13818-1.pdf

type DescriptorService Uses

type DescriptorService struct {
    Name     []byte
    Provider []byte
    Type     uint8

DescriptorService represents a service descriptor Chapter: 6.2.33 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorShortEvent Uses

type DescriptorShortEvent struct {
    EventName []byte
    Language  []byte
    Text      []byte

DescriptorShortEvent represents a short event descriptor Chapter: 6.2.37 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorStreamIdentifier Uses

type DescriptorStreamIdentifier struct{ ComponentTag uint8 }

DescriptorStreamIdentifier represents a stream identifier descriptor Chapter: 6.2.39 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorSubtitling Uses

type DescriptorSubtitling struct {
    Items []*DescriptorSubtitlingItem

DescriptorSubtitling represents a subtitling descriptor Chapter: 6.2.41 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorSubtitlingItem Uses

type DescriptorSubtitlingItem struct {
    AncillaryPageID   uint16
    CompositionPageID uint16
    Language          []byte
    Type              uint8

DescriptorSubtitlingItem represents subtitling descriptor item Chapter: 6.2.41 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorTeletext Uses

type DescriptorTeletext struct {
    Items []*DescriptorTeletextItem

DescriptorTeletext represents a teletext descriptor Chapter: 6.2.43 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorTeletextItem Uses

type DescriptorTeletextItem struct {
    Language []byte
    Magazine uint8
    Page     uint8
    Type     uint8

DescriptorTeletextItem represents a teletext descriptor item Chapter: 6.2.43 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorVBIData Uses

type DescriptorVBIData struct {
    Services []*DescriptorVBIDataService

DescriptorVBIData represents a VBI data descriptor Chapter: 6.2.47 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorVBIDataDescriptor Uses

type DescriptorVBIDataDescriptor struct {
    FieldParity bool
    LineOffset  uint8

DescriptorVBIDataItem represents a vbi data descriptor item Chapter: 6.2.47 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type DescriptorVBIDataService Uses

type DescriptorVBIDataService struct {
    DataServiceID uint8
    Descriptors   []*DescriptorVBIDataDescriptor

DescriptorVBIDataService represents a vbi data service descriptor Chapter: 6.2.47 | Link: https://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.15.01_60/en_300468v011501p.pdf

type EITData Uses

type EITData struct {
    Events                   []*EITDataEvent
    LastTableID              uint8
    OriginalNetworkID        uint16
    SegmentLastSectionNumber uint8
    ServiceID                uint16
    TransportStreamID        uint16

EITData represents an EIT data Page: 36 | Chapter: 5.2.4 | Link: https://www.dvb.org/resources/public/standards/a38_dvb-si_specification.pdf

type EITDataEvent Uses

type EITDataEvent struct {
    Descriptors    []*Descriptor
    Duration       time.Duration
    EventID        uint16
    HasFreeCSAMode bool // When true indicates that access to one or more streams may be controlled by a CA system.
    RunningStatus  uint8
    StartTime      time.Time

EITDataEvent represents an EIT data event

type NITData Uses

type NITData struct {
    NetworkDescriptors []*Descriptor
    NetworkID          uint16
    TransportStreams   []*NITDataTransportStream

NITData represents a NIT data Page: 29 | Chapter: 5.2.1 | Link: https://www.dvb.org/resources/public/standards/a38_dvb-si_specification.pdf

type NITDataTransportStream Uses

type NITDataTransportStream struct {
    OriginalNetworkID    uint16
    TransportDescriptors []*Descriptor
    TransportStreamID    uint16

NITDataTransportStream represents a NIT data transport stream

type PATData Uses

type PATData struct {
    Programs          []*PATProgram
    TransportStreamID uint16

PATData represents a PAT data https://en.wikipedia.org/wiki/Program-specific_information

type PATProgram Uses

type PATProgram struct {
    ProgramMapID  uint16 // The packet identifier that contains the associated PMT
    ProgramNumber uint16 // Relates to the Table ID extension in the associated PMT. A value of 0 is reserved for a NIT packet identifier.

PATProgram represents a PAT program

type PESData Uses

type PESData struct {
    Data   []byte
    Header *PESHeader

PESData represents a PES data https://en.wikipedia.org/wiki/Packetized_elementary_stream http://dvd.sourceforge.net/dvdinfo/pes-hdr.html http://happy.emu.id.au/lab/tut/dttb/dtbtut4b.htm

type PESHeader Uses

type PESHeader struct {
    OptionalHeader *PESOptionalHeader
    PacketLength   uint16 // Specifies the number of bytes remaining in the packet after this field. Can be zero. If the PES packet length is set to zero, the PES packet can be of any length. A value of zero for the PES packet length can be used only when the PES packet payload is a video elementary stream.
    StreamID       uint8  // Examples: Audio streams (0xC0-0xDF), Video streams (0xE0-0xEF)

PESHeader represents a packet PES header

type PESOptionalHeader Uses

type PESOptionalHeader struct {
    AdditionalCopyInfo              uint8
    CRC                             uint16
    DataAlignmentIndicator          bool // True indicates that the PES packet header is immediately followed by the video start code or audio syncword
    DSMTrickMode                    *DSMTrickMode
    DTS                             *ClockReference
    ESCR                            *ClockReference
    ESRate                          uint32
    Extension2Data                  []byte
    Extension2Length                uint8
    HasAdditionalCopyInfo           bool
    HasCRC                          bool
    HasDSMTrickMode                 bool
    HasESCR                         bool
    HasESRate                       bool
    HasExtension                    bool
    HasExtension2                   bool
    HasOptionalFields               bool
    HasPackHeaderField              bool
    HasPrivateData                  bool
    HasProgramPacketSequenceCounter bool
    HasPSTDBuffer                   bool
    HeaderLength                    uint8
    IsCopyrighted                   bool
    IsOriginal                      bool
    MarkerBits                      uint8
    MPEG1OrMPEG2ID                  uint8
    OriginalStuffingLength          uint8
    PacketSequenceCounter           uint8
    PackField                       uint8
    Priority                        bool
    PrivateData                     []byte
    PSTDBufferScale                 uint8
    PSTDBufferSize                  uint16
    PTS                             *ClockReference
    PTSDTSIndicator                 uint8
    ScramblingControl               uint8

PESOptionalHeader represents a PES optional header

type PMTData Uses

type PMTData struct {
    ElementaryStreams  []*PMTElementaryStream
    PCRPID             uint16        // The packet identifier that contains the program clock reference used to improve the random access accuracy of the stream's timing that is derived from the program timestamp. If this is unused. then it is set to 0x1FFF (all bits on).
    ProgramDescriptors []*Descriptor // Program descriptors
    ProgramNumber      uint16

PMTData represents a PMT data https://en.wikipedia.org/wiki/Program-specific_information

type PMTElementaryStream Uses

type PMTElementaryStream struct {
    ElementaryPID               uint16        // The packet identifier that contains the stream type data.
    ElementaryStreamDescriptors []*Descriptor // Elementary stream descriptors
    StreamType                  uint8         // This defines the structure of the data contained within the elementary packet identifier.

PMTElementaryStream represents a PMT elementary stream

type PSIData Uses

type PSIData struct {
    PointerField int // Present at the start of the TS packet payload signaled by the payload_unit_start_indicator bit in the TS header. Used to set packet alignment bytes or content before the start of tabled payload data.
    Sections     []*PSISection

PSIData represents a PSI data https://en.wikipedia.org/wiki/Program-specific_information

type PSISection Uses

type PSISection struct {
    CRC32  uint32 // A checksum of the entire table excluding the pointer field, pointer filler bytes and the trailing CRC32.
    Header *PSISectionHeader
    Syntax *PSISectionSyntax

PSISection represents a PSI section

type PSISectionHeader Uses

type PSISectionHeader struct {
    PrivateBit             bool   // The PAT, PMT, and CAT all set this to 0. Other tables set this to 1.
    SectionLength          uint16 // The number of bytes that follow for the syntax section (with CRC value) and/or table data. These bytes must not exceed a value of 1021.
    SectionSyntaxIndicator bool   // A flag that indicates if the syntax section follows the section length. The PAT, PMT, and CAT all set this to 1.
    TableID                int    // Table Identifier, that defines the structure of the syntax section and other contained data. As an exception, if this is the byte that immediately follow previous table section and is set to 0xFF, then it indicates that the repeat of table section end here and the rest of TS data payload shall be stuffed with 0xFF. Consequently the value 0xFF shall not be used for the Table Identifier.
    TableType              string

PSISectionHeader represents a PSI section header

type PSISectionSyntax Uses

type PSISectionSyntax struct {
    Data   *PSISectionSyntaxData
    Header *PSISectionSyntaxHeader

PSISectionSyntax represents a PSI section syntax

type PSISectionSyntaxData Uses

type PSISectionSyntaxData struct {
    EIT *EITData
    NIT *NITData
    PAT *PATData
    PMT *PMTData
    SDT *SDTData
    TOT *TOTData

PSISectionSyntaxData represents a PSI section syntax data

type PSISectionSyntaxHeader Uses

type PSISectionSyntaxHeader struct {
    CurrentNextIndicator bool   // Indicates if data is current in effect or is for future use. If the bit is flagged on, then the data is to be used at the present moment.
    LastSectionNumber    uint8  // This indicates which table is the last table in the sequence of tables.
    SectionNumber        uint8  // This is an index indicating which table this is in a related sequence of tables. The first table starts from 0.
    TableIDExtension     uint16 // Informational only identifier. The PAT uses this for the transport stream identifier and the PMT uses this for the Program number.
    VersionNumber        uint8  // Syntax version number. Incremented when data is changed and wrapped around on overflow for values greater than 32.

PSISectionSyntaxHeader represents a PSI section syntax header

type Packet Uses

type Packet struct {
    AdaptationField *PacketAdaptationField
    Header          *PacketHeader
    Payload         []byte // This is only the payload content

Packet represents a packet https://en.wikipedia.org/wiki/MPEG_transport_stream

type PacketAdaptationExtensionField Uses

type PacketAdaptationExtensionField struct {
    DTSNextAccessUnit      *ClockReference // The PES DTS of the splice point. Split up as 3 bits, 1 marker bit (0x1), 15 bits, 1 marker bit, 15 bits, and 1 marker bit, for 33 data bits total.
    HasLegalTimeWindow     bool
    HasPiecewiseRate       bool
    HasSeamlessSplice      bool
    LegalTimeWindowIsValid bool
    LegalTimeWindowOffset  uint16 // Extra information for rebroadcasters to determine the state of buffers when packets may be missing.
    Length                 int
    PiecewiseRate          uint32 // The rate of the stream, measured in 188-byte packets, to define the end-time of the LTW.
    SpliceType             uint8  // Indicates the parameters of the H.262 splice.

PacketAdaptationExtensionField represents a packet adaptation extension field

type PacketAdaptationField Uses

type PacketAdaptationField struct {
    AdaptationExtensionField          *PacketAdaptationExtensionField
    DiscontinuityIndicator            bool // Set if current TS packet is in a discontinuity state with respect to either the continuity counter or the program clock reference
    ElementaryStreamPriorityIndicator bool // Set when this stream should be considered "high priority"
    HasAdaptationExtensionField       bool
    HasOPCR                           bool
    HasPCR                            bool
    HasTransportPrivateData           bool
    HasSplicingCountdown              bool
    Length                            int
    OPCR                              *ClockReference // Original Program clock reference. Helps when one TS is copied into another
    PCR                               *ClockReference // Program clock reference
    RandomAccessIndicator             bool            // Set when the stream may be decoded without errors from this point
    SpliceCountdown                   int             // Indicates how many TS packets from this one a splicing point occurs (Two's complement signed; may be negative)
    TransportPrivateDataLength        int
    TransportPrivateData              []byte

PacketAdaptationField represents a packet adaptation field

type PacketHeader Uses

type PacketHeader struct {
    ContinuityCounter          uint8 // Sequence number of payload packets (0x00 to 0x0F) within each stream (except PID 8191)
    HasAdaptationField         bool
    HasPayload                 bool
    PayloadUnitStartIndicator  bool   // Set when a PES, PSI, or DVB-MIP packet begins immediately following the header.
    PID                        uint16 // Packet Identifier, describing the payload data.
    TransportErrorIndicator    bool   // Set when a demodulator can't correct errors from FEC data; indicating the packet is corrupt.
    TransportPriority          bool   // Set when the current packet has a higher priority than other packets with the same PID.
    TransportScramblingControl uint8

PacketHeader represents a packet header

type PacketsParser Uses

type PacketsParser func(ps []*Packet) (ds []*Data, skip bool, err error)

PacketsParser represents an object capable of parsing a set of packets containing a unique payload spanning over those packets Use the skip returned argument to indicate whether the default process should still be executed on the set of packets

type SDTData Uses

type SDTData struct {
    OriginalNetworkID uint16
    Services          []*SDTDataService
    TransportStreamID uint16

SDTData represents an SDT data Page: 33 | Chapter: 5.2.3 | Link: https://www.dvb.org/resources/public/standards/a38_dvb-si_specification.pdf

type SDTDataService Uses

type SDTDataService struct {
    Descriptors            []*Descriptor
    HasEITPresentFollowing bool // When true indicates that EIT present/following information for the service is present in the current TS
    HasEITSchedule         bool // When true indicates that EIT schedule information for the service is present in the current TS
    HasFreeCSAMode         bool // When true indicates that access to one or more streams may be controlled by a CA system.
    RunningStatus          uint8
    ServiceID              uint16

SDTDataService represents an SDT data service

type TOTData Uses

type TOTData struct {
    Descriptors []*Descriptor
    UTCTime     time.Time

TOTData represents a TOT data Page: 39 | Chapter: 5.2.6 | Link: https://www.dvb.org/resources/public/standards/a38_dvb-si_specification.pdf



Package astits imports 9 packages (graph) and is imported by 24 packages. Updated 2020-06-30. Refresh now. Tools for package owners.