untangledco / streaming

Media streaming and broadcast systems in Go
https://twitch.tv/untangledco
ISC License
82 stars 5 forks source link

m3u8: Finish TODOs in writeDateRange() #19

Open ollytom opened 2 months ago

ollytom commented 2 months ago

Fields of DateRange that we're not writing out as text include:

CueCommand

Need to work out under which conditions to write it out. If CuiIn or CueOut are set, we cannot write out CueCommand as that's invalid.

Another bit of error handling might be to check that CueCommand and/or CueIn/Out have a valid value set in the Splice.Type.

Custom

We'll need a type switch on the value, and error out if we get anything we can't reliably turn into text. I don't think we'll be able quoted versus unquoted strings. Quick sketch:

switch v.(type) {
case float32:
    return fmt.Sprintf("%03f"...
case string:
    return fmt.Sprintf("%q" ...)
case int:
    return fmt.Sprintf("%d", ...
default:
    return fmt.Errorf("attribute %s: cannot marshal %T to text", v)
}