framereader index data as param

albatross
Greg Hogan 2020-05-07 18:23:19 -07:00
parent 28128cbbeb
commit 0b5758f1be
1 changed files with 8 additions and 4 deletions

View File

@ -115,8 +115,11 @@ def vidindex(fn, typ):
def cache_fn(func):
@wraps(func)
def cache_inner(fn, *args, **kwargs):
cache_prefix = kwargs.pop('cache_prefix', None)
cache_path = cache_path_for_file_path(fn, cache_prefix)
if kwargs.pop('no_cache', None):
cache_path = None
else:
cache_prefix = kwargs.pop('cache_prefix', None)
cache_path = cache_path_for_file_path(fn, cache_prefix)
if cache_path and os.path.exists(cache_path):
with open(cache_path, "rb") as cache_file:
@ -543,12 +546,13 @@ class BaseFrameReader(object):
def get(self, num, count=1, pix_fmt="yuv420p"):
raise NotImplementedError
def FrameReader(fn, cache_prefix=None, readahead=False, readbehind=False, multithreaded=True):
def FrameReader(fn, cache_prefix=None, readahead=False, readbehind=False, multithreaded=True, index_data=None):
frame_type = fingerprint_video(fn)
if frame_type == FrameType.raw:
return RawFrameReader(fn)
elif frame_type in (FrameType.h265_stream, FrameType.h264_pstream):
index_data = get_video_index(fn, frame_type, cache_prefix)
if not index_data:
index_data = get_video_index(fn, frame_type, cache_prefix)
if index_data is not None and "predecom" in index_data:
cache_path = cache_path_for_file_path(fn, cache_prefix)
return MKVFrameReader(