mirror of
				https://github.com/devine-dl/pywidevine.git
				synced 2025-11-04 03:44:50 +00:00 
			
		
		
		
	PSSH: Add support for Key IDs of lengths other than 16 bytes
This is required for cases like Google's testing DASH manifests, e.g., 'tears' MPD. It assumes the Key ID as a number, which can support up to 16 bytes in this fashion (therefore technically 15 in our scenario as 16 byte Key_IDs can load normally). Fixes #13
This commit is contained in:
		
							parent
							
								
									c5c620ea84
								
							
						
					
					
						commit
						e90371922c
					
				@ -199,7 +199,11 @@ class PSSH:
 | 
				
			|||||||
            cenc_header.ParseFromString(self.init_data)
 | 
					            cenc_header.ParseFromString(self.init_data)
 | 
				
			||||||
            return [
 | 
					            return [
 | 
				
			||||||
                # the key_ids value may or may not be hex underlying
 | 
					                # the key_ids value may or may not be hex underlying
 | 
				
			||||||
                UUID(bytes=key_id) if len(key_id) == 16 else UUID(hex=key_id.decode())
 | 
					                (
 | 
				
			||||||
 | 
					                    UUID(bytes=key_id) if len(key_id) == 16 else  # normal
 | 
				
			||||||
 | 
					                    UUID(hex=key_id.decode()) if len(key_id) == 32 else  # stored as hex
 | 
				
			||||||
 | 
					                    UUID(int=int.from_bytes(key_id, "big"))  # assuming as number
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
                for key_id in cenc_header.key_ids
 | 
					                for key_id in cenc_header.key_ids
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user