-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scte35 creation #94
Scte35 creation #94
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main concern about this PR is the exploding interfaces that are being created. If we really do want to support the next SCTE spec these are useful, but if not a lot of this code can go away. All the accessors can go away, and we can export the fields of the struct. I'm curious if other's have guidance on this.
psi/psi.go
Outdated
@@ -60,3 +60,50 @@ func sectionSyntaxIndicator(psi []byte) bool { | |||
func sectionLength(psi []byte) uint16 { | |||
return uint16(psi[1]&3)<<8 | uint16(psi[2]) | |||
} | |||
|
|||
func NewPointerField(size int) []byte { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A quick go doc style comment would be good here.
SegUPADSINFO: "SegUPADSINFO", | ||
SegUPIDURN: "SegUPIDURN", | ||
} | ||
|
||
// SCTE35 represent operations available on a SCTE35 message. | ||
type SCTE35 interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This interface is becoming a beast. Since we are in the business of breaking api's lately do we want to consider ditching this? Do we think there is a chance we will back this interface with SCTE 2015 and SCTE 20XX?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is a good idea to remove the interfaces. But this big api breaking change should be done separately from this pull request. That way this pull request does not break any backwards compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can get behind that
@@ -204,42 +357,101 @@ type SegmentationDescriptor interface { | |||
SCTE35() SCTE35 | |||
// EventID returns the event id | |||
EventID() uint32 | |||
// TypeID returns the segmentation type for descriptor | |||
TypeID() SegDescType | |||
// SetEventID sets the event id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing with this interface.
scte35/modify.go
Outdated
s.commandInfo.SetHasPTS(true) | ||
} | ||
|
||
// HasPTS returns true if there is a pts time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment doesn't match the fuction
|
||
// String returns a string representation of the SCTE35 message. | ||
// String function is for debugging and testing. | ||
func (s *scte35) String() string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've already talked about this, but it might be worthwhile to output JSON instead of this crafted string. This could be addressed in another PR though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or have multiple methods: one for a formatted string and another for a JSON formatted string.
scte35/splicecommand.go
Outdated
func (c *spliceNull) PTS() gots.PTS { | ||
return 0 | ||
} | ||
|
||
type component struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be good to follow the convention that all type definitions remain in the doc.go
file.
scte35/splicecommandmodify.go
Outdated
} | ||
|
||
// returns the bytes of this splice command. | ||
func (c *timeSignal) Data() []byte { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the func (c *spliceInsert) Data() []byte
below need function names for godoc style comments
scte35/state.go
Outdated
@@ -28,19 +28,6 @@ import "github.com/Comcast/gots" | |||
|
|||
const receivedRingLen = 10 | |||
|
|||
type receivedElem struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I don't agree with the pattern of moving private structs/fields to doc.go
I'm not going to block the PR for it.
Added functionality that allows for the creation and modification of SCTE35. Exposed some private fields from SCTE35 related interfaces, such as mid. Segmentation Descriptors, Splice Commands, and SCTE35 are able to decode all of the fields instead of just skipping over them. Added Interfaces and structures that were necessary to achieve this. Every field that can be decoded into a struct can now also be encoded back into bytes.
PSI interface was removed because nothing implemented it. It was replaced by a TableHeader struct.
Tests were added for both the new SCTE35 functions and the TableHeader functions.
Example of how to use the new SCTE35 functions: