Fixing type error.
This commit is contained in:
@@ -307,15 +307,15 @@ def get_avc_config_from_h264(input_file: IO[bytes]) -> AVCDecoderConfiguration:
|
||||
return avcconfig
|
||||
|
||||
# Unused ?
|
||||
@typechecked
|
||||
def get_codec_private_data_from_h264(input_file: IO[bytes]) -> AVCDecoderConfiguration:
|
||||
avcconfig = get_avc_config_from_h264(input_file)
|
||||
res = dump_codec_private_data(avcconfig)
|
||||
|
||||
return res
|
||||
# @typechecked
|
||||
# def get_codec_private_data_from_h264(input_file: IO[bytes]) -> AVCDecoderConfiguration:
|
||||
# avcconfig = get_avc_config_from_h264(input_file)
|
||||
# res = dump_codec_private_data(avcconfig)
|
||||
#
|
||||
# return res
|
||||
|
||||
@typechecked
|
||||
def dump_codec_private_data(avc_decoder_configuration: AVCDecoderConfiguration) -> bytearray:
|
||||
def dump_codec_private_data(avc_decoder_configuration: AVCDecoderConfiguration) -> bytearray | None:
|
||||
# Rebuild a Matroska Codec Private Element
|
||||
res = bytearray()
|
||||
# Code private element
|
||||
@@ -325,6 +325,8 @@ def dump_codec_private_data(avc_decoder_configuration: AVCDecoderConfiguration)
|
||||
len(buf))
|
||||
|
||||
embl_length = get_ebml_length(len(buf))
|
||||
if embl_length is None:
|
||||
return None
|
||||
logger.debug('EMBL encoded length: %s', hexdump.dump(embl_length, sep=':'))
|
||||
res.extend(embl_length)
|
||||
res.extend(buf)
|
||||
|
||||
@@ -130,6 +130,8 @@ def change_ebml_element_size(input_file: IO[bytes], position:int, addendum:int)
|
||||
if new_size > max_size:
|
||||
# TODO: Test this code ...
|
||||
new_encoded_size = get_ebml_length(new_size)
|
||||
if new_encoded_size is None:
|
||||
raise ValueError()
|
||||
size_of_new_encoded_size = len(new_encoded_size)
|
||||
if size_of_new_encoded_size <= size_of_data_size:
|
||||
logger.error('New encoded size is smaller (%d) or equal than previous size (%d).\
|
||||
|
||||
Reference in New Issue
Block a user