http

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SegHeadValues map[int]map[int][]int

SegHeadValues store the seg header maps

Functions

func GetAllSegmentHeaders

func GetAllSegmentHeaders(mpdList []MPD, codecIndexList [][]int,
	maxHeight int,
	segmentNumber int, streamDuration int,
	isByteRangeMPD bool,
	maxBuffer int,
	headerURL string, codec string, urlInput []string, debugLog bool, printToFile bool) map[int]map[int][]int

GetAllSegmentHeaders : get all segment headers for all MPD urls

func GetByteRangeSegmentDetails

func GetByteRangeSegmentDetails(mpd []MPD, mpdListIndex int) (int, []int)

GetByteRangeSegmentDetails : get segment duration and number of segments from provided MPD file

func GetCodec

func GetCodec(mpdList []MPD, codec string, debugLog bool) ([][]string, [][]int)

GetCodec :

  • for the list of passed in MPD urls
  • return an array of the codecs offered in the MPDs
  • return the index for the codec provided, -1 for all codecs

func GetContentLengthHeader

func GetContentLengthHeader(currentMPD MPD, currentURL string, currentMPDRepAdaptSet int, repRate int, segmentNumber int, adaptationSetBaseURL string, debugLog bool) int

GetContentLengthHeader : get the header of the next segment to have the informations about it

func GetFile

func GetFile(currentURL string, fileBaseURL string, fileLocation string, isByteRangeMPD bool, startRange int, endRange int,
	segmentNumber int, segmentDuration int, addSegDuration bool, quicBool bool, debugFile string, debugLog bool,
	useTestbedBool bool, repRate int) (time.Duration, int, string, string)

GetFile :

  • Function getFile :
  • get the provided file from the online HTTP server and save to folder

func GetFileProgressively

func GetFileProgressively(currentURL string, fileBaseURL string, fileLocation string, isByteRangeMPD bool, startRange int, endRange int, segmentNumber int, segmentDuration int, addSegDuration bool, debugLog bool) (time.Duration, int)

GetFileProgressively :

  • get the provided file from the online HTTP server and save to folder
  • get a 1-second piece of each file

func GetFullStreamHeader

func GetFullStreamHeader(mpd MPD, isByteRangeMPD bool) string

GetFullStreamHeader :

  • get the header file for the current video clip
  • I've called this full in case the other profile have a different structure

func GetMPDValues

func GetMPDValues(mpd []MPD, mpdListIndex int, maxHeight int, streamDuration int, maxBuffer int, currentMPDRepAdaptSet int, isByteRangeMPD bool, debugLog bool) (int, int, int, int, []int, []int, string)

GetMPDValues : get important values from the provided MPD

func GetMPDheightIndex

func GetMPDheightIndex(mpd MPD, maxHeight int, currentMPDRepAdaptSet int, debugLog bool) int

GetMPDheightIndex : get the maximum index for a given resolution height in a provided MPD file

func GetMaxListIndex

func GetMaxListIndex(mpd MPD, currentMPDRepAdaptSet int) int

GetMaxListIndex : get the maximum rep_rate from the MPD

func GetNSegmentHeaders

func GetNSegmentHeaders(mpdList []MPD, codecIndexList [][]int,
	maxHeight int,
	segmentNumber int, streamDuration int,
	isByteRangeMPD bool,
	maxBuffer int,
	headerURL string, codec string, urlInput []string, debugLog bool, useHeaderFile bool) map[int]map[int][]int

GetNSegmentHeaders : get N segment headers for all MPD urls (based on stream time)

func GetNextByteRangeURL

func GetNextByteRangeURL(mpd MPD, SegNumber int, SegQUALITY int, currentMPDRepAdaptSet int) (string, int, int)

GetNextByteRangeURL : Return the base URL, start and end range for the byte range MPD

func GetNextSegment

func GetNextSegment(mpd MPD, SegNumber int, SegQUALITY int, currentMPDRepAdaptSet int) string

GetNextSegment :

  • select the right segment in the MPD given
  • Return the URL of this segment

func GetNextSegmentDuration

func GetNextSegmentDuration(segmentDurations []int, lastSegmentDuration int, totalSegmentDuration int, debugFile string, debugLog bool, segmentDuration int, streamDuration int) (stopApp bool, mpdIndex int, nextSegmentNumber int)

GetNextSegmentDuration : * returns an index for the MPD and the next segment we can use * currently randomised - to illustrate functionality

func GetRepresentationBandwidth

func GetRepresentationBandwidth(mpd MPD, currentMPDRepAdaptSet int) (bandwithList []int)

GetRepresentationBandwidth : get Representation Bandwidth - divided by 1000

func GetRepresentationBaseURL

func GetRepresentationBaseURL(mpd MPD, currentMPDRepAdaptSet int) string

GetRepresentationBaseURL : * get BaseURL for byte-range MPD

func GetSegmentDetails

func GetSegmentDetails(mpd []MPD, mpdListIndex int) (int, []int)

GetSegmentDetails : get segment duration and number of segments from provided MPD file

func GetURL

func GetURL(url string, isByteRangeMPD bool, startRange int, endRange int, quicBool bool, debugFile string, debugLog bool, useTestbedBool bool) ([]byte, time.Duration, string)

GetURL : * return the content of the body of the url

func GetURLByteRangeBody

func GetURLByteRangeBody(url string, startRange int, endRange int) (io.ReadCloser, time.Duration)

GetURLByteRangeBody : * get the response body of the url and return an io.ReadCloser * based on byte-ranges

func JoinURL

func JoinURL(baseURL string, append string, debugLog bool) string

JoinURL :

  • func joinURL(baseURL string, append string) string *
  • join components of urls together
  • return the URL

func SplitMPDSegmentDuration

func SplitMPDSegmentDuration(mpdSegDuration string) int

SplitMPDSegmentDuration : get the per second details from the MPD segments

func URLList

func URLList(urlString string) []string

URLList : turn the url string into a urlList

Types

type AdaptationSet

type AdaptationSet struct {
	XMLName            xml.Name `xml:"AdaptationSet"`
	SegmentAlignment   bool     `xml:"segmentAlignment,attr"`
	BitstreamSwitching bool     `xml:"bitstreamSwitching,attr"`
	MaxWidth           int      `xml:"maxWidth,attr"`
	MaxHeight          int      `xml:"maxHeight"`
	MaxFrameRate       int      `xml:"maxFrameRate"`

	Par string `xml:"par,attr"`

	Lang            string            `xml:"lang,attr"`
	BaseURL         string            `xml:"BaseURL"`
	Representation  []Representation  `xml:"Representation"`
	SegmentTemplate []SegmentTemplate `xml:"SegmentTemplate"`
	SegmentList     SegmentList       `xml:"SegmentList"`
}

AdaptationSet in MPD

type Initialization

type Initialization struct {
	XMLName   xml.Name `xml:"Initialization"`
	SourceURL string   `xml:"sourceURL,attr"`
}

Initialization in MPD

type MPD

type MPD struct {
	XMLName xml.Name `xml:"MPD"`

	Xmlns                     string `xml:"xmlns,attr"`
	MinBufferTime             string `xml:"minBufferTime,attr"`
	MediaPresentationDuration string `xml:"mediaPresentationDuration,attr"`
	MaxSegmentDuration        string `xml:"maxSegmentDuration,attr"`
	Profiles                  string `xml:"profiles,attr"`

	Periods            []Period           `xml:"Period"`
	ProgramInformation ProgramInformation `xml:"ProgramInformation"`
}

MPD structure

func ReadURLArray

func ReadURLArray(args string, debugLog bool, useTestbedBool bool, quicbool bool) (structList []MPD)

ReadURLArray :

* Read the string of url parameters passed to the app * split the urls to have a list * call getStructList with the list to have the MPDs * return a struct of MPDs

type Period

type Period struct {
	XMLName       xml.Name        `xml:"Period"`
	Duration      string          `xml:"duration,attr"`
	AdaptationSet []AdaptationSet `xml:"AdaptationSet"`
}

Period in MPD

type ProgramInformation

type ProgramInformation struct {
	XMLName            xml.Name `xml:"ProgramInformation"`
	MoreInformationURL string   `xml:"moreInformationURL,attr"`
	Title              string   `xml:"Title"`
}

ProgramInformation in MPD

type Representation

type Representation struct {
	XMLName         xml.Name        `xml:"Representation"`
	ID              int             `xml:"id,attr"`
	MimType         string          `xml:"mimType,attr"`
	Codecs          string          `xml:"codecs,attr"`
	Width           int             `xml:"width,attr"`
	Height          int             `xml:"height,attr"`
	FrameRate       int             `xml:"frameRate,attr"`
	Sar             string          `xml:"sar,attr"`
	StartWithSap    int             `xml:"startWithSap,attr"`
	BandWidth       int             `xml:"bandwidth,attr"`
	BaseURL         string          `xml:"BaseURL"`
	SegmentTemplate SegmentTemplate `xml:"SegmentTemplate"`
	SegmentList     SegmentList     `xml:"SegmentList"`
}

Representation in MPD

type SegmentList

type SegmentList struct {
	XMLName            xml.Name       `xml:"SegmentList"`
	Timescale          int            `xml:"timescale,attr"`
	Duration           int            `xml:"duration,attr"`
	SegmentURL         []segmentURL   `xml:"SegmentURL"`
	SegmentInitization Initialization `xml:"Initialization"`
}

SegmentList in MPD

type SegmentTemplate

type SegmentTemplate struct {
	XMLName        xml.Name `xml:"SegmentTemplate"`
	Media          string   `xml:"media,attr"`
	Timescale      int      `xml:"timescale,attr"`
	StartNumber    int      `xml:"startNumber,attr"`
	Duration       int      `xml:"duration,attr"`
	Initialization string   `xml:"initialization,attr"`
}

SegmentTemplate in MPD

Jump to

Keyboard shortcuts

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