Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Add version 1 event message support #94

Open
mpegdash-user opened this issue Mar 11, 2020 · 1 comment
Open

Add version 1 event message support #94

mpegdash-user opened this issue Mar 11, 2020 · 1 comment

Comments

@mpegdash-user
Copy link

event messages (as used by scte35.py) use the version 0 variant of the emsg box. The dashif client has been updated to support version 1 event messages (well, almost, see Dash-Industry-Forum/dash.js#3196) but is hard to test without a ready source for these.

The following diff updates emsg.py to handle both version 0 and version 1 event messages.

48c48
< from .structops import uint32_to_str
---
> from .structops import uint32_to_str, uint64_to_str
56c56
<                  emsg_id=0, messagedata=""):
---
>                  emsg_id=0, messagedata="", version=0):
62a63
>         self.version = version
67d67
<         size = 12 + 4*4 + len(self.scheme_id_uri) + 1 + len(self.value) + 1 + len(self.messagedata)
69,78c69,94
<         parts.append(uint32_to_str(size))
<         parts.append("emsg")
<         parts.append("\x00\x00\x00\x00")
<         parts.append(self.scheme_id_uri + "\x00")
<         parts.append(self.value + "\x00")
<         parts.append(uint32_to_str(self.timescale))
<         parts.append(uint32_to_str(self.presentation_time_delta))
<         parts.append(uint32_to_str(self.event_duration))
<         parts.append(uint32_to_str(self.emsg_id))
<         parts.append(self.messagedata)
---
>         if self.version == 0:
>           size = 12 + 4*4 + len(self.scheme_id_uri) + 1 + len(self.value) + 1 + len(self.messagedata)
>           parts.append(uint32_to_str(size))
>           parts.append("emsg")
>           parts.append("\x00")  #version
>           parts.append("\x00\x00\x00") #flags
>           parts.append(self.scheme_id_uri + "\x00")
>           parts.append(self.value + "\x00")
>           parts.append(uint32_to_str(self.timescale))
>           print "presentation_time_delta = %d"%self.presentation_time_delta
>           parts.append(uint32_to_str(self.presentation_time_delta))
>           parts.append(uint32_to_str(self.event_duration))
>           parts.append(uint32_to_str(self.emsg_id))
>         else:
>           size = 12 + 3*4 + 8 + len(self.scheme_id_uri) + 1 + len(self.value) + 1 + len(self.messagedata)
>           parts.append(uint32_to_str(size)) # size
>           parts.append("emsg")   #box name
>           parts.append("\x01") #version
>           parts.append("\x00\x00\x00") #flags
>           parts.append(uint32_to_str(self.timescale)) # timescale
>           parts.append(uint64_to_str(self.presentation_time_delta)) #presentation_time
>           parts.append(uint32_to_str(self.event_duration)) #duration
>           parts.append(uint32_to_str(self.emsg_id)) #id
>           parts.append(self.scheme_id_uri + "\x00") #scheme_id_uri
>           parts.append(self.value + "\x00") # value
>         parts.append(self.messagedata) #messagedata
91c107
<                 message_data=""):
---
>                 message_data="",version=0):
93c109
<     emsg = Emsg(scheme_id_uri, value, timescale, presentation_time_delta, event_duration, emsg_id, message_data)
---
>     emsg = Emsg(scheme_id_uri, value, timescale, presentation_time_delta, event_duration, emsg_id, message_data, version)
@TobbeEdgeware
Copy link

Sorry for not reacting to this. I'll try to incorporate this in the new Python3 code. I'll change the code to always return version 1, which I hope is fine?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants