Code Monkey home page Code Monkey logo

streaming's People

Stargazers

Irfan Smajevic avatar  avatar Sudhanshu Pandey avatar Christopher (CJ) Sampson avatar Jacob Parker avatar  avatar Preston avatar  avatar Owolabi Oromidayo avatar Kammersgaard avatar Daniel Dennis avatar  avatar  avatar  avatar pyfagorass avatar Elisey Shemyakin avatar Minho Ryang avatar Rawlings Oguna avatar Antoine Bagnaud avatar Sven Sackers avatar Wasawat Somno avatar diego avatar  avatar Rituparn Shukla avatar Gaurav Rao avatar  avatar Alrizki Pasca avatar Arindam Das avatar Eduardo Oliveira avatar pawan avatar Daniel Esparza avatar Tor E Hagemann avatar  avatar  avatar Artur Parkhisenko avatar Marcos avatar jovi avatar moses avatar  avatar  avatar Maxim Levkov avatar Mike English avatar

Watchers

Oliver Lowe avatar

streaming's Issues

m3u8: support writing SessionData to m3u8 format

Our struct SessionData is just skipped in Encode().
At a high level what we need is to have a SessionData like:

v := SessionData{
	ID: "1234",
	Value: "5678",
	URI: "hello/hi.json",
	Language: "indonesian",
}

to be represented as a string like this:

#EXT-X-SESSION-DATA:DATA-ID="1234",VALUE="5678",URI="hello/hi.json",LANGUAGE="indonesian"

scte35: un-export EventIDCompliance?

For every test case, Segmentation.EventIDCompliance (or anywhere else a so-called event ID field is) the value is always true. But this isn't really specified in plain language in the specs. It looks like it should be calculated from the associated event ID at encode/decode time.

Arguably we don't really need to have the field, exported or not, in the struct.
Relevant structures are:

  • Event
  • Insert
  • SegmentationDescriptor

scte35: generate CRC32 table programmatically

There's an array with a bunch of magic values that we don't know how they are generated or where they come from.
If they can't be generated trivially, then maybe a link to somewhere the table can be copy & pasted from would be helpful.

m3u8: Encode() is really big, could extract Playlist.Media logic

Not that 114 lines is really big, it's just that it's much longer than it needs to be.
The logic to write Renditions in m3u8 format could be extracted to its own function and tested independently,
especially considering that in m3u8, a Rendition comes out to be one tag.
For example, two Renditions would look like:

#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Main",DEFAULT=YES,URI="low/main/audio-video.m3u8"
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Centerfield",DEFAULT=NO,URI="low/centerfield/audio-video.m3u8"

For example, something like...

func writeRenditions(w io.Writer, renditions []Rendition) (n int, err error) {
	//
}

func TestWriteRenditions(t *testing.T) {}

Test cases should be pretty easy too.
For the first rendition in the above example:

type t struct {
	name string
	rend Rendition
	out string
}
v := t{
	name: "Main"
	rend: Rendition{
		Type: MediaVideo,
		URI: "low/main/audio-video.m3u8",
		Group: "low",
		Name: "Main",
		Default: true,
	}
	out: `#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Main",DEFAULT=YES,URI="low/main/audio-video.m3u8"`,
}

We should avoid using fmt.Fprint and instead just append each tag attribute to a []string to obviate a bunch of error handling.

m3u8: Encode() is really big, could extract Playlist.Variants logic

The same idea as #7.
Say we have a Variant:

v := Variant{
	Bandwidth: 1280000,
	Video: "low",
	URI: "low/main/audio-video.m3u8"
}

we want a function that can take that structure and return a string that would be inserted into a playlist, like:

#EXT-X-STREAM-INF:BANDWIDTH=1280000,VIDEO="low"
low/main/audio-video.m3u8

I think we have most of that implemented but we aren't testing it in isolation.
Some function like

TestWriteVariant(t *testing.T) {}

will make it much easier to add test cases: both ones that are valid EXT-X-STREAM-INF tags, and invalid ones too.

For more examples, see m3u8/testdata/master.m3u8

scte35: create constants for all segmentation descriptor types

The values are documented in SCTE 35 section SCTE 35 section 10.3.3.1.
Right now we have magic values floating around. See in particular:

crc_32.go:95: 	0x30476DC0,
splice_descriptor.go:152: 		case 0x34, 0x30, 0x32, 0x36, 0x38, 0x3a, 0x44, 0x46:
splice_descriptor.go:206: 		case 0x34, 0x30, 0x32, 0x36, 0x38, 0x3a, 0x44, 0x46:
splice_info.go:17: 	SAPNone                     = 0x30

These should be constants named, for example, ProviderAdStart or so.

m3u8: catch invalid CCInfo.ID values

In parseCCInfo(), we can parse values for the ID field that are invalid.
The only valid values for CCInfo.ID are the 4 integers 1, 2, 3, 4.
For example, we parse this playlist without error:

#EXTM3U
#EXT-X-VERSION:7
#EXT-X-MEDIA:TYPE=AUDIO,INSTREAM-ID="CC69"

The only valid values for the INSTREAM-ID attribute are "CC1", "CC2", "CC3", "CC4" and
"SERVICE1" through "SERVICE63".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.