code: def compute_segments(
      name: str,
      src_duration: float,
      dst_duration: float,
      metadata: List[Dict[str, Any]],
      **kwargs,
  ) -> Tuple[List[Segment], List[Segment]]:
      """
      Compute matching pairs of src_segment -> dst_segment, given the kwargs of the
      transform, as well as the metadata about previously applied transforms.
      """
      speed_factor = 1.0
      src_id = kwargs.get("src_id", None)
      if not metadata:
          src_segments = [Segment(0.0, src_duration, src_id)]
          dst_segments = [Segment(0.0, src_duration)]
      else:
          src_segments = [
              Segment(
                  segment_dict["start"],
                  segment_dict["end"],
                  segment_dict.get("src_id"),
              )
              for segment_dict in metadata[-1]["src_segments"]
          ]
          dst_segments = [
              Segment(segment_dict["start"], segment_dict["end"])
              for segment_dict in metadata[-1]["dst_segments"]
          ]
          for meta in metadata:
              if meta["name"] in ["change_video_speed"]:
                  speed_factor *= meta["factor"]
  
      if name in [
          "insert_in_background",
          "insert_in_background_multiple",
          "replace_with_background",
          "change_video_speed",
          "loop",
          "time_crop",
          "time_decimate",
          "trim",
          "replace_with_color_frames",
          "concat",
      ]:
          return compute_changed_segments(
              name,
              src_segments,
              dst_segments,
              src_duration,
              dst_duration,
              speed_factor,
              **kwargs,
          )
      else:
          return src_segments, dst_segments
  
file_path: AugLy/augly/video/helpers/metadata.py
imports: from copy import deepcopy
  from typing import Any, Dict, List, Optional, Tuple
  from augly import utils
  from augly.video import helpers
  from augly.video.helpers import intensity
label_desc: Use image node_id 7 for calling a global function with example usage: compute_segments(name, src_duration, dst_duration, metadata) and returns: compute_changed_segments, src_segments,  dst_segments