sofia

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2023 License: OSL-3.0 Imports: 5 Imported by: 0

README

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CryptSampleCenc

func CryptSampleCenc(sample, key []byte, enc EncryptionSample) error

github.com/Eyevinn/mp4ff/blob/v0.40.2/mp4/crypto.go#L101

Types

type AudioSampleEntry

type AudioSampleEntry struct {
	Header               BoxHeader
	Reserved             [6]uint8
	Data_Reference_Index uint16
	Extends              struct {
		Reserved     [2]uint32
		ChannelCount uint16
		SampleSize   uint16
		Pre_Defined  uint16

		SampleRate uint32
		// contains filtered or unexported fields
	}
	Boxes []*Box
}
class AudioSampleEntry(codingname) extends SampleEntry(codingname) {
   const unsigned int(32)[2] reserved = 0;
   unsigned int(16) channelcount;
   template unsigned int(16) samplesize = 16;
   unsigned int(16) pre_defined = 0;
   const unsigned int(16) reserved = 0 ;
   template unsigned int(32) samplerate = { default samplerate of media}<<16;
}

func (*AudioSampleEntry) Decode

func (a *AudioSampleEntry) Decode(r io.Reader) error

func (AudioSampleEntry) Encode

func (a AudioSampleEntry) Encode(w io.Writer) error

type Box

type Box struct {
	Header  BoxHeader
	Payload []byte
}

aligned(8) class Box ( unsigned int(32) boxtype, optional unsigned int(8)[16] extended_type

) {
   BoxHeader(
      boxtype,
      extended_type
   );
   // the remaining bytes are the BoxPayload
}

func (Box) Encode

func (b Box) Encode(w io.Writer) error

type BoxHeader

type BoxHeader struct {
	Size    uint32
	RawType [4]byte
}

aligned(8) class BoxHeader (

unsigned int(32) boxtype,
optional unsigned int(8)[16] extended_type
) {
   unsigned int(32) size;
   unsigned int(32) type = boxtype;
   if (size==1) {
      unsigned int(64) largesize;
   } else if (size==0) {
      // box extends to end of file
   }
   if (boxtype=='uuid') {
      unsigned int(8)[16] usertype = extended_type;
   }
}

func (BoxHeader) BoxPayload

func (b BoxHeader) BoxPayload() int64

func (*BoxHeader) Decode

func (b *BoxHeader) Decode(r io.Reader) error

func (BoxHeader) Encode

func (b BoxHeader) Encode(w io.Writer) error

func (BoxHeader) Type

func (b BoxHeader) Type() string

type EncryptionSample

type EncryptionSample struct {
	InitializationVector uint64
	Subsample_Count      uint16
	Subsamples           []Subsample
}

func (*EncryptionSample) Decode

func (EncryptionSample) Encode

type File

type File struct {
	Boxes []Box
	Moov  MovieBox
	Moof  MovieFragmentBox
	Mdat  MediaDataBox
}

func (*File) Decode

func (f *File) Decode(r io.Reader) error

func (File) Encode

func (f File) Encode(w io.Writer) error

type FullBoxHeader

type FullBoxHeader struct {
	Version  uint8
	RawFlags [3]byte
}

aligned(8) class FullBoxHeader(

unsigned int(8) v,
bit(24) f
) {
   unsigned int(8) version = v;
   bit(24) flags = f;
}

func (*FullBoxHeader) Decode

func (f *FullBoxHeader) Decode(r io.Reader) error

func (FullBoxHeader) Encode

func (f FullBoxHeader) Encode(w io.Writer) error

func (FullBoxHeader) Flags

func (f FullBoxHeader) Flags() uint32

type MediaBox

type MediaBox struct {
	Header BoxHeader
	Boxes  []Box
	Minf   MediaInformationBox
}

aligned(8) class MediaBox extends Box('mdia') { }

func (*MediaBox) Decode

func (b *MediaBox) Decode(r io.Reader) error

func (MediaBox) Encode

func (b MediaBox) Encode(w io.Writer) error

type MediaDataBox

type MediaDataBox struct {
	Header BoxHeader
	Data   [][]byte
}
aligned(8) class MediaDataBox extends Box('mdat') {
   bit(8) data[];
}

func (*MediaDataBox) Decode

func (b *MediaDataBox) Decode(t TrackRunBox, r io.Reader) error

func (MediaDataBox) Encode

func (b MediaDataBox) Encode(w io.Writer) error

type MediaInformationBox

type MediaInformationBox struct {
	Header BoxHeader
	Boxes  []Box
	Stbl   SampleTableBox
}

aligned(8) class MediaInformationBox extends Box('minf') { }

func (*MediaInformationBox) Decode

func (b *MediaInformationBox) Decode(r io.Reader) error

func (MediaInformationBox) Encode

func (b MediaInformationBox) Encode(w io.Writer) error

type MovieBox

type MovieBox struct {
	Header BoxHeader
	Boxes  []*Box
	Trak   TrackBox
}

aligned(8) class MovieBox extends Box('moov') { }

func (*MovieBox) Decode

func (b *MovieBox) Decode(r io.Reader) error

func (MovieBox) Encode

func (b MovieBox) Encode(w io.Writer) error

type MovieFragmentBox

type MovieFragmentBox struct {
	Header BoxHeader
	Boxes  []Box
	Traf   TrackFragmentBox
}

aligned(8) class MovieFragmentBox extends Box('moof') { }

func (*MovieFragmentBox) Decode

func (b *MovieFragmentBox) Decode(r io.Reader) error

func (MovieFragmentBox) Encode

func (b MovieFragmentBox) Encode(w io.Writer) error

type SampleDescriptionBox

type SampleDescriptionBox struct {
	BoxHeader     BoxHeader
	FullBoxHeader FullBoxHeader
	Entry_Count   uint32
	Enca          AudioSampleEntry
	Encv          VisualSampleEntry
}

aligned(8) class SampleDescriptionBox() extends FullBox(

'stsd',
version,
0
) {
   int i ;
   unsigned int(32) entry_count;
   for (i = 1 ; i <= entry_count ; i++){
      SampleEntry(); // an instance of a class derived from SampleEntry
   }
}

func (*SampleDescriptionBox) Decode

func (b *SampleDescriptionBox) Decode(r io.Reader) error

func (SampleDescriptionBox) Encode

func (s SampleDescriptionBox) Encode(w io.Writer) error

type SampleEncryptionBox

type SampleEncryptionBox struct {
	BoxHeader     BoxHeader
	FullBoxHeader FullBoxHeader
	Sample_Count  uint32
	Samples       []EncryptionSample
}

if the version of the SampleEncryptionBox is 0 and the flag senc_use_subsamples is set, UseSubSampleEncryption is set to 1

aligned(8) class SampleEncryptionBox extends FullBox(

'senc',
version,
flags
) {
   unsigned int(32) sample_count;
   {
      unsigned int(Per_Sample_IV_Size*8) InitializationVector;
      if (UseSubSampleEncryption) {
         unsigned int(16) subsample_count;
         {
            unsigned int(16) BytesOfClearData;
            unsigned int(32) BytesOfProtectedData;
         } [subsample_count ]
      }
   }[ sample_count ]
}

func (*SampleEncryptionBox) Decode

func (b *SampleEncryptionBox) Decode(r io.Reader) error

func (SampleEncryptionBox) Encode

func (b SampleEncryptionBox) Encode(w io.Writer) error

func (SampleEncryptionBox) Senc_Use_Subsamples

func (b SampleEncryptionBox) Senc_Use_Subsamples() bool

senc_use_subsamples: flag mask is 0x000002.

type SampleEntry

type SampleEntry struct {
	Header               BoxHeader
	Reserved             [6]uint8
	Data_Reference_Index uint16
}
aligned(8) abstract class SampleEntry(unsigned int(32) format) extends Box(format) {
   const unsigned int(8)[6] reserved = 0;
   unsigned int(16) data_reference_index;
}

type SampleTableBox

type SampleTableBox struct {
	Header BoxHeader
	Boxes  []Box
	Stsd   SampleDescriptionBox
}

aligned(8) class SampleTableBox extends Box('stbl') { }

func (*SampleTableBox) Decode

func (b *SampleTableBox) Decode(r io.Reader) error

func (SampleTableBox) Encode

func (b SampleTableBox) Encode(w io.Writer) error

type Subsample

type Subsample struct {
	BytesOfClearData     uint16
	BytesOfProtectedData uint32
}

func (*Subsample) Decode

func (s *Subsample) Decode(r io.Reader) error

func (Subsample) Encode

func (s Subsample) Encode(w io.Writer) error

type TrackBox

type TrackBox struct {
	Header BoxHeader
	Boxes  []Box
	Mdia   MediaBox
}

aligned(8) class TrackBox extends Box('trak') { }

func (*TrackBox) Decode

func (b *TrackBox) Decode(r io.Reader) error

func (TrackBox) Encode

func (b TrackBox) Encode(w io.Writer) error

type TrackFragmentBox

type TrackFragmentBox struct {
	Header BoxHeader
	Boxes  []Box
	Trun   TrackRunBox
	Senc   SampleEncryptionBox
}

aligned(8) class TrackFragmentBox extends Box('traf') { }

func (*TrackFragmentBox) Decode

func (b *TrackFragmentBox) Decode(r io.Reader) error

func (TrackFragmentBox) Encode

func (b TrackFragmentBox) Encode(w io.Writer) error

type TrackRunBox

type TrackRunBox struct {
	BoxHeader          BoxHeader
	FullBoxHeader      FullBoxHeader
	Sample_Count       uint32
	Data_Offset        int32
	First_Sample_Flags uint32
	Samples            []TrackRunSample
}

If the data-offset is present, it is relative to the base-data-offset established in the track fragment header.

aligned(8) class TrackRunBox extends FullBox(

'trun',
version,
tr_flags

) {
   unsigned int(32) sample_count;
   signed int(32) data_offset; // 0x000001, assume present
   unsigned int(32) first_sample_flags; // 0x000004
   {
      unsigned int(32) sample_duration; // 0x000100
      unsigned int(32) sample_size; // 0x000200, assume present
      unsigned int(32) sample_flags // 0x000400
      if (version == 0) {
         unsigned int(32) sample_composition_time_offset; // 0x000800
      } else {
         signed int(32) sample_composition_time_offset; // 0x000800
      }
   }[ sample_count ]
}

func (*TrackRunBox) Decode

func (b *TrackRunBox) Decode(r io.Reader) error

func (TrackRunBox) Encode

func (b TrackRunBox) Encode(w io.Writer) error

func (TrackRunBox) First_Sample_Flags_Present

func (b TrackRunBox) First_Sample_Flags_Present() bool

0x000004 first-sample-flags-present

func (TrackRunBox) Sample_Composition_Time_Offsets_Present

func (b TrackRunBox) Sample_Composition_Time_Offsets_Present() bool

0x000800 sample-composition-time-offsets-present

func (TrackRunBox) Sample_Duration_Present

func (b TrackRunBox) Sample_Duration_Present() bool

0x000100 sample-duration-present

func (TrackRunBox) Sample_Flags_Present

func (b TrackRunBox) Sample_Flags_Present() bool

0x000400 sample-flags-present

type TrackRunSample

type TrackRunSample struct {
	Duration                uint32
	Size                    uint32
	Flags                   uint32
	Composition_Time_Offset [4]byte
}

func (*TrackRunSample) Decode

func (s *TrackRunSample) Decode(b *TrackRunBox, r io.Reader) error

func (TrackRunSample) Encode

func (s TrackRunSample) Encode(b TrackRunBox, w io.Writer) error

type VisualSampleEntry

type VisualSampleEntry struct {
	Header               BoxHeader
	Reserved             [6]uint8
	Data_Reference_Index uint16
	Extends              struct {
		Pre_Defined uint16
		Reserved    uint16

		Width           uint16
		Height          uint16
		HorizResolution uint32
		VertResolution  uint32

		Frame_Count    uint16
		CompressorName [32]uint8
		Depth          uint16
		// contains filtered or unexported fields
	}
	Boxes []*Box
}
class VisualSampleEntry(codingname) extends SampleEntry(codingname) {
   unsigned int(16) pre_defined = 0;
   const unsigned int(16) reserved = 0;
   unsigned int(32)[3] pre_defined = 0;
   unsigned int(16) width;
   unsigned int(16) height;
   template unsigned int(32) horizresolution = 0x00480000; // 72 dpi
   template unsigned int(32) vertresolution = 0x00480000; // 72 dpi
   const unsigned int(32) reserved = 0;
   template unsigned int(16) frame_count = 1;
   uint(8)[32] compressorname;
   template unsigned int(16) depth = 0x0018;
   int(16) pre_defined = -1;
   // other boxes from derived specifications
   CleanApertureBox clap; // optional
   PixelAspectRatioBox pasp; // optional
}

func (*VisualSampleEntry) Decode

func (v *VisualSampleEntry) Decode(r io.Reader) error

func (VisualSampleEntry) Encode

func (v VisualSampleEntry) Encode(w io.Writer) error

Directories

Path Synopsis
blog

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL