iheartradio / open-m3u8

Open Source m3u8 Parser
Other
245 stars 94 forks source link

KEYFORMATVERSIONS, KEYFORMAT attribute default handling #31

Open kalemeister opened 8 years ago

kalemeister commented 8 years ago

An application I made that uses open-m3u8 has a section where it reads a playlist then creates a new one based on edited values in the original list. I noticed the original playlist didn't have the attributes KEYFORMATVERSIONS and KEYFORMAT. But the new one has the attributes with their default values.

I read the specification "HTTP Live Streaming draft-pantos-http-live-streaming-16". It states in there that these two attributes are optional and their omission means the default values will be assumed. So newly created playlists don't need to include these unless their values are non-default.

So I was wondering if this behavior would be desired (new playlists won't include these attributes unless they were specified before or their values are non-default). If so I'll try to work on it in a new fork.

This isn't an important issue nonetheless. The rewritten playlist with these two attributes included worked fine.

kalemeister commented 8 years ago

I made the changes so that a new MediaPlaylist won't write these attributes to a new playlist file if their values are default. If a new list is build by 'buildUpon' and the previous list has these attributes then it will include them in the new file.

If you want to check it out let me know and I'll make a new fork with these changes after my current fork (of different changes) is done/closed.