From 1becbf5373fca3a43d007021502c4c5cae5c30ed Mon Sep 17 00:00:00 2001 From: Enrico Vittorini <36230446+enricovittorini@users.noreply.github.com> Date: Mon, 14 Aug 2023 12:16:13 +0200 Subject: [PATCH 1/7] Update section.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a check for false on private indicator: private_indicator – This is a 1-bit flag that shall be set to 0. --- section.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/section.go b/section.go index 476e09b..4b95426 100644 --- a/section.go +++ b/section.go @@ -27,6 +27,9 @@ func (infosec *InfoSection) Decode(bd *bitDecoder) bool { } infosec.SectionSyntaxIndicator = bd.asFlag() infosec.Private = bd.asFlag() + if infosec.Private { + return false + } infosec.Reserved = bd.asHex(2) infosec.SectionLength = bd.uInt16(12) infosec.ProtocolVersion = bd.uInt8(8) From f55dd3818351fc6e475d7d56b792d9d3b36199e3 Mon Sep 17 00:00:00 2001 From: Enrico Vittorini <36230446+enricovittorini@users.noreply.github.com> Date: Mon, 14 Aug 2023 12:29:15 +0200 Subject: [PATCH 2/7] Update section.go added a check on protocol version protocol_version: @ present, this attribute shall be set to 0. --- section.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/section.go b/section.go index 4b95426..ff46801 100644 --- a/section.go +++ b/section.go @@ -33,6 +33,9 @@ func (infosec *InfoSection) Decode(bd *bitDecoder) bool { infosec.Reserved = bd.asHex(2) infosec.SectionLength = bd.uInt16(12) infosec.ProtocolVersion = bd.uInt8(8) + infosec.ProtocolVersion != 0 { + return false + } infosec.EncryptedPacket = bd.asFlag() infosec.EncryptionAlgorithm = bd.uInt8(6) infosec.PtsAdjustment = bd.as90k(33) From 3b7403d653288eed5bc53ac83a04e90185654e90 Mon Sep 17 00:00:00 2001 From: enricovittorini Date: Mon, 14 Aug 2023 17:23:32 +0200 Subject: [PATCH 3/7] fix misisng if --- section.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/section.go b/section.go index ff46801..93ced5f 100644 --- a/section.go +++ b/section.go @@ -33,7 +33,7 @@ func (infosec *InfoSection) Decode(bd *bitDecoder) bool { infosec.Reserved = bd.asHex(2) infosec.SectionLength = bd.uInt16(12) infosec.ProtocolVersion = bd.uInt8(8) - infosec.ProtocolVersion != 0 { + if infosec.ProtocolVersion != 0 { return false } infosec.EncryptedPacket = bd.asFlag() From 29059ad982d3961cd0d507b19ece192b5f1d2440 Mon Sep 17 00:00:00 2001 From: enricovittorini Date: Mon, 14 Aug 2023 17:36:18 +0200 Subject: [PATCH 4/7] debugging --- descriptors.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/descriptors.go b/descriptors.go index e2270ec..9132796 100644 --- a/descriptors.go +++ b/descriptors.go @@ -2,6 +2,7 @@ package cuei import ( "fmt" + "log" ) // audioCmpt is a struct for audioDscptr Components @@ -55,16 +56,15 @@ type Descriptor struct { } // Return Descriptor as JSON -func (dscptr *Descriptor)Json() string{ - return mkJson(dscptr) +func (dscptr *Descriptor) Json() string { + return mkJson(dscptr) } // Print Descriptor as JSON -func (dscptr *Descriptor)Show(){ +func (dscptr *Descriptor) Show() { fmt.Printf(dscptr.Json()) } - /* * Decode returns a Splice Descriptor by tag. @@ -153,7 +153,11 @@ func (dscptr *Descriptor) timeDescriptor(bd *bitDecoder, tag uint8, length uint8 func (dscptr *Descriptor) segmentationDescriptor(bd *bitDecoder, tag uint8, length uint8) { dscptr.Tag = tag dscptr.Length = length + fmt.Println("Seg Desc Length: ", dscptr.Length) dscptr.Identifier = bd.asAscii(32) + if dscptr.Identifier != "0x43554549" { + log.Fatal("Segmentation Descriptor Identifies is not 0x43554549") + } dscptr.Name = "Segmentation Descriptor" dscptr.SegmentationEventID = bd.asHex(32) dscptr.SegmentationEventCancelIndicator = bd.asFlag() From 79173c5451fe9b716abc12755a07c3b99b73d568 Mon Sep 17 00:00:00 2001 From: enricovittorini Date: Mon, 14 Aug 2023 17:38:51 +0200 Subject: [PATCH 5/7] fix --- descriptors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descriptors.go b/descriptors.go index 9132796..a044647 100644 --- a/descriptors.go +++ b/descriptors.go @@ -156,7 +156,7 @@ func (dscptr *Descriptor) segmentationDescriptor(bd *bitDecoder, tag uint8, leng fmt.Println("Seg Desc Length: ", dscptr.Length) dscptr.Identifier = bd.asAscii(32) if dscptr.Identifier != "0x43554549" { - log.Fatal("Segmentation Descriptor Identifies is not 0x43554549") + log.Fatal("Segmentation Descriptor Identifies is not 0x43554549 but is ", dscptr.Identifier) } dscptr.Name = "Segmentation Descriptor" dscptr.SegmentationEventID = bd.asHex(32) From 484c1ac5e411816b4e8b0b9310e4ca4d16d3ab1c Mon Sep 17 00:00:00 2001 From: enricovittorini Date: Mon, 14 Aug 2023 17:41:00 +0200 Subject: [PATCH 6/7] fix --- descriptors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descriptors.go b/descriptors.go index a044647..9aa59b7 100644 --- a/descriptors.go +++ b/descriptors.go @@ -155,7 +155,7 @@ func (dscptr *Descriptor) segmentationDescriptor(bd *bitDecoder, tag uint8, leng dscptr.Length = length fmt.Println("Seg Desc Length: ", dscptr.Length) dscptr.Identifier = bd.asAscii(32) - if dscptr.Identifier != "0x43554549" { + if dscptr.Identifier != "CUEI" { log.Fatal("Segmentation Descriptor Identifies is not 0x43554549 but is ", dscptr.Identifier) } dscptr.Name = "Segmentation Descriptor" From 285e66475b2846842ec99dc730b3aebd9e823032 Mon Sep 17 00:00:00 2001 From: enricovittorini Date: Mon, 14 Aug 2023 18:04:19 +0200 Subject: [PATCH 7/7] clean comment --- descriptors.go | 1 - 1 file changed, 1 deletion(-) diff --git a/descriptors.go b/descriptors.go index 9aa59b7..354aaff 100644 --- a/descriptors.go +++ b/descriptors.go @@ -153,7 +153,6 @@ func (dscptr *Descriptor) timeDescriptor(bd *bitDecoder, tag uint8, length uint8 func (dscptr *Descriptor) segmentationDescriptor(bd *bitDecoder, tag uint8, length uint8) { dscptr.Tag = tag dscptr.Length = length - fmt.Println("Seg Desc Length: ", dscptr.Length) dscptr.Identifier = bd.asAscii(32) if dscptr.Identifier != "CUEI" { log.Fatal("Segmentation Descriptor Identifies is not 0x43554549 but is ", dscptr.Identifier)