stream.dash: refactor parser and use base classes#5248
Merged
gravyboat merged 3 commits intoMar 16, 2023
Conversation
Refactor `walk_back()`: - compare ancestor nodes by type and not by tag name - rename mapper parameter and check its result before yielding the node Refactor `walk_back_get_attr()`: - allow finding attributes from specific ancestor nodes only - stop iterating after the first match Refactor `attr(inherited=...)`: - allow inheriting from ancestor nodes, optionally from a specific type, and not just the parent node
- Make `AdaptationSet` and `Representation` inherit from the common
`_RepresentationBaseType` class
- Move and logically group class definitions
- Define common attributes in `_RepresentationBaseType` that get
inherited from ancestor nodes of the same base type, and find
common child nodes
- Fix, clean up, reorder and selectively add attributes
- Remove `Representation.numChannels` (invalid and unused)
- Turn `Representation.lang` into a property which reads its value
from the parent `AdaptationSet.lang`
(it's not an attribute on `Representation` according to the spec,
but it gets read by `DASHStream.parse_manifest`, so keep the alias)
- Rename `contentProtection` attribute to `contentProtections`
and `subRepresentation` to `subRepresentations`, to stay consistent
with other attributes of child node lists
- Fix tests with old assertions: non-inhertied attributes that led to
different expectations (e.g. the resulting stream name)
- Make `SegmentBase`, `SegmentList` and `SegmentTemplate` inherit from
the common `_SegmentBaseType` and `_MultipleSegmentBaseType` classes
- Logically move class definitions
- Define common attributes in `_{,Multiple}SegmentBaseType`
that get inherited from nodes of the same type in ancestor nodes,
and find common child nodes
- Find inherited attributes independently
- Fix, clean up, reorder and selectively add attributes
- Add `_SegmentBaseType.availabilityTimeOffset` (currently unused)
- Fix `MPD.minBufferTime` type (required attribute which can't be None)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up of #5247 / 456dd53