forked from DRMTalks/devine
Add new Track Event, OnSegmentDownloaded
Like OnDownloaded but called every time a DASH or HLS segment is downloaded. The path to the downloaded segment file is passed to the callable.
This commit is contained in:
parent
87779f4e7d
commit
cd194e3192
|
@ -565,6 +565,9 @@ class DASH:
|
||||||
segmented=True
|
segmented=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if callable(track.OnSegmentDownloaded):
|
||||||
|
track.OnSegmentDownloaded(out_path)
|
||||||
|
|
||||||
# fix audio decryption on ATVP by fixing the sample description index
|
# fix audio decryption on ATVP by fixing the sample description index
|
||||||
# TODO: Should this be done in the video data or the init data?
|
# TODO: Should this be done in the video data or the init data?
|
||||||
if isinstance(track, Audio):
|
if isinstance(track, Audio):
|
||||||
|
|
|
@ -484,6 +484,9 @@ class HLS:
|
||||||
segmented=True
|
segmented=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if callable(track.OnSegmentDownloaded):
|
||||||
|
track.OnSegmentDownloaded(out_path)
|
||||||
|
|
||||||
download_size = out_path.stat().st_size
|
download_size = out_path.stat().st_size
|
||||||
|
|
||||||
# fix audio decryption on ATVP by fixing the sample description index
|
# fix audio decryption on ATVP by fixing the sample description index
|
||||||
|
|
|
@ -55,6 +55,8 @@ class Track:
|
||||||
# TODO: Currently using OnFoo event naming, change to just segment_filter
|
# TODO: Currently using OnFoo event naming, change to just segment_filter
|
||||||
self.OnSegmentFilter: Optional[Callable] = None
|
self.OnSegmentFilter: Optional[Callable] = None
|
||||||
|
|
||||||
|
# Called after one of the Track's segments have downloaded
|
||||||
|
self.OnSegmentDownloaded: Optional[Callable[[Path], None]] = None
|
||||||
# Called after the Track has downloaded
|
# Called after the Track has downloaded
|
||||||
self.OnDownloaded: Optional[Callable] = None
|
self.OnDownloaded: Optional[Callable] = None
|
||||||
# Called after the Track or one of its segments have been decrypted
|
# Called after the Track or one of its segments have been decrypted
|
||||||
|
|
Loading…
Reference in New Issue