You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 6, 2026. It is now read-only.
return [HCACodec(s[2], s[1], key=hca_keyorself.usm_key, subkey=hca_subkey) forsinself.streamsifs[0] ==USMChunckHeaderType.SFA.value] # HCAs are never encrypted in USM
550
+
return [HCACodec(s[2], s[1], key=hca_keyifhca_key!=-1elseself.usm_key, subkey=hca_subkey) forsinself.streamsifs[0] ==USMChunckHeaderType.SFA.value] # HCAs are never encrypted in USM
523
551
case _:
524
552
return []
525
553
@@ -530,23 +558,23 @@ class USMBuilder(USMCrypt):
530
558
531
559
key: int=None
532
560
encrypt: bool=False
533
-
encrypt_audio: bool=False
534
561
535
562
def__init__(
536
563
self,
537
-
key=None,
538
-
encrypt_audio=False
564
+
key=None
539
565
) ->None:
540
566
"""Initialize the USMBuilder from set source files.
541
567
542
568
Args:
543
-
key (str | int, optional): The encryption key. Either int64 or a hex string. Defaults to None.
544
-
encrypt_audio (bool, optional): Whether to also encrypt the audio. Defaults to False.
569
+
key (str | int, optional): The USM encryption key. Either int64 or a hex string. Defaults to None.
570
+
571
+
Note:
572
+
For USM with key set, HCA audio streams *usually* use the same key for encryption.
573
+
Thus when adding HCA audio streams, make sure your HCACodec is initialized with a key itself.
545
574
"""
546
575
ifkey:
547
576
self.init_key(key)
548
577
self.encrypt=True
549
-
self.encrypt_audio=encrypt_audio
550
578
self.audio_streams= []
551
579
552
580
defadd_video(self, video : str|H264Codec|VP9Codec|MPEG1Codec):
@@ -624,6 +652,15 @@ def chunk_key_sort(chunk):
624
652
self.usm+=chunks
625
653
returnself.usm
626
654
655
+
defsave(self, filepath: str) ->None:
656
+
"""Saves the built USM to a file.
657
+
658
+
Args:
659
+
filepath (str): The path to save the USM file to.
660
+
"""
661
+
withopen(filepath, "wb") asf:
662
+
f.write(self.build())
663
+
627
664
def_build_header(
628
665
self, SFV_list: list, SFA_chunks: list, SBT_chunks: list# TODO: Not used
0 commit comments