Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions src/opentime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

set(OPENTIME_HEADER_FILES
errorStatus.h
export.h
rationalTime.h
stringPrintf.h
timeRange.h
Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions src/opentime/errorStatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

#pragma once

#include "opentime/export.h"
#include "opentime/version.h"
#include <string>

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
Expand Down Expand Up @@ -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.
Expand Down
62 changes: 62 additions & 0 deletions src/opentime/export.h
Original file line number Diff line number Diff line change
@@ -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
22 changes: 11 additions & 11 deletions src/opentime/rationalTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
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,
ForceYes = 1,
};

/// @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.
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/opentime/timeRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/opentime/timeTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 11 additions & 2 deletions src/opentimelineio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set(OPENTIMELINEIO_HEADER_FILES
algo/editAlgorithm.h
effect.h
errorStatus.h
export.h
externalReference.h
freezeFrame.h
gap.h
Expand Down Expand Up @@ -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)
Expand Down
20 changes: 10 additions & 10 deletions src/opentimelineio/algo/editAlgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/opentimelineio/anyDictionary.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once

#include "opentimelineio/export.h"
#include "opentimelineio/version.h"

#include <any>
Expand All @@ -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<std::string, std::any>
class OTIO_API_TYPE AnyDictionary : private std::map<std::string, std::any>
{
public:
using map::map;
Expand Down
Loading
Loading