mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[extractor/common] Respect Width and Height attributes in ISM manifests
This commit is contained in:
parent
56f9c77f0e
commit
76d5a36391
1 changed files with 11 additions and 2 deletions
|
@ -2001,6 +2001,12 @@ def _extract_ism_formats(self, ism_url, video_id, ism_id=None, note=None, errnot
|
||||||
compat_etree_fromstring(ism.encode('utf-8')), urlh.geturl(), ism_id)
|
compat_etree_fromstring(ism.encode('utf-8')), urlh.geturl(), ism_id)
|
||||||
|
|
||||||
def _parse_ism_formats(self, ism_doc, ism_url, ism_id=None):
|
def _parse_ism_formats(self, ism_doc, ism_url, ism_id=None):
|
||||||
|
"""
|
||||||
|
Parse formats from ISM manifest.
|
||||||
|
References:
|
||||||
|
1. [MS-SSTR]: Smooth Streaming Protocol,
|
||||||
|
https://msdn.microsoft.com/en-us/library/ff469518.aspx
|
||||||
|
"""
|
||||||
if ism_doc.get('IsLive') == 'TRUE' or ism_doc.find('Protection') is not None:
|
if ism_doc.get('IsLive') == 'TRUE' or ism_doc.find('Protection') is not None:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@ -2022,8 +2028,11 @@ def _parse_ism_formats(self, ism_doc, ism_url, ism_id=None):
|
||||||
self.report_warning('%s is not a supported codec' % fourcc)
|
self.report_warning('%s is not a supported codec' % fourcc)
|
||||||
continue
|
continue
|
||||||
tbr = int(track.attrib['Bitrate']) // 1000
|
tbr = int(track.attrib['Bitrate']) // 1000
|
||||||
width = int_or_none(track.get('MaxWidth'))
|
# [1] does not mention Width and Height attributes. However,
|
||||||
height = int_or_none(track.get('MaxHeight'))
|
# they're often present while MaxWidth and MaxHeight are
|
||||||
|
# missing, so should be used as fallbacks
|
||||||
|
width = int_or_none(track.get('MaxWidth') or track.get('Width'))
|
||||||
|
height = int_or_none(track.get('MaxHeight') or track.get('Height'))
|
||||||
sampling_rate = int_or_none(track.get('SamplingRate'))
|
sampling_rate = int_or_none(track.get('SamplingRate'))
|
||||||
|
|
||||||
track_url_pattern = re.sub(r'{[Bb]itrate}', track.attrib['Bitrate'], url_pattern)
|
track_url_pattern = re.sub(r'{[Bb]itrate}', track.attrib['Bitrate'], url_pattern)
|
||||||
|
|
Loading…
Reference in a new issue