opentimelineio.adapters.fcp_xml

OpenTimelineIO Final Cut Pro 7 XML Adapter.

class opentimelineio.adapters.fcp_xml.FCP7XMLParser(element_tree)

Implements parsing of an FCP XML file into an OTIO timeline.

Parsing FCP XML elements include two concepts that require carrying state:
  1. Inheritance

  2. The id Attribute

Inheritance is implemented using a _Context object that is pushed down through layers of parsing. A given parsing method is passed the element to parse into an otio object along with the context that element exists under (e.x. a track element parsing method is given the track element and the sequence context for that track).

The id attribute dereferencing is handled through a lookup table stored on parser instances and using the _derefed_ methods to take an element and find dereference elements.

Constructor, must be init with an xml etree.

clip_for_element(clipitem_element, item_range, start_offset, context)

Given a clipitem xml element, returns an :class: schema.Clip.

Parameters
  • clipitem_element – The element to create a clip for.

  • item_range – The time range in the timeline the clip occupies.

  • start_offset – The amount by which the in time of the clip source should be advanced (usually due to a transition).

  • context – The parent context for the clip.

Returns

The :class: schema.Clip instance.

effect_from_filter_element(filter_element)

Given a filter element, creates an :class: schema.Effect.

Parameters

filter_element – The filter element containing the effect.

Returns

The effect instance.

item_and_timing_for_element(item_element, head_transition, tail_transition, context)

Given a track item, returns a tuple with the appropriate OpenTimelineIO schema item as the first element and an :class: opentime.TimeRange of the resolved timeline range the clip occupies.

Parameters
  • item_element – The track item XML node.

  • head_transition – The xml element for the transition immediately before or None.

  • tail_transition – The xml element for the transition immediately after or None.

  • context – The context dictionary.

Returns

An :class: core.Item subclass instance and :class: opentime.TimeRange for the item.

media_reference_for_effect_element(effect_element)

Given an effect element, returns a generator reference.

Parameters

effect_element – The effect for the generator.

Returns

An :class: schema.GeneratorReference instance.

media_reference_for_file_element(file_element, context)

Given a file XML element, returns the :class`schema.ExternalReference`.

Parameters
  • file_element – The file xml element.

  • context – The parent context dictionary.

Returns

An :class: schema.ExternalReference.

stack_for_element(element, context)

Given an element, parses out track information as a stack.

Parameters
  • element – The element under which to find the tracks (typically a media element.

  • context – The current parser context.

Returns

A :class: schema.Stack of the tracks.

timeline_for_sequence(sequence_element, context)

Returns either an :class`schema.Timeline` parsed from a sequence element.

Parameters
  • sequence_element – The sequence element.

  • context – The context dictionary.

Returns

The appropriate OTIO object for the element.

top_level_sequences()

” Returns a list of timelines for the top-level sequences in the file.

track_for_element(track_element, track_kind, context)

Given a track element, constructs the OTIO track.

Parameters
  • track_element – The track XML element.

  • track_kind – The :class: schema.TrackKind for the track.

  • context – The context dict for this track.

transition_for_element(item_element, context)

Creates an OTIO transition for the provided transition element.

Parameters
  • item_element – The element to create a transition for.

  • context – The parent context for the element.

Returns

The :class: schema.Transition instance.

opentimelineio.adapters.fcp_xml.marker_for_element(marker_element, rate)

Creates an :class: schema.Marker for the provided element.

Parameters
  • marker_element – The XML element for the marker.

  • rate – The rate for the object the marker is attached to.

Returns

The :class: schema.Marker instance.

opentimelineio.adapters.fcp_xml.markers_from_element(element, context=None)

Given an element, returns the list of markers attached to it.

Parameters
  • element – An element with one or more marker child elements.

  • context – The context for this element.

Returns

A :class: list of :class: schema.Marker instances attached to the provided element.

opentimelineio.adapters.fcp_xml.read_from_string(input_str)
opentimelineio.adapters.fcp_xml.write_to_string(input_otio)