|
|
|
@ -115,6 +115,9 @@ def vidindex(fn, typ): |
|
|
|
|
def cache_fn(func): |
|
|
|
|
@wraps(func) |
|
|
|
|
def cache_inner(fn, *args, **kwargs): |
|
|
|
|
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) |
|
|
|
|
|
|
|
|
@ -543,11 +546,12 @@ 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): |
|
|
|
|
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) |
|
|
|
|