diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fb070512c..e5aae5a11f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,12 +109,6 @@ if(OTIO_SHARED_LIBS) else() message(STATUS "Building static libs") set(OTIO_SHARED_OR_STATIC_LIB "STATIC") - if (OTIO_PYTHON_INSTALL) - # If we're compiling for pybind, we can hide all our symbols, they'll only be called from pybind - # Note that this has no effect on Windows. - set(CMAKE_CXX_VISIBILITY_PRESET hidden) - set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) - endif() endif() # Set the SO version. The SO version must be incremented every time a change diff --git a/src/opentime/CMakeLists.txt b/src/opentime/CMakeLists.txt index e86d41119e..a274ef10e8 100644 --- a/src/opentime/CMakeLists.txt +++ b/src/opentime/CMakeLists.txt @@ -3,6 +3,7 @@ set(OPENTIME_HEADER_FILES errorStatus.h + export.h rationalTime.h stringPrintf.h timeRange.h @@ -25,13 +26,21 @@ target_include_directories( set_target_properties(opentime PROPERTIES DEBUG_POSTFIX "${OTIO_DEBUG_POSTFIX}" LIBRARY_OUTPUT_NAME "opentime" - POSITION_INDEPENDENT_CODE TRUE - WINDOWS_EXPORT_ALL_SYMBOLS true) + POSITION_INDEPENDENT_CODE TRUE) if(BUILD_SHARED_LIBS) set_target_properties(opentime PROPERTIES SOVERSION ${OTIO_SOVERSION} VERSION ${OTIO_VERSION}) + target_compile_definitions( + opentime + PUBLIC + OPENTIME_EXPORTS) +else() + target_compile_definitions( + opentime + PUBLIC + OPENTIME_STATIC) endif() if(APPLE) diff --git a/src/opentime/errorStatus.h b/src/opentime/errorStatus.h index a9db5c954d..5c7e6eace6 100644 --- a/src/opentime/errorStatus.h +++ b/src/opentime/errorStatus.h @@ -3,13 +3,14 @@ #pragma once +#include "opentime/export.h" #include "opentime/version.h" #include namespace opentime { namespace OPENTIME_VERSION { /// @brief This struct represents the return status of a function. -struct ErrorStatus +struct OPENTIME_API_TYPE ErrorStatus { /// @brief This enumeration represents the possible outcomes. enum Outcome @@ -47,7 +48,7 @@ struct ErrorStatus std::string details; ///! @brief Return a human readable string for the given outcome. - static std::string outcome_to_string(Outcome); + static OPENTIME_API std::string outcome_to_string(Outcome); }; ///! @brief Check whether the given ErrorStatus is an error. diff --git a/src/opentime/export.h b/src/opentime/export.h new file mode 100644 index 0000000000..a55cbb380e --- /dev/null +++ b/src/opentime/export.h @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Contributors to the OpenTimelineIO project + +#pragma once + +// For an explanation of how these export defines work, see: +// https://github.com/PixarAnimationStudios/OpenUSD/blob/dev/pxr/base/arch/export.h +#if defined(_WINDOWS) +# if defined(__GNUC__) && __GNUC__ >= 4 || defined(__clang__) +# define OPENTIMELINIO_EXPORT __attribute__((dllexport)) +# define OPENTIMELINIO_IMPORT __attribute__((dllimport)) +# define OPENTIMELINIO_HIDDEN +# define OPENTIMELINIO_EXPORT_TYPE +# else +# define OPENTIMELINIO_EXPORT __declspec(dllexport) +# define OPENTIMELINIO_IMPORT __declspec(dllimport) +# define OPENTIMELINIO_HIDDEN +# define OPENTIMELINIO_EXPORT_TYPE +# endif +#elif defined(__GNUC__) && __GNUC__ >= 4 || defined(__clang__) +# define OPENTIMELINIO_EXPORT __attribute__((visibility("default"))) +# define OPENTIMELINIO_IMPORT +# define OPENTIMELINIO_HIDDEN __attribute__((visibility("hidden"))) +# if defined(__clang__) +# define OPENTIMELINIO_EXPORT_TYPE __attribute__((type_visibility("default"))) +# else +# define OPENTIMELINIO_EXPORT_TYPE __attribute__((visibility("default"))) +# endif +#else +# define OPENTIMELINIO_EXPORT +# define OPENTIMELINIO_IMPORT +# define OPENTIMELINIO_HIDDEN +# define OPENTIMELINIO_EXPORT_TYPE +#endif +#define OPENTIMELINIO_EXPORT_TEMPLATE(type, ...) +#define OPENTIMELINIO_IMPORT_TEMPLATE(type, ...) \ + extern template type OPENTIMELINIO_IMPORT __VA_ARGS__ + +#if defined(OPENTIME_STATIC) +# define OPENTIME_API +# define OPENTIME_API_TYPE +# define OPENTIME_API_TEMPLATE_CLASS(...) +# define OPENTIME_API_TEMPLATE_STRUCT(...) +# define OPENTIME_LOCAL +#else +# if defined(OPENTIME_EXPORTS) +# define OPENTIME_API OPENTIMELINIO_EXPORT +# define OPENTIME_API_TYPE OPENTIMELINIO_EXPORT_TYPE +# define OPENTIME_API_TEMPLATE_CLASS(...) \ + OPENTIMELINIO_EXPORT_TEMPLATE(class, __VA_ARGS__) +# define OPENTIME_API_TEMPLATE_STRUCT(...) \ + OPENTIMELINIO_EXPORT_TEMPLATE(struct, __VA_ARGS__) +# else +# define OPENTIME_API OPENTIMELINIO_IMPORT +# define OPENTIME_API_TYPE OPENTIMELINIO_IMPORT_TYPE +# define OPENTIME_API_TEMPLATE_CLASS(...) \ + OPENTIMELINIO_IMPORT_TEMPLATE(class, __VA_ARGS__) +# define OPENTIME_API_TEMPLATE_STRUCT(...) \ + OPENTIMELINIO_IMPORT_TEMPLATE(struct, __VA_ARGS__) +# endif +# define OPENTIME_LOCAL OPENTIMELINIO_HIDDEN +#endif diff --git a/src/opentime/rationalTime.h b/src/opentime/rationalTime.h index 3d81779574..76a62c072d 100644 --- a/src/opentime/rationalTime.h +++ b/src/opentime/rationalTime.h @@ -13,7 +13,7 @@ namespace opentime { namespace OPENTIME_VERSION { /// @brief This enumeration provides options for drop frame timecode. -enum IsDropFrameRate : int +enum OPENTIME_API_TYPE IsDropFrameRate : int { InferFromRate = -1, ForceNo = 0, @@ -21,7 +21,7 @@ enum IsDropFrameRate : int }; /// @brief This class represents a measure of time defined by a value and rate. -class RationalTime +class OPENTIME_API_TYPE RationalTime { public: /// @brief Construct a new time with an optional value and rate. @@ -167,17 +167,17 @@ class RationalTime /// @brief Returns true is the rate is supported by SMPTE timecode. [[deprecated("Use is_smpte_timecode_rate() instead")]] - static bool is_valid_timecode_rate(double rate); + static OPENTIME_API bool is_valid_timecode_rate(double rate); /// @brief Returns true is the rate is supported by SMPTE timecode. - static bool is_smpte_timecode_rate(double rate); + static OPENTIME_API bool is_smpte_timecode_rate(double rate); /// @brief Returns the SMPTE timecode rate nearest to the given rate. [[deprecated("Use nearest_smpte_timecode_rate() instead")]] - static double nearest_valid_timecode_rate(double rate); + static OPENTIME_API double nearest_valid_timecode_rate(double rate); /// @brief Returns the SMPTE timecode rate nearest to the given rate. - static double nearest_smpte_timecode_rate(double rate); + static OPENTIME_API double nearest_smpte_timecode_rate(double rate); /// @brief Convert a frame number and rate into a time. static constexpr RationalTime @@ -204,7 +204,7 @@ class RationalTime /// @param timecode The timecode string. /// @param rate The timecode rate. /// @param error_status Optional error status. - static RationalTime from_timecode( + static OPENTIME_API RationalTime from_timecode( std::string const& timecode, double rate, ErrorStatus* error_status = nullptr); @@ -218,7 +218,7 @@ class RationalTime /// @param time_string The time string. /// @param rate The time rate. /// @param error_status Optional error status. - static RationalTime from_time_string( + static OPENTIME_API RationalTime from_time_string( std::string const& time_string, double rate, ErrorStatus* error_status = nullptr); @@ -243,7 +243,7 @@ class RationalTime /// @param rate The timecode rate. /// @param drop_frame Whether to use drop frame timecode. /// @param error_status Optional error status. - std::string to_timecode( + OPENTIME_API std::string to_timecode( double rate, IsDropFrameRate drop_frame, ErrorStatus* error_status = nullptr) const; @@ -259,7 +259,7 @@ class RationalTime /// @param rate The timecode rate. /// @param drop_frame Whether to use drop frame timecode. /// @param error_status Optional error status. - std::string to_nearest_timecode( + OPENTIME_API std::string to_nearest_timecode( double rate, IsDropFrameRate drop_frame, ErrorStatus* error_status = nullptr) const; @@ -278,7 +278,7 @@ class RationalTime /// Seconds may have up to microsecond precision. /// /// @return The time string, which may have a leading negative sign. - std::string to_time_string() const; + OPENTIME_API std::string to_time_string() const; /// @brief Add a time to this time. constexpr RationalTime const& operator+=(RationalTime other) noexcept diff --git a/src/opentime/timeRange.h b/src/opentime/timeRange.h index f670ca11ac..00067abc82 100644 --- a/src/opentime/timeRange.h +++ b/src/opentime/timeRange.h @@ -16,7 +16,7 @@ namespace opentime { namespace OPENTIME_VERSION { /// a resolution of half a frame at 192kHz. The value can be changed in the future if /// necessary, due to higher sampling rates or some other kind of numeric tolerance /// detected in the library. -constexpr double DEFAULT_EPSILON_s = 1.0 / (2 * 192000.0); +OPENTIME_API constexpr double DEFAULT_EPSILON_s = 1.0 / (2 * 192000.0); /// @brief This class represents a time range defined by a start time and duration. /// @@ -27,7 +27,7 @@ constexpr double DEFAULT_EPSILON_s = 1.0 / (2 * 192000.0); /// The duration on a TimeRange indicates a time range that is inclusive of the /// start time, and exclusive of the end time. All of the predicates are /// computed accordingly. -class TimeRange +class OPENTIME_API_TYPE TimeRange { public: /// @brief Construct a new time range with a zero start time and duration. diff --git a/src/opentime/timeTransform.h b/src/opentime/timeTransform.h index 0a424dae25..c1ce3a7635 100644 --- a/src/opentime/timeTransform.h +++ b/src/opentime/timeTransform.h @@ -11,7 +11,7 @@ namespace opentime { namespace OPENTIME_VERSION { /// @brief One-dimensional time transform. -class TimeTransform +class OPENTIME_API_TYPE TimeTransform { public: /// @brief Construct a new transform with an optional offset, scale, and rate. diff --git a/src/opentimelineio/CMakeLists.txt b/src/opentimelineio/CMakeLists.txt index 9c859e3bdf..7c62556167 100644 --- a/src/opentimelineio/CMakeLists.txt +++ b/src/opentimelineio/CMakeLists.txt @@ -12,6 +12,7 @@ set(OPENTIMELINEIO_HEADER_FILES algo/editAlgorithm.h effect.h errorStatus.h + export.h externalReference.h freezeFrame.h gap.h @@ -100,13 +101,21 @@ target_link_libraries(opentimelineio set_target_properties(opentimelineio PROPERTIES DEBUG_POSTFIX "${OTIO_DEBUG_POSTFIX}" LIBRARY_OUTPUT_NAME "opentimelineio" - POSITION_INDEPENDENT_CODE TRUE - WINDOWS_EXPORT_ALL_SYMBOLS true) + POSITION_INDEPENDENT_CODE TRUE) if(BUILD_SHARED_LIBS) set_target_properties(opentimelineio PROPERTIES SOVERSION ${OTIO_SOVERSION} VERSION ${OTIO_VERSION}) + target_compile_definitions( + opentimelineio + PUBLIC + OTIO_EXPORTS) +else() + target_compile_definitions( + opentimelineio + PUBLIC + OTIO_STATIC) endif() if(APPLE) diff --git a/src/opentimelineio/algo/editAlgorithm.h b/src/opentimelineio/algo/editAlgorithm.h index f973cb8f1b..39283e8107 100644 --- a/src/opentimelineio/algo/editAlgorithm.h +++ b/src/opentimelineio/algo/editAlgorithm.h @@ -38,7 +38,7 @@ enum class ReferencePoint // // If overwrite range starts and ends before A, a gap hole is filled with // fill_template. -void overwrite( +OTIO_API void overwrite( Item* item, Composition* composition, TimeRange const& range, @@ -62,7 +62,7 @@ void overwrite( // If A and B's length is L1 and C's length is L2, the end result is L1 + L2. // A is split. // -void insert( +OTIO_API void insert( Item* const item, Composition* composition, RationalTime const& time, @@ -88,7 +88,7 @@ void insert( // Fill now-"empty" time with gap or template // Unless item is meeting a Gap, then, existing Gap's duration will be augmented // -void trim( +OTIO_API void trim( Item* item, RationalTime const& delta_in, RationalTime const& delta_out, @@ -101,7 +101,7 @@ void trim( // ^ // composition = usually a track item. // time = time to slice at. -void slice( +OTIO_API void slice( Composition* composition, RationalTime const& time, bool const remove_transitions = true, @@ -119,7 +119,7 @@ void slice( // Do not affect item duration. // Do not affect surrounding items. // Clamp to available_range of media (if available) -void slip(Item* item, RationalTime const& delta); +OTIO_API void slip(Item* item, RationalTime const& delta); // // Slide an item start_time by + or -, adjusting the previous item's duration. @@ -133,7 +133,7 @@ void slip(Item* item, RationalTime const& delta); // // If item is the first clip, it does nothing. // -void slide(Item* item, RationalTime const& delta); +OTIO_API void slide(Item* item, RationalTime const& delta); // // Adjust a source_range without affecting any other items. @@ -146,7 +146,7 @@ void slide(Item* item, RationalTime const& delta); // will be adjusted by // delta_out = RationalTime that the item's // source_range().end_time_exclusive() will be adjusted by -void ripple( +OTIO_API void ripple( Item* item, RationalTime const& delta_in, RationalTime const& delta_out, @@ -168,7 +168,7 @@ void ripple( // will be adjusted by // delta_out = RationalTime that the item's // source_range().end_time_exclusive() will be adjusted by -void roll( +OTIO_API void roll( Item* item, RationalTime const& delta_in, RationalTime const& delta_out, @@ -186,7 +186,7 @@ void roll( // reference_point = For 4 point editing, the reference point dictates what // transform to use when running the fill. // -void fill( +OTIO_API void fill( Item* item, Composition* track, RationalTime const& track_time, @@ -207,7 +207,7 @@ void fill( // // if fill is not set, A and B become concatenated, with no fill. // -void remove( +OTIO_API void remove( Composition* composition, RationalTime const& time, bool const fill = true, diff --git a/src/opentimelineio/anyDictionary.h b/src/opentimelineio/anyDictionary.h index 4508e90f9b..4fd05d1035 100644 --- a/src/opentimelineio/anyDictionary.h +++ b/src/opentimelineio/anyDictionary.h @@ -3,6 +3,7 @@ #pragma once +#include "opentimelineio/export.h" #include "opentimelineio/version.h" #include @@ -24,7 +25,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// This allows us to hand out iterators that can be aware of mutation and moves /// and take steps to safe-guard themselves from causing a crash. (Yes, I'm /// talking to you, Python...) -class AnyDictionary : private std::map +class OTIO_API_TYPE AnyDictionary : private std::map { public: using map::map; diff --git a/src/opentimelineio/anyVector.h b/src/opentimelineio/anyVector.h index 6cdd72534e..21c6208a20 100644 --- a/src/opentimelineio/anyVector.h +++ b/src/opentimelineio/anyVector.h @@ -3,6 +3,7 @@ #pragma once +#include "opentimelineio/export.h" #include "opentimelineio/version.h" #include @@ -20,7 +21,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// /// This allows us to hand out iterators that can be aware of moves /// and take steps to safe-guard themselves from causing a crash. -class AnyVector : private std::vector +class OTIO_API_TYPE AnyVector : private std::vector { public: using vector::vector; diff --git a/src/opentimelineio/clip.h b/src/opentimelineio/clip.h index d148569c0b..e9371ad0cd 100644 --- a/src/opentimelineio/clip.h +++ b/src/opentimelineio/clip.h @@ -12,7 +12,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// @brief A clip is a segment of editable media (usually audio or video). /// /// Contains a MediaReference and a trim on that media reference. -class Clip : public Item +class OTIO_API_TYPE Clip : public Item { public: /// @brief The default media within a clip. @@ -39,7 +39,7 @@ class Clip : public Item /// @param markers The list of markers for the clip. Note that the /// the clip keeps a retainer to each marker. /// @param active_media_reference_key The active media reference. - Clip( + OTIO_API Clip( std::string const& name = std::string(), MediaReference* media_reference = nullptr, std::optional const& source_range = std::nullopt, @@ -54,37 +54,37 @@ class Clip : public Item /// @brief Set the media reference. Note that the Clip keeps a Retainer to /// the media reference. - void set_media_reference(MediaReference* media_reference); + OTIO_API void set_media_reference(MediaReference* media_reference); /// @brief Return the media reference. - MediaReference* media_reference() const noexcept; + OTIO_API MediaReference* media_reference() const noexcept; using MediaReferences = std::map; /// @brief Return the list of media references. - MediaReferences media_references() const noexcept; + OTIO_API MediaReferences media_references() const noexcept; /// @brief Set the list of media references. Note that the Clip keeps a /// Retainer to each media reference. - void set_media_references( + OTIO_API void set_media_references( MediaReferences const& media_references, std::string const& new_active_key, ErrorStatus* error_status = nullptr) noexcept; /// @brief Return the active media reference. - std::string active_media_reference_key() const noexcept; + OTIO_API std::string active_media_reference_key() const noexcept; /// @brief Set the active media reference. - void set_active_media_reference_key( + OTIO_API void set_active_media_reference_key( std::string const& new_active_key, ErrorStatus* error_status = nullptr) noexcept; ///@} - TimeRange + OTIO_API TimeRange available_range(ErrorStatus* error_status = nullptr) const override; - std::optional + OTIO_API std::optional available_image_bounds(ErrorStatus* error_status = nullptr) const override; protected: diff --git a/src/opentimelineio/color.h b/src/opentimelineio/color.h index 1d3018b5c6..a82c3ebb44 100644 --- a/src/opentimelineio/color.h +++ b/src/opentimelineio/color.h @@ -6,6 +6,7 @@ #include #include +#include "opentimelineio/export.h" #include "opentimelineio/version.h" namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { @@ -21,7 +22,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// Round-trip conversions may not be guaranteed outside that. /// This class is meant for use in user interface elements, // like marker or clip coloring, NOT for image pixel content. -class Color +class OTIO_API_TYPE Color { public: struct Schema @@ -30,14 +31,14 @@ class Color static int constexpr version = 1; }; - Color( + OTIO_API Color( double const r = 1.f, double const g = 1.f, double const b = 1.f, double const a = 1.f, std::string const& name = ""); - Color(Color const& other); + OTIO_API Color(Color const& other); static const Color pink; static const Color red; @@ -63,10 +64,10 @@ class Color return lhs.to_hex() == rhs.to_hex() && lhs.to_agbr_integer() == rhs.to_agbr_integer(); } - std::string to_hex(); - std::vector to_rgba_int_list(int base); - unsigned int to_agbr_integer(); - std::vector to_rgba_float_list(); + OTIO_API std::string to_hex(); + OTIO_API std::vector to_rgba_int_list(int base); + OTIO_API unsigned int to_agbr_integer(); + OTIO_API std::vector to_rgba_float_list(); double r() const { return _r; } double g() const { return _g; } diff --git a/src/opentimelineio/composable.h b/src/opentimelineio/composable.h index 13b3475947..9b8def093a 100644 --- a/src/opentimelineio/composable.h +++ b/src/opentimelineio/composable.h @@ -13,7 +13,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { class Composition; /// @brief An object that can be composed within a Composition (such as a Track or Stack). -class Composable : public SerializableObjectWithMetadata +class OTIO_API_TYPE Composable : public SerializableObjectWithMetadata { public: /// @brief This struct provides the Composable schema. @@ -29,7 +29,7 @@ class Composable : public SerializableObjectWithMetadata /// /// @param name The name of the composable. /// @param metadata The metadata for the clip. - Composable( + OTIO_API Composable( std::string const& name = std::string(), AnyDictionary const& metadata = AnyDictionary()); diff --git a/src/opentimelineio/composition.h b/src/opentimelineio/composition.h index 9c8828a745..25069e726b 100644 --- a/src/opentimelineio/composition.h +++ b/src/opentimelineio/composition.h @@ -14,7 +14,7 @@ class Clip; /// @brief Base class for an Item that contains Composables. /// /// Should be subclassed (for example by Track Stack), not used directly. -class Composition : public Item +class OTIO_API_TYPE Composition : public Item { public: /// @brief This struct provides the Composition schema. @@ -35,7 +35,7 @@ class Composition : public Item /// the composition keeps a retainer to each effect. /// @param markers The list of markers for the composition. Note that the /// the composition keeps a retainer to each marker. - Composition( + OTIO_API Composition( std::string const& name = std::string(), std::optional const& source_range = std::nullopt, AnyDictionary const& metadata = AnyDictionary(), @@ -53,29 +53,29 @@ class Composition : public Item } /// @brief Clear the children. - void clear_children(); + OTIO_API void clear_children(); /// @brief Set the list of children. Note that the composition keeps a /// retainer to each child. - bool set_children( + OTIO_API bool set_children( std::vector const& children, ErrorStatus* error_status = nullptr); /// @brief Insert a child. Note that the composition keeps a retainer to the child. - bool insert_child( + OTIO_API bool insert_child( int index, Composable* child, ErrorStatus* error_status = nullptr); /// @brief Set the child at the given index. Note that the composition keeps a /// retainer to the child. - bool set_child( + OTIO_API bool set_child( int index, Composable* child, ErrorStatus* error_status = nullptr); /// @brief Remove the child at the given index. - bool remove_child(int index, ErrorStatus* error_status = nullptr); + OTIO_API bool remove_child(int index, ErrorStatus* error_status = nullptr); /// @brief Append the child. Note that the composition keeps a retainer to /// the child. @@ -85,12 +85,12 @@ class Composition : public Item } /// @brief Return the index of the given child. - int index_of_child( + OTIO_API int index_of_child( Composable const* child, ErrorStatus* error_status = nullptr) const; /// @brief Return whether this is the parent of the given child. - bool is_parent_of(Composable const* other) const; + OTIO_API bool is_parent_of(Composable const* other) const; /// @brief Return the in and out handles of the given child. virtual std::pair, std::optional> @@ -111,23 +111,24 @@ class Composition : public Item /// @brief Return the range of the given child. /// /// @todo Leaving out reference_space argument for now. - TimeRange range_of_child( + OTIO_API TimeRange range_of_child( Composable const* child, ErrorStatus* error_status = nullptr) const; /// @brief Return the trimmed range of the given child. - std::optional trimmed_range_of_child( + OTIO_API std::optional trimmed_range_of_child( Composable const* child, ErrorStatus* error_status = nullptr) const; /// @brief Return the given range trimmed to this source range. - std::optional trim_child_range(TimeRange child_range) const; + OTIO_API std::optional + trim_child_range(TimeRange child_range) const; /// @brief Return whether this contains the given child. - bool has_child(Composable* child) const; + OTIO_API bool has_child(Composable* child) const; /// @brief Return whether this contains any child clips. - bool has_clips() const; + OTIO_API bool has_clips() const; /// @brief Return the range of all children. virtual std::map @@ -139,7 +140,7 @@ class Composition : public Item /// @param error_status The return status. /// @param shallow_search The search is recursive unless shallow_search is /// set to true. - Retainer child_at_time( + OTIO_API Retainer child_at_time( RationalTime const& search_time, ErrorStatus* error_status = nullptr, bool shallow_search = false) const; @@ -156,7 +157,7 @@ class Composition : public Item /// @param shallow_search The search is recursive unless shallow_search is /// set to true. template - std::vector> find_children( + OTIO_API std::vector> find_children( ErrorStatus* error_status = nullptr, std::optional search_range = std::nullopt, bool shallow_search = false) const; @@ -167,7 +168,7 @@ class Composition : public Item /// @param search_range An optional range to limit the search. /// @param shallow_search The search is recursive unless shallow_search is /// set to true. - std::vector> find_clips( + OTIO_API std::vector> find_clips( ErrorStatus* error_status = nullptr, std::optional const& search_range = std::nullopt, bool shallow_search = false) const; diff --git a/src/opentimelineio/deserialization.h b/src/opentimelineio/deserialization.h index 8c4b85fd9f..95859ec286 100644 --- a/src/opentimelineio/deserialization.h +++ b/src/opentimelineio/deserialization.h @@ -12,13 +12,13 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// @brief Deserialize JSON data from a string. -bool deserialize_json_from_string( +OTIO_API bool deserialize_json_from_string( std::string const& input, std::any* destination, ErrorStatus* error_status = nullptr); /// @brief Deserialize JSON data from a file. -bool deserialize_json_from_file( +OTIO_API bool deserialize_json_from_file( std::string const& file_name, std::any* destination, ErrorStatus* error_status = nullptr); diff --git a/src/opentimelineio/effect.h b/src/opentimelineio/effect.h index 8b442acbdc..27981942e7 100644 --- a/src/opentimelineio/effect.h +++ b/src/opentimelineio/effect.h @@ -9,7 +9,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// @brief An effect that can be applied to an item, such as an image or audio filter. -class Effect : public SerializableObjectWithMetadata +class OTIO_API_TYPE Effect : public SerializableObjectWithMetadata { public: /// @brief This struct provides the Effect schema. diff --git a/src/opentimelineio/errorStatus.h b/src/opentimelineio/errorStatus.h index eafff9e230..b9386c8e0d 100644 --- a/src/opentimelineio/errorStatus.h +++ b/src/opentimelineio/errorStatus.h @@ -3,6 +3,7 @@ #pragma once +#include "opentimelineio/export.h" #include "opentimelineio/version.h" #include @@ -11,7 +12,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { class SerializableObject; /// @brief This struct represents the return status of a function. -struct ErrorStatus +struct OTIO_API_TYPE ErrorStatus { /// @brief This enumeration represents the possible outcomes. enum Outcome @@ -92,18 +93,18 @@ struct ErrorStatus SerializableObject const* object_details; //! @brief Return a human readable string for the given outcome. - static std::string outcome_to_string(Outcome); + static OTIO_API std::string outcome_to_string(Outcome); }; /// @brief Check whether the given ErrorStatus is an error. -constexpr bool +OTIO_API constexpr bool is_error(const ErrorStatus& es) noexcept { return ErrorStatus::Outcome::OK != es.outcome; } /// @brief Check whether the given ErrorStatus* is non-null and an error. -constexpr bool +OTIO_API constexpr bool is_error(const ErrorStatus* es) noexcept { return es && ErrorStatus::Outcome::OK != es->outcome; diff --git a/src/opentimelineio/export.h b/src/opentimelineio/export.h new file mode 100644 index 0000000000..d2671d829d --- /dev/null +++ b/src/opentimelineio/export.h @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright Contributors to the OpenTimelineIO project + +#pragma once + +#include "opentime/export.h" + +#if defined(OTIO_STATIC) +# define OTIO_API +# define OTIO_API_TYPE +# define OTIO_API_TEMPLATE_CLASS(...) +# define OTIO_API_TEMPLATE_STRUCT(...) +# define OTIO_LOCAL +#else +# if defined(OTIO_EXPORTS) +# define OTIO_API OPENTIMELINIO_EXPORT +# define OTIO_API_TYPE OPENTIMELINIO_EXPORT_TYPE +# define OTIO_API_TEMPLATE_CLASS(...) \ + OPENTIMELINIO_EXPORT_TEMPLATE(class, __VA_ARGS__) +# define OTIO_API_TEMPLATE_STRUCT(...) \ + OPENTIMELINIO_EXPORT_TEMPLATE(struct, __VA_ARGS__) +# else +# define OTIO_API OPENTIMELINIO_IMPORT +# define OTIO_API_TYPE OPENTIMELINIO_IMPORT_TYPE +# define OTIO_API_TEMPLATE_CLASS(...) \ + OPENTIMELINIO_IMPORT_TEMPLATE(class, __VA_ARGS__) +# define OTIO_API_TEMPLATE_STRUCT(...) \ + OPENTIMELINIO_IMPORT_TEMPLATE(struct, __VA_ARGS__) +# endif +# define OTIO_LOCAL OPENTIMELINIO_HIDDEN +#endif diff --git a/src/opentimelineio/externalReference.h b/src/opentimelineio/externalReference.h index ac6fdebc7e..a04fd52852 100644 --- a/src/opentimelineio/externalReference.h +++ b/src/opentimelineio/externalReference.h @@ -9,7 +9,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// @brief A reference to a media file. -class ExternalReference final : public MediaReference +class OTIO_API_TYPE ExternalReference final : public MediaReference { public: /// @brief This struct provides the ExternalReference schema. @@ -27,7 +27,7 @@ class ExternalReference final : public MediaReference /// @param available_range The available range of the media. /// @param metadata The metadata for the media. /// @param available_image_bounds The spatial bounds of the media. - ExternalReference( + OTIO_API ExternalReference( std::string const& target_url = std::string(), std::optional const& available_range = std::nullopt, AnyDictionary const& metadata = AnyDictionary(), diff --git a/src/opentimelineio/freezeFrame.h b/src/opentimelineio/freezeFrame.h index 397eb15095..b7a31a3e6a 100644 --- a/src/opentimelineio/freezeFrame.h +++ b/src/opentimelineio/freezeFrame.h @@ -9,7 +9,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// @brief Hold the first frame of the clip for the duration of the clip. -class FreezeFrame : public LinearTimeWarp +class OTIO_API_TYPE FreezeFrame : public LinearTimeWarp { public: /// @brief This struct provides the FreezeFrame schema. diff --git a/src/opentimelineio/gap.h b/src/opentimelineio/gap.h index 149a759aa2..87e6e77e72 100644 --- a/src/opentimelineio/gap.h +++ b/src/opentimelineio/gap.h @@ -10,7 +10,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// @brief An empty item within a timeline. -class Gap : public Item +class OTIO_API_TYPE Gap : public Item { public: /// @brief This struct provides the Gap schema. @@ -31,6 +31,7 @@ class Gap : public Item /// @param markers The list of markers for the gap. Note that the /// the gap keeps a retainer to each marker. /// @param metadata The metadata for the gap. + OTIO_API Gap(TimeRange const& source_range = TimeRange(), std::string const& name = std::string(), std::vector const& effects = std::vector(), diff --git a/src/opentimelineio/generatorReference.h b/src/opentimelineio/generatorReference.h index 9a247cdfe6..c5eeabaddd 100644 --- a/src/opentimelineio/generatorReference.h +++ b/src/opentimelineio/generatorReference.h @@ -9,7 +9,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// @brief A reference to dynamically generated media. -class GeneratorReference final : public MediaReference +class OTIO_API_TYPE GeneratorReference final : public MediaReference { public: /// @brief This struct provides the GeneratorReference schema. diff --git a/src/opentimelineio/imageSequenceReference.h b/src/opentimelineio/imageSequenceReference.h index 7af3296e6c..c629ef2249 100644 --- a/src/opentimelineio/imageSequenceReference.h +++ b/src/opentimelineio/imageSequenceReference.h @@ -17,7 +17,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// * Name prefix: "image." /// * Name suffix: ".exr" /// * Frame number padded to six zeroes: "000100" -class ImageSequenceReference final : public MediaReference +class OTIO_API_TYPE ImageSequenceReference final : public MediaReference { public: /// @brief How to handle missing frames. diff --git a/src/opentimelineio/item.h b/src/opentimelineio/item.h index 6448bc6362..20e74f345c 100644 --- a/src/opentimelineio/item.h +++ b/src/opentimelineio/item.h @@ -15,7 +15,7 @@ class Effect; class Marker; /// @brief An item in the timeline. -class Item : public Composable +class OTIO_API_TYPE Item : public Composable { public: /// @brief This struct provides the Item schema. @@ -37,7 +37,7 @@ class Item : public Composable /// @param markers The list of markers for the item. Note that the /// the item keeps a retainer to each marker. /// @param enabled Whether the item is enabled. - Item( + OTIO_API Item( std::string const& name = std::string(), std::optional const& source_range = std::nullopt, AnyDictionary const& metadata = AnyDictionary(), @@ -98,23 +98,24 @@ class Item : public Composable } /// @brief Return the visible range of the item. - TimeRange visible_range(ErrorStatus* error_status = nullptr) const; + OTIO_API TimeRange visible_range(ErrorStatus* error_status = nullptr) const; /// @brief Return the trimmed range of the item in the parent's time. - std::optional + OTIO_API std::optional trimmed_range_in_parent(ErrorStatus* error_status = nullptr) const; /// @brief Return the range of the item in the parent's time. - TimeRange range_in_parent(ErrorStatus* error_status = nullptr) const; + OTIO_API TimeRange + range_in_parent(ErrorStatus* error_status = nullptr) const; /// @brief Return the time transformed to another item in the hierarchy. - RationalTime transformed_time( + OTIO_API RationalTime transformed_time( RationalTime time, Item const* to_item, ErrorStatus* error_status = nullptr) const; /// @brief Return the time range transformed to another item in the hierarchy. - TimeRange transformed_time_range( + OTIO_API TimeRange transformed_time_range( TimeRange time_range, Item const* to_item, ErrorStatus* error_status = nullptr) const; diff --git a/src/opentimelineio/linearTimeWarp.h b/src/opentimelineio/linearTimeWarp.h index df142a7567..12df1ca997 100644 --- a/src/opentimelineio/linearTimeWarp.h +++ b/src/opentimelineio/linearTimeWarp.h @@ -9,7 +9,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// @brief A time warp that applies a linear speed up or slow down across the entire clip. -class LinearTimeWarp : public TimeEffect +class OTIO_API_TYPE LinearTimeWarp : public TimeEffect { public: /// @brief This struct provides the LinearTimeWarp schema. @@ -27,7 +27,7 @@ class LinearTimeWarp : public TimeEffect /// @param effect_name The name of the time effect. /// @param time_scalar The amount to scale the time. /// @param metadata The metadata for the time effect. - LinearTimeWarp( + OTIO_API LinearTimeWarp( std::string const& name = std::string(), std::string const& effect_name = std::string(), double time_scalar = 1, diff --git a/src/opentimelineio/marker.h b/src/opentimelineio/marker.h index 23f10fc9ba..382a795c6f 100644 --- a/src/opentimelineio/marker.h +++ b/src/opentimelineio/marker.h @@ -13,7 +13,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// /// The marked range may have a zero duration. The marked range is in the /// owning item's time coordinate system. -class Marker : public SerializableObjectWithMetadata +class OTIO_API_TYPE Marker : public SerializableObjectWithMetadata { public: /// @brief This struct provides the base set of colors. @@ -48,7 +48,7 @@ class Marker : public SerializableObjectWithMetadata /// @param color The color associated with the marker. /// @param metadata The metadata for the marker. /// @param comment The text comment for the marker. - Marker( + OTIO_API Marker( std::string const& name = std::string(), TimeRange const& marked_range = TimeRange(), std::string const& color = Color::green, diff --git a/src/opentimelineio/mediaReference.h b/src/opentimelineio/mediaReference.h index 3787c26638..90fdfbac87 100644 --- a/src/opentimelineio/mediaReference.h +++ b/src/opentimelineio/mediaReference.h @@ -13,7 +13,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { using namespace opentime; /// @brief A reference to a piece of media, for example a movie on a clip. -class MediaReference : public SerializableObjectWithMetadata +class OTIO_API_TYPE MediaReference : public SerializableObjectWithMetadata { public: /// @brief This struct provides the MediaReference schema. @@ -31,7 +31,7 @@ class MediaReference : public SerializableObjectWithMetadata /// @param available_range The available range of the media reference. /// @param metadata The metadata for the media reference. /// @param available_image_bounds The spatial bounds of the media reference. - MediaReference( + OTIO_API MediaReference( std::string const& name = std::string(), std::optional const& available_range = std::nullopt, AnyDictionary const& metadata = AnyDictionary(), diff --git a/src/opentimelineio/missingReference.h b/src/opentimelineio/missingReference.h index 5f24786214..2f8c28dd78 100644 --- a/src/opentimelineio/missingReference.h +++ b/src/opentimelineio/missingReference.h @@ -12,7 +12,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// /// Note that a missing reference may have useful metadata, even if the /// location of the media is not known. -class MissingReference final : public MediaReference +class OTIO_API_TYPE MissingReference final : public MediaReference { public: /// @brief This struct provides the MissingReference schema. diff --git a/src/opentimelineio/serializableCollection.h b/src/opentimelineio/serializableCollection.h index 1d4e1f659f..71d8a104b4 100644 --- a/src/opentimelineio/serializableCollection.h +++ b/src/opentimelineio/serializableCollection.h @@ -22,7 +22,8 @@ class Clip; /// /// A SerializableCollection is useful for serializing multiple timelines, /// clips, or media references to a single file. -class SerializableCollection : public SerializableObjectWithMetadata +class OTIO_API_TYPE SerializableCollection + : public SerializableObjectWithMetadata { public: /// @brief This struct provides the SerializableCollection schema. @@ -40,7 +41,7 @@ class SerializableCollection : public SerializableObjectWithMetadata /// @param child The list of children in the collection. Note that the /// collection keeps a retainer to each child. /// @param metadata The metadata for the collection. - SerializableCollection( + OTIO_API SerializableCollection( std::string const& name = std::string(), std::vector children = std::vector(), @@ -59,24 +60,25 @@ class SerializableCollection : public SerializableObjectWithMetadata } /// @brief Set the list of children. - void set_children(std::vector const& children); + OTIO_API void + set_children(std::vector const& children); /// @brief Clear the children. - void clear_children(); + OTIO_API void clear_children(); /// @brief Insert a child at the given index. Note that the collection /// keeps a retainer to the child. - void insert_child(int index, SerializableObject* child); + OTIO_API void insert_child(int index, SerializableObject* child); /// @brief Set the child at the given index. Note that the collection /// keeps a retainer to the child. - bool set_child( + OTIO_API bool set_child( int index, SerializableObject* child, ErrorStatus* error_status = nullptr); /// @brief Remove the child at the given index. - bool remove_child(int index, ErrorStatus* error_status = nullptr); + OTIO_API bool remove_child(int index, ErrorStatus* error_status = nullptr); /// @brief Find child clips. /// @@ -84,7 +86,7 @@ class SerializableCollection : public SerializableObjectWithMetadata /// @param search_range An optional range to limit the search. /// @param shallow_search The search is recursive unless shallow_search is /// set to true. - std::vector> find_clips( + OTIO_API std::vector> find_clips( ErrorStatus* error_status = nullptr, std::optional const& search_range = std::nullopt, bool shallow_search = false) const; @@ -96,7 +98,7 @@ class SerializableCollection : public SerializableObjectWithMetadata /// @param shallow_search The search is recursive unless shallow_search is /// set to true. template - std::vector> find_children( + OTIO_API std::vector> find_children( ErrorStatus* error_status = nullptr, std::optional search_range = std::nullopt, bool shallow_search = false) const; diff --git a/src/opentimelineio/serializableObject.h b/src/opentimelineio/serializableObject.h index 44f1be8d2f..d670c9214c 100644 --- a/src/opentimelineio/serializableObject.h +++ b/src/opentimelineio/serializableObject.h @@ -25,7 +25,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { class CloningEncoder; /// @brief A serializable object. -class SerializableObject +class OTIO_API_TYPE SerializableObject { public: /// @brief This struct provides the SerializableObject schema. @@ -36,7 +36,7 @@ class SerializableObject }; /// @brief Create a new serializable object. - SerializableObject(); + OTIO_API SerializableObject(); /// @brief Delete a serializable object. /// @@ -47,7 +47,7 @@ class SerializableObject /// (and, recursively, the objects owned by this object), provided the objects /// are not under external management (e.g. prevented from being deleted because an /// external scripting system is holding a reference to them). - bool possibly_delete(); + OTIO_API bool possibly_delete(); /// @brief Serialize this object to a JSON file. /// @@ -55,7 +55,7 @@ class SerializableObject /// @param error_status The return status. /// @param target_family_label_spec @todo Add comment. /// @param indent The number of spaces to use for indentation. - bool to_json_file( + OTIO_API bool to_json_file( std::string const& file_name, ErrorStatus* error_status = nullptr, const schema_version_map* target_family_label_spec = nullptr, @@ -66,7 +66,7 @@ class SerializableObject /// @param error_status The return status. /// @param target_family_label_spec @todo Add comment. /// @param indent The number of spaces to use for indentation. - std::string to_json_string( + OTIO_API std::string to_json_string( ErrorStatus* error_status = nullptr, const schema_version_map* target_family_label_spec = nullptr, int indent = 4) const; @@ -75,7 +75,7 @@ class SerializableObject /// /// @param file_name The file name. /// @param error_status The return status. - static SerializableObject* from_json_file( + static OTIO_API SerializableObject* from_json_file( std::string const& file_name, ErrorStatus* error_status = nullptr); @@ -83,12 +83,12 @@ class SerializableObject /// /// @param input The input string. /// @param error_status The return status. - static SerializableObject* from_json_string( + static OTIO_API SerializableObject* from_json_string( std::string const& input, ErrorStatus* error_status = nullptr); /// @brief Return whether this object is equivalent to another. - bool is_equivalent_to(SerializableObject const& other) const; + OTIO_API bool is_equivalent_to(SerializableObject const& other) const; /// @brief Makes a (deep) clone of this instance. /// @@ -96,7 +96,8 @@ class SerializableObject /// /// If the operation fails, nullptr is returned and error_status /// is set appropriately. - SerializableObject* clone(ErrorStatus* error_status = nullptr) const; + OTIO_API SerializableObject* + clone(ErrorStatus* error_status = nullptr) const; /// @brief Allow external system (e.g. Python, Swift) to add serializable /// fields on the fly. @@ -684,8 +685,8 @@ class SerializableObject template friend struct Retainer; - void _managed_retain(); - void _managed_release(); + OTIO_API void _managed_retain(); + OTIO_API void _managed_release(); public: /// @brief This struct provides a reference ID. diff --git a/src/opentimelineio/serializableObjectWithMetadata.h b/src/opentimelineio/serializableObjectWithMetadata.h index df680d26b4..959db20fa6 100644 --- a/src/opentimelineio/serializableObjectWithMetadata.h +++ b/src/opentimelineio/serializableObjectWithMetadata.h @@ -9,7 +9,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// @brief A serializable object with metadata. -class SerializableObjectWithMetadata : public SerializableObject +class OTIO_API_TYPE SerializableObjectWithMetadata : public SerializableObject { public: /// @brief This struct provides the SerializableObjectWithMetadata schema. @@ -25,7 +25,7 @@ class SerializableObjectWithMetadata : public SerializableObject /// /// @param name The object name. /// @param metadata The metadata for the object. - SerializableObjectWithMetadata( + OTIO_API SerializableObjectWithMetadata( std::string const& name = std::string(), AnyDictionary const& metadata = AnyDictionary()); diff --git a/src/opentimelineio/serialization.h b/src/opentimelineio/serialization.h index ea43cf8ed0..af9258e262 100644 --- a/src/opentimelineio/serialization.h +++ b/src/opentimelineio/serialization.h @@ -14,14 +14,14 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// @brief Serialize JSON data to a string. -std::string serialize_json_to_string( +OTIO_API std::string serialize_json_to_string( const std::any& value, const schema_version_map* schema_version_targets = nullptr, ErrorStatus* error_status = nullptr, int indent = 4); /// @brief Serialize JSON data to a file. -bool serialize_json_to_file( +OTIO_API bool serialize_json_to_file( const std::any& value, std::string const& file_name, const schema_version_map* schema_version_targets = nullptr, diff --git a/src/opentimelineio/stack.h b/src/opentimelineio/stack.h index 03be0d23af..289d44843c 100644 --- a/src/opentimelineio/stack.h +++ b/src/opentimelineio/stack.h @@ -11,7 +11,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { class Clip; /// @brief A stack of items in a timeline, for example a stack of tracks in a timelime. -class Stack : public Composition +class OTIO_API_TYPE Stack : public Composition { public: /// @brief This struct provides the Stack schema. @@ -32,7 +32,7 @@ class Stack : public Composition /// the stack keeps a retainer to each effect. /// @param markers The list of markers for the stack. Note that the /// the stack keeps a retainer to each marker. - Stack( + OTIO_API Stack( std::string const& name = std::string(), std::optional const& source_range = std::nullopt, AnyDictionary const& metadata = AnyDictionary(), diff --git a/src/opentimelineio/stackAlgorithm.h b/src/opentimelineio/stackAlgorithm.h index 8800636109..8f37ec9a4b 100644 --- a/src/opentimelineio/stackAlgorithm.h +++ b/src/opentimelineio/stackAlgorithm.h @@ -10,10 +10,11 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// @brief Flatten a stack down to a single track. -Track* flatten_stack(Stack* in_stack, ErrorStatus* error_status = nullptr); +OTIO_API Track* +flatten_stack(Stack* in_stack, ErrorStatus* error_status = nullptr); /// @brief Flatten a list of tracks down to a single track. -Track* flatten_stack( +OTIO_API Track* flatten_stack( std::vector const& tracks, ErrorStatus* error_status = nullptr); diff --git a/src/opentimelineio/timeEffect.h b/src/opentimelineio/timeEffect.h index 515fd293f6..a8a920cf01 100644 --- a/src/opentimelineio/timeEffect.h +++ b/src/opentimelineio/timeEffect.h @@ -9,7 +9,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// @brief Base class for all effects that alter the timing of an item. -class TimeEffect : public Effect +class OTIO_API_TYPE TimeEffect : public Effect { public: /// @brief This struct provides the TimeEffect schema. diff --git a/src/opentimelineio/timeline.h b/src/opentimelineio/timeline.h index d18c629d83..7983137795 100644 --- a/src/opentimelineio/timeline.h +++ b/src/opentimelineio/timeline.h @@ -13,7 +13,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { class Clip; /// @brief A timeline contains a stack of tracks. -class Timeline : public SerializableObjectWithMetadata +class OTIO_API_TYPE Timeline : public SerializableObjectWithMetadata { public: /// @brief This struct provides the Timeline schema. @@ -30,7 +30,7 @@ class Timeline : public SerializableObjectWithMetadata /// @param name The timeline name. /// @param global_start_time The global start time of the timeline. /// @param metadata The metadata for the timeline. - Timeline( + OTIO_API Timeline( std::string const& name = std::string(), std::optional global_start_time = std::nullopt, AnyDictionary const& metadata = AnyDictionary()); @@ -74,10 +74,10 @@ class Timeline : public SerializableObjectWithMetadata } /// @brief Return the list of audio tracks. - std::vector audio_tracks() const; + OTIO_API std::vector audio_tracks() const; /// @brief Return the list of video tracks. - std::vector video_tracks() const; + OTIO_API std::vector video_tracks() const; /// @brief Find child clips. /// @@ -85,7 +85,7 @@ class Timeline : public SerializableObjectWithMetadata /// @param search_range An optional range to limit the search. /// @param shallow_search The search is recursive unless shallow_search is /// set to true. - std::vector> find_clips( + OTIO_API std::vector> find_clips( ErrorStatus* error_status = nullptr, std::optional const& search_range = std::nullopt, bool shallow_search = false) const; @@ -97,7 +97,7 @@ class Timeline : public SerializableObjectWithMetadata /// @param shallow_search The search is recursive unless shallow_search is /// set to true. template - std::vector> find_children( + OTIO_API std::vector> find_children( ErrorStatus* error_status = nullptr, std::optional search_range = std::nullopt, bool shallow_search = false) const; diff --git a/src/opentimelineio/track.h b/src/opentimelineio/track.h index 8a58b23b8d..2d8e5f9528 100644 --- a/src/opentimelineio/track.h +++ b/src/opentimelineio/track.h @@ -11,7 +11,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { class Clip; /// @brief A track is a composition of a certain kind, like video or audio. -class Track : public Composition +class OTIO_API_TYPE Track : public Composition { public: /// @brief This struct provides the base set of kinds of tracks. @@ -43,7 +43,7 @@ class Track : public Composition /// @param source_range The source range of the track. /// @param kind The kind of track. /// @param metadata The metadata for the track. - Track( + OTIO_API Track( std::string const& name = std::string(), std::optional const& source_range = std::nullopt, std::string const& kind = Kind::video, @@ -71,7 +71,7 @@ class Track : public Composition ErrorStatus* error_status = nullptr) const override; /// @brief Return the neighbors of the given item. - std::pair, Retainer> neighbors_of( + OTIO_API std::pair, Retainer> neighbors_of( Composable const* item, ErrorStatus* error_status = nullptr, NeighborGapPolicy insert_gap = NeighborGapPolicy::never) const; diff --git a/src/opentimelineio/trackAlgorithm.h b/src/opentimelineio/trackAlgorithm.h index 7173437759..19a8a0487a 100644 --- a/src/opentimelineio/trackAlgorithm.h +++ b/src/opentimelineio/trackAlgorithm.h @@ -9,7 +9,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// @brief Trim the track to the given range. -Track* track_trimmed_to_range( +OTIO_API Track* track_trimmed_to_range( Track* in_track, TimeRange trim_range, ErrorStatus* error_status = nullptr); diff --git a/src/opentimelineio/transition.h b/src/opentimelineio/transition.h index f254f65878..df6e3e1700 100644 --- a/src/opentimelineio/transition.h +++ b/src/opentimelineio/transition.h @@ -10,7 +10,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// @brief Represents a transition between the two adjacent items in a Track. /// /// For example, a cross dissolve or wipe. -class Transition : public Composable +class OTIO_API_TYPE Transition : public Composable { public: /// @brief This struct provides base set of transitions. @@ -36,7 +36,7 @@ class Transition : public Composable /// @param in_offset The in time offset. /// @param out_offset The out time offset. /// @param metadata The metadata for the transition. - Transition( + OTIO_API Transition( std::string const& name = std::string(), std::string const& transition_type = std::string(), RationalTime in_offset = RationalTime(), diff --git a/src/opentimelineio/typeRegistry.h b/src/opentimelineio/typeRegistry.h index 4839dfa020..635e203ce2 100644 --- a/src/opentimelineio/typeRegistry.h +++ b/src/opentimelineio/typeRegistry.h @@ -36,7 +36,7 @@ using label_to_schema_version_map = extern const label_to_schema_version_map CORE_VERSION_MAP; /// @brief Type registry. -class TypeRegistry +class OTIO_API_TYPE TypeRegistry { public: /// @brief Get the type registry singleton. diff --git a/src/opentimelineio/unknownSchema.h b/src/opentimelineio/unknownSchema.h index c609930953..cab5756042 100644 --- a/src/opentimelineio/unknownSchema.h +++ b/src/opentimelineio/unknownSchema.h @@ -9,7 +9,7 @@ namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { /// @brief An unknown schema. -class UnknownSchema : public SerializableObject +class OTIO_API_TYPE UnknownSchema : public SerializableObject { public: /// @brief This struct provides the UnknownSchema schema.