docs: def read_metadata(self, f, objects, previous_segment=None):
          """Read segment metadata section and update object information"""
  
          if not self.toc["kTocMetaData"]:
              try:
                  self.ordered_objects = previous_segment.ordered_objects
              except AttributeError:
                  raise ValueError(
                      "kTocMetaData is not set for segment but "
                      "there is no previous segment")
              self.calculate_chunks()
              return
          if not self.toc["kTocNewObjList"]:
              # In this case, there can be a list of new objects that
              # are appended, or previous objects can also be repeated
              # if their properties change
              self.ordered_objects = [
                  copy(o) for o in previous_segment.ordered_objects]
  
          log.debug("Reading metadata at %d", f.tell())
  
          # First four bytes have number of objects in metadata
          num_objects = types.Int32.read(f, self.endianness)
  
          for obj in range(num_objects):
              # Read the object path
              object_path = types.String.read(f, self.endianness)
  
              # If this is a new segment for an existing object,
              # reuse the existing object, otherwise,
              # create a new object and add it to the object dictionary
              if object_path in objects:
                  obj = objects[object_path]
              else:
                  obj = TdmsObject(object_path, self.tdms_file)
                  objects[object_path] = obj
  
              # Add this segment object to the list of segment objects,
              # re-using any properties from previous segments.
              updating_existing = False
              if not self.toc["kTocNewObjList"]:
                  # Search for the same object from the previous segment
                  # object list.
                  obj_index = [
                      i for i, o in enumerate(self.ordered_objects)
                      if o.tdms_object is obj]
                  if len(obj_index) > 0:
                      updating_existing = True
                      log.debug("Updating object in segment list")
                      obj_index = obj_index[0]
                      segment_obj = self.ordered_objects[obj_index]
              if not updating_existing:
                  if obj._previous_segment_object is not None:
                      log.debug("Copying previous segment object")
                      segment_obj = copy(obj._previous_segment_object)
                  else:
                      log.debug("Creating a new segment object")
                      segment_obj = _TdmsSegmentObject(obj, self.endianness)
                  self.ordered_objects.append(segment_obj)
              # Read the metadata for this object, updating any
              # data structure information and properties.
              segment_obj._read_metadata(f)
              obj._previous_segment_object = segment_obj
  
          self.calculate_chunks()