streaming icon indicating copy to clipboard operation
streaming copied to clipboard

m3u8: Finish TODOs in writeDateRange()

Open ollytom opened this issue 1 year ago • 0 comments

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

  • Duration, Planned
  • Custom attributes
  • CueCommand

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)
}

ollytom avatar Jun 04 '24 08:06 ollytom