diff --git a/common/common/segments.py b/common/common/segments.py index dee609c..83712e1 100644 --- a/common/common/segments.py +++ b/common/common/segments.py @@ -749,3 +749,20 @@ def extract_frame(segments, timestamp): action() except (OSError, IOError): 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 diff --git a/cutter/cutter/main.py b/cutter/cutter/main.py index 1078e9f..5de70c3 100644 --- a/cutter/cutter/main.py +++ b/cutter/cutter/main.py @@ -406,6 +406,13 @@ class Cutter(object): "smart": smart_cut_segments, }[upload_backend.encoding_settings] 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: self.logger.debug("Using encoding settings for {} cut: {}".format( "streamable" if upload_backend.encoding_streamable else "non-streamable",