pull/347/head
Mike Lang 1 year ago
parent c0e5f32459
commit 3ea0532838

@ -749,3 +749,20 @@ def extract_frame(segments, timestamp):
action() action()
except (OSError, IOError): except (OSError, IOError):
pass pass
def split_contiguous(segments):
"""For a list of segments, return a list of contiguous ranges of segments.
In other words, it splits the list every time there is a hole.
Each range will contain at least one segment.
"""
contiguous = []
for segment in segments:
if segment is None:
if contiguous:
yield contiguous
contiguous = []
else:
contiguous.append(segment)
if contiguous:
yield contiguous

@ -406,6 +406,13 @@ class Cutter(object):
"smart": smart_cut_segments, "smart": smart_cut_segments,
}[upload_backend.encoding_settings] }[upload_backend.encoding_settings]
cut = cut_fn(job.segment_ranges, job.video_ranges) cut = cut_fn(job.segment_ranges, job.video_ranges)
elif upload_backend.encoding_settings in ("rough", "split"):
# A rough cut copies the segments byte-for-byte with no processing.
# A split cut is a rough cut where the video is split into contiguous ranges
# seperated by discontinuities. We communicate these discontinuities to the uploader
# by inserting a None into the stream of chunks. It is expected a split-cut-capable upload
# location will detect these Nones and do some special behaviour (eg. making a seperate video).
else: else:
self.logger.debug("Using encoding settings for {} cut: {}".format( self.logger.debug("Using encoding settings for {} cut: {}".format(
"streamable" if upload_backend.encoding_streamable else "non-streamable", "streamable" if upload_backend.encoding_streamable else "non-streamable",

Loading…
Cancel
Save