How to use the opentimelineio.core function in OpenTimelineIO

To help you get started, we’ve selected a few OpenTimelineIO examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PixarAnimationStudios / OpenTimelineIO / tests / test_composition.py View on Github external
def test_cons(self):
        it = otio.core.Item()
        co = otio.core.Composition(name="test", children=[it])
        self.assertEqual(co.name, "test")
        self.assertEqual(list(co), [it])
        self.assertEqual(co.composition_kind, "Composition")
github PixarAnimationStudios / OpenTimelineIO / opentimelineio / plugins / manifest.py View on Github external
plugin_name = plugin.name
            try:
                plugin_entry_point = plugin.load()
                try:
                    plugin_manifest = plugin_entry_point.plugin_manifest()
                except AttributeError:
                    if not pkg_resources.resource_exists(
                        plugin.module_name,
                        'plugin_manifest.json'
                    ):
                        raise
                    manifest_stream = pkg_resources.resource_stream(
                        plugin.module_name,
                        'plugin_manifest.json'
                    )
                    plugin_manifest = core.deserialize_json_from_string(
                        manifest_stream.read().decode('utf-8')
                    )
                    manifest_stream.close()

            except Exception:
                logging.exception(
                    "could not load plugin: {}".format(plugin_name)
                )
                continue

            result.adapters.extend(plugin_manifest.adapters)
            result.media_linkers.extend(plugin_manifest.media_linkers)
    else:
        # XXX: Should we print some kind of warning that pkg_resources isn't
        #        available?
        pass
github PixarAnimationStudios / OpenTimelineIO / opentimelineio / schema / effect.py View on Github external
@core.register_type
class LinearTimeWarp(TimeEffect):
    "A time warp that applies a linear scale across the entire clip"
    _serializable_label = "LinearTimeWarp.1"

    def __init__(self, name=None, time_scalar=1, metadata=None):
        Effect.__init__(
            self,
            name=name,
            effect_name="LinearTimeWarp",
            metadata=metadata
        )
        self.time_scalar = time_scalar

    time_scalar = core.serializable_field(
        "time_scalar",
        doc="Linear time scalar applied to clip.  "
        "2.0 = double speed, 0.5 = half speed."
    )


@core.register_type
class FreezeFrame(LinearTimeWarp):
    "Hold the first frame of the clip for the duration of the clip."
    _serializable_label = "FreezeFrame.1"

    def __init__(self, name=None, metadata=None):
        LinearTimeWarp.__init__(
            self,
            name=name,
            time_scalar=0,
github PixarAnimationStudios / OpenTimelineIO / opentimelineio / schema / gap.py View on Github external
# Unless required by applicable law or agreed to in writing, software
# distributed under the Apache License with the above modification is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the Apache License for the specific
# language governing permissions and limitations under the Apache License.
#

from .. import (
    core,
    opentime,
)

"""Gap Item - represents a transparent gap in content."""


@core.register_type
class Gap(core.Item):
    _serializable_label = "Gap.1"
    _class_path = "schema.Gap"

    def __init__(
        self,
        name=None,
        # note - only one of the following two arguments is accepted
        # if neither is provided, source_range will be set to an empty
        # TimeRange
        # Duration is provided as a convienence for creating a gap of a certain
        # length.  IE: Gap(duration=otio.opentime.RationalTime(300, 24))
        duration=None,
        source_range=None,
        effects=None,
        markers=None,
github PixarAnimationStudios / OpenTimelineIO / src / py-opentimelineio / opentimelineio / console / autogen_serialized_datamodel.py View on Github external
def _remap_to_python_modules(cl):
    """Find the module containing the python wrapped class, rather than the base
    C++ _otio modules.
    """

    # where the python wrapped classes live
    SEARCH_MODULES = [
        otio.schema,
        otio.opentime,
        otio.core,
    ]

    # the C++ modules
    IGNORE_MODS = set(
        [
            otio._otio,
            otio._opentime
        ]
    )

    for mod in SEARCH_MODULES:
        result = _search_mod_recursively(cl, mod, IGNORE_MODS)
        if result is not None:
            return result

    return inspect.getmodule(cl).__name__
github PixarAnimationStudios / OpenTimelineIO / opentimelineio / schema / external_reference.py View on Github external
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the Apache License for the specific
# language governing permissions and limitations under the Apache License.
#

"""
Implementation of the ExternalReference media reference schema.
"""

from .. import (
    core,
)


@core.register_type
class ExternalReference(core.MediaReference):
    """Reference to media via a url, for example "file:///var/tmp/foo.mov" """

    _serializable_label = "ExternalReference.1"
    _name = "ExternalReference"

    def __init__(
        self,
        target_url=None,
        available_range=None,
        metadata=None,
    ):
        core.MediaReference.__init__(
            self,
            available_range=available_range,
            metadata=metadata
        )
github PixarAnimationStudios / OpenTimelineIO / opentimelineio / schema / effect.py View on Github external
")".format(
                repr(self.name),
                repr(self.effect_name),
                repr(self.metadata),
            )
        )


@core.register_type
class TimeEffect(Effect):
    "Base Time Effect Class"
    _serializable_label = "TimeEffect.1"
    pass


@core.register_type
class LinearTimeWarp(TimeEffect):
    "A time warp that applies a linear scale across the entire clip"
    _serializable_label = "LinearTimeWarp.1"

    def __init__(self, name=None, time_scalar=1, metadata=None):
        Effect.__init__(
            self,
            name=name,
            effect_name="LinearTimeWarp",
            metadata=metadata
        )
        self.time_scalar = time_scalar

    time_scalar = core.serializable_field(
        "time_scalar",
        doc="Linear time scalar applied to clip.  "
github PixarAnimationStudios / OpenTimelineIO / opentimelineio / plugins / manifest.py View on Github external
def load_manifest():
    # build the manifest of adapters, starting with builtin adapters
    result = manifest_from_file(
        os.path.join(
            os.path.dirname(os.path.dirname(inspect.getsourcefile(core))),
            "adapters",
            "builtin_adapters.plugin_manifest.json"
        )
    )

    # layer contrib plugins after built in ones
    try:
        import opentimelineio_contrib as otio_c

        contrib_manifest = manifest_from_file(
            os.path.join(
                os.path.dirname(inspect.getsourcefile(otio_c)),
                "adapters",
                "contrib_adapters.plugin_manifest.json"
            )
        )