commit cb0ae61b80e039914e550fce6603ec173bba026e
parent d80d8e86bfabae829e62cce890148ad795743e3a
Author: Oliver Lowe <o@olowe.co>
Date: Wed, 1 May 2024 15:35:47 +1000
internal/scte35: use empty struct for xml namespace
Since it's never set anywhere, we don't need to allow setting it by
users either.
Diffstat:
12 files changed, 14 insertions(+), 30 deletions(-)
diff --git a/internal/scte35/audio_descriptor.go b/internal/scte35/audio_descriptor.go
@@ -17,7 +17,6 @@
package scte35
import (
- "encoding/xml"
"fmt"
"strconv"
@@ -34,7 +33,7 @@ const (
// support dynamic signaling (e.g., signaling of audio language changes) and
// with legacy audio formats that do not support dynamic signaling.
type AudioDescriptor struct {
- XMLName xml.Name `xml:"http://www.scte.org/schemas/35 AudioDescriptor" json:"-"`
+ XMLName struct{} `xml:"http://www.scte.org/schemas/35 AudioDescriptor" json:"-"`
JSONType uint32 `xml:"-" json:"type"`
AudioChannels []AudioChannel `xml:"http://www.scte.org/schemas/35 AudioChannel" json:"audioChannels"`
}
diff --git a/internal/scte35/avail_descriptor.go b/internal/scte35/avail_descriptor.go
@@ -17,7 +17,6 @@
package scte35
import (
- "encoding/xml"
"fmt"
"github.com/bamiaux/iobit"
@@ -36,7 +35,7 @@ const (
// used in analog systems for ad insertion. This descriptor is intended only
// for use with a splice_insert() command, within a splice_info_section.
type AvailDescriptor struct {
- XMLName xml.Name `xml:"http://www.scte.org/schemas/35 AvailDescriptor" json:"-"`
+ XMLName struct{} `xml:"http://www.scte.org/schemas/35 AvailDescriptor" json:"-"`
JSONType uint32 `xml:"-" json:"type"`
ProviderAvailID uint32 `xml:"providerAvailId,attr" json:"providerAvailId"`
}
diff --git a/internal/scte35/bandwidth_reservation.go b/internal/scte35/bandwidth_reservation.go
@@ -17,7 +17,6 @@
package scte35
import (
- "encoding/xml"
"fmt"
)
@@ -38,7 +37,7 @@ const (
// should be a private descriptor that is utilized only by the bandwidth
// reservation process.
type BandwidthReservation struct {
- XMLName xml.Name `xml:"http://www.scte.org/schemas/35 BandwidthReservation" json:"-"`
+ XMLName struct{} `xml:"http://www.scte.org/schemas/35 BandwidthReservation" json:"-"`
JSONType uint32 `xml:"-" json:"type"`
}
diff --git a/internal/scte35/dtmf_descriptor.go b/internal/scte35/dtmf_descriptor.go
@@ -17,7 +17,6 @@
package scte35
import (
- "encoding/xml"
"fmt"
"github.com/bamiaux/iobit"
@@ -33,7 +32,7 @@ const (
// device to generate a legacy analog DTMF sequence based on a
// splice_info_section being received.
type DTMFDescriptor struct {
- XMLName xml.Name `xml:"http://www.scte.org/schemas/35 DTMFDescriptor" json:"-"`
+ XMLName struct{} `xml:"http://www.scte.org/schemas/35 DTMFDescriptor" json:"-"`
JSONType uint32 `xml:"-" json:"type"`
Preroll uint32 `xml:"preroll,attr" json:"preroll"`
DTMFChars string `xml:"chars,attr" json:"chars"`
diff --git a/internal/scte35/private_descriptor.go b/internal/scte35/private_descriptor.go
@@ -18,7 +18,6 @@ package scte35
import (
"encoding/binary"
- "encoding/xml"
"fmt"
"github.com/bamiaux/iobit"
@@ -26,7 +25,7 @@ import (
// PrivateDescriptor encapsulates the contents of non-CUEI descriptors
type PrivateDescriptor struct {
- XMLName xml.Name `xml:"http://www.scte.org/schemas/35 PrivateDescriptor" json:"-"`
+ XMLName struct{} `xml:"http://www.scte.org/schemas/35 PrivateDescriptor" json:"-"`
JSONType uint32 `xml:"-" json:"type"`
PrivateTag uint32 `xml:"tag,attr" json:"tag"`
Identifier uint32 `xml:"identifier,attr" json:"identifier"`
diff --git a/internal/scte35/segmentation_descriptor.go b/internal/scte35/segmentation_descriptor.go
@@ -17,7 +17,6 @@
package scte35
import (
- "encoding/xml"
"fmt"
"strconv"
@@ -171,7 +170,7 @@ const (
// in advance of the signaled splice_time() to permit the insertion device to
// place the splice_info_section( ) accurately.
type SegmentationDescriptor struct {
- XMLName xml.Name `xml:"http://www.scte.org/schemas/35 SegmentationDescriptor" json:"-"`
+ XMLName struct{} `xml:"http://www.scte.org/schemas/35 SegmentationDescriptor" json:"-"`
JSONType uint32 `xml:"-" json:"type"`
DeliveryRestrictions *DeliveryRestrictions `xml:"http://www.scte.org/schemas/35 DeliveryRestrictions" json:"deliveryRestrictions,omitempty"`
SegmentationUPIDs []SegmentationUPID `xml:"http://www.scte.org/schemas/35 SegmentationUpid" json:"segmentationUpids,omitempty"`
diff --git a/internal/scte35/splice_info_section.go b/internal/scte35/splice_info_section.go
@@ -54,7 +54,7 @@ const (
// and equal to 0x00 and the payload_unit_start_indicator bit shall be equal to
// one (per the requirements of section syntax usage per [MPEG Systems]).
type SpliceInfoSection struct {
- XMLName xml.Name `xml:"http://www.scte.org/schemas/35 SpliceInfoSection"`
+ XMLName struct{} `xml:"http://www.scte.org/schemas/35 SpliceInfoSection"`
EncryptedPacket EncryptedPacket `xml:"http://www.scte.org/schemas/35 EncryptedPacket,omitempty"`
SpliceCommand SpliceCommand `xml:""`
SpliceDescriptors SpliceDescriptors `xml:""`
diff --git a/internal/scte35/splice_insert.go b/internal/scte35/splice_insert.go
@@ -17,7 +17,6 @@
package scte35
import (
- "encoding/xml"
"fmt"
"strconv"
@@ -32,7 +31,7 @@ const (
// SpliceInsert is a command shall be sent at least once for every splice
// event.
type SpliceInsert struct {
- XMLName xml.Name `xml:"http://www.scte.org/schemas/35 SpliceInsert" json:"-"`
+ XMLName struct{} `xml:"http://www.scte.org/schemas/35 SpliceInsert" json:"-"`
JSONType uint32 `xml:"-" json:"type"`
Program *SpliceInsertProgram `xml:"http://www.scte.org/schemas/35 Program" json:"program,omitempty"`
Components []SpliceInsertComponent `xml:"http://www.scte.org/schemas/35 Component" json:"components,omitempty"`
diff --git a/internal/scte35/splice_null.go b/internal/scte35/splice_null.go
@@ -51,16 +51,10 @@ func (cmd *SpliceNull) decode(b []byte) error {
return nil
}
-// encode this splice_null to binary.
-func (cmd *SpliceNull) encode() ([]byte, error) {
- var b []byte
- return b, nil
-}
+func (cmd *SpliceNull) encode() ([]byte, error) { return []byte{}, nil }
// commandLength returns the splice_command_length.
-func (cmd *SpliceNull) length() int {
- return 0
-}
+func (cmd *SpliceNull) length() int { return 0 }
// writeTo the given table.
func (cmd *SpliceNull) writeTo(t *table) {
diff --git a/internal/scte35/splice_schedule.go b/internal/scte35/splice_schedule.go
@@ -17,7 +17,6 @@
package scte35
import (
- "encoding/xml"
"fmt"
"strconv"
@@ -33,7 +32,7 @@ const (
// SpliceSchedule is provided to allow a schedule of splice events to be
// conveyed in advance.
type SpliceSchedule struct {
- XMLName xml.Name `xml:"http://www.scte.org/schemas/35 SpliceSchedule" json:"-"`
+ XMLName struct{} `xml:"http://www.scte.org/schemas/35 SpliceSchedule" json:"-"`
JSONType uint32 `xml:"-" json:"type"`
Events []Event `xml:"http://www.scte.org/schemas/35 Event" json:"events"`
}
@@ -244,6 +243,6 @@ type EventComponent struct {
// EventProgram contains the Splice Point in Program Splice Mode
type EventProgram struct {
- XMLName xml.Name `xml:"http://www.scte.org/schemas/35 Program" json:"-"`
+ XMLName struct{} `xml:"http://www.scte.org/schemas/35 Program" json:"-"`
UTCSpliceTime UTCSpliceTime `xml:"utcSpliceTime,attr" json:"utcSpliceTime"`
}
diff --git a/internal/scte35/time_descriptor.go b/internal/scte35/time_descriptor.go
@@ -17,7 +17,6 @@
package scte35
import (
- "encoding/xml"
"fmt"
"github.com/bamiaux/iobit"
@@ -35,7 +34,7 @@ const (
// time_signal() or splice_insert( ) command. This command may be inserted using
// SCTE 104 or by out of band provisioning on the device inserting this message.
type TimeDescriptor struct {
- XMLName xml.Name `xml:"TimeDescriptor" json:"-"`
+ XMLName struct{} `xml:"TimeDescriptor" json:"-"`
JSONType uint32 `xml:"-" json:"type"`
TAISeconds uint64 `xml:"taiSeconds,attr" json:"taiSeconds"`
TAINS uint32 `xml:"taiNs,attr" json:"taiNs"`
diff --git a/internal/scte35/time_signal.go b/internal/scte35/time_signal.go
@@ -17,7 +17,6 @@
package scte35
import (
- "encoding/xml"
"fmt"
"github.com/bamiaux/iobit"
@@ -46,7 +45,7 @@ func NewTimeSignal(ptsTime uint64) *TimeSignal {
// time_signal(). The carriage however can be in a different PID than that
// carrying the other cue messages used for signaling splice points.
type TimeSignal struct {
- XMLName xml.Name `xml:"http://www.scte.org/schemas/35 TimeSignal" json:"-"`
+ XMLName struct{} `xml:"http://www.scte.org/schemas/35 TimeSignal" json:"-"`
JSONType uint32 `xml:"-" json:"type"`
SpliceTime SpliceTime `xml:"http://www.scte.org/schemas/35 SpliceTime" json:"spliceTime"`
}