Only use SegmentBase's timescale as FPS if exists

Also optimised it to not require FPS.parse, as the Video class will run it under FPS.parse anyway.
This commit is contained in:
rlaphoenix 2023-02-08 12:29:57 +00:00
parent 3f22c969c3
commit 23153f0078
1 changed files with 8 additions and 6 deletions

View File

@ -1,12 +1,11 @@
from __future__ import annotations from __future__ import annotations
import base64 import base64
from hashlib import md5
import math import math
import re import re
from copy import copy from copy import copy
from typing import Any, Optional, Union, Callable from hashlib import md5
from typing import Any, Callable, Optional, Union
from urllib.parse import urljoin, urlparse from urllib.parse import urljoin, urlparse
from uuid import UUID from uuid import UUID
@ -17,8 +16,8 @@ from pywidevine.pssh import PSSH
from requests import Session from requests import Session
from devine.core.drm import Widevine from devine.core.drm import Widevine
from devine.core.tracks import Tracks, Video, Audio, Subtitle from devine.core.tracks import Audio, Subtitle, Tracks, Video
from devine.core.utilities import is_close_match, FPS from devine.core.utilities import is_close_match
from devine.core.utils.xml import load_xml from devine.core.utils.xml import load_xml
@ -248,7 +247,10 @@ class DASH:
fps=( fps=(
rep.get("frameRate") or rep.get("frameRate") or
adaptation_set.get("frameRate") or adaptation_set.get("frameRate") or
FPS.parse(rep.find("SegmentBase").get("timescale")) (
rep.find("SegmentBase").get("timescale") if
rep.find("SegmentBase") else None
)
), ),
drm=drm drm=drm
) if track_type is Video else dict( ) if track_type is Video else dict(