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