Skip to content
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

Support Sidx and Styp #18

Closed
wants to merge 3 commits into from
Closed

Support Sidx and Styp #18

wants to merge 3 commits into from

Conversation

zhoub
Copy link

@zhoub zhoub commented Jul 25, 2020

@sunfish-shogi

Support box types styp and sidx used in MPEG-DASH

@zhoub zhoub changed the title Mpegdash Support Sidx and Styp Jul 25, 2020
ReferenceID uint32 `mp4:"size=32"`
TimeScale uint32 `mp4:"size=32"`
EarliestPresentationTime uint32 `mp4:"size=32"`
FirstOffset uint32 `mp4:"size=32"`
Copy link
Contributor

@sunfish-shogi sunfish-shogi Jul 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Sidx.Version don't equal to 0, Sidx.EarliestPresentationTime and Sidx.FirstOffset have 64 bits.

So could you use ver option as follows?

	EarliestPresentationTimeV0 uint32 `mp4:"size=32,ver=0"`
	FirstOffsetV0              uint32 `mp4:"size=32,ver=0"`
	EarliestPresentationTimeV1 uint64 `mp4:"size=64,nver=0"`
	FirstOffsetV1              uint64 `mp4:"size=64,nver=0"`

Copy link
Contributor

@sunfish-shogi sunfish-shogi Jul 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I was mistaken.
This PR accept only version 0 at line 8 (https://github.com/abema/go-mp4/pull/18/files#diff-6322880a133c5e374279625376187a10R8) , and is correct.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, If supporting both of version 0 and version 1, you can write as follows:

func init() {
	AddBoxDef(&Sidx{}, 0, 1)
}

       :
       :
	EarliestPresentationTimeV0 uint32 `mp4:"size=32,ver=0"`
	FirstOffsetV0              uint32 `mp4:"size=32,ver=0"`
	EarliestPresentationTimeV1 uint64 `mp4:"size=64,nver=0"`
	FirstOffsetV1              uint64 `mp4:"size=64,nver=0"`

References []struct {
TypeSize uint32 `mp4:"size=32"`
SubSegmentDuration uint32 `mp4:"size=32"`
SapStartsTypeDeltaTime uint32 `mp4:"size=32"`
Copy link
Contributor

@sunfish-shogi sunfish-shogi Jul 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference entity has defined in spec as follows:

      bit (1)           reference_type;
      unsigned int(31)  referenced_size;
      unsigned int(32)  subsegment_duration;
      bit(1)            starts_with_SAP;
      unsigned int(3)   SAP_type;
      unsigned int(28)  SAP_delta_time;

So, I think that this struct may be written like following code.

		ReferencedType bool           `mp4:"size=1"`
		ReferencedSize uint32         `mp4:"size=31"`
                SubsegmentDuration uint32     `mp4:"size=32"`
		StartsWithSAP bool            `mp4:"size=1"`
		SAPType uint8                 `mp4:"size=3"`
		SapStartsTypeDeltaTime uint32 `mp4:"size=28"`

Do you refer to older spec?

@sunfish-shogi
Copy link
Contributor

@zhoub
Thank you for your Pull Request!

I commented about sidx box.
And I would be grateful if you could move these codes to box_types.go like #15 and apply gofmt.

@sunfish-shogi
Copy link
Contributor

sunfish-shogi commented Jul 29, 2020

This PR is related to #13

@sunfish-shogi
Copy link
Contributor

I will take on this task in #35.

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

Successfully merging this pull request may close these issues.

2 participants