Skip to content
Closed
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
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ endif()

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# Default to not exporting C++ symbols, symbols that need to be exported are
# explicitly marked with the OPENTIME_EXPORT or OPENTIMELINEIO_EXPORT macros
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
include(GenerateExportHeader)

#------------------------------------------------------------------------------
# Fetch or refresh submodules if requested
#
Expand Down
8 changes: 6 additions & 2 deletions src/opentime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ 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
Expand All @@ -52,6 +51,10 @@ configure_file(
${CMAKE_CURRENT_BINARY_DIR}/version.h
)

generate_export_header(
opentime
EXPORT_FILE_NAME export.h)

if(OTIO_CXX_INSTALL)
install(FILES ${OPENTIME_HEADER_FILES}
DESTINATION "${OTIO_RESOLVED_CXX_INSTALL_DIR}/include/opentime")
Expand Down Expand Up @@ -86,6 +89,7 @@ if(OTIO_CXX_INSTALL)

install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/export.h
${CMAKE_CURRENT_BINARY_DIR}/version.h
DESTINATION
"${OTIO_RESOLVED_CXX_INSTALL_DIR}/include/opentime"
Expand Down
7 changes: 4 additions & 3 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_EXPORT ErrorStatus
{
/// @brief This enumeration represents the possible outcomes.
enum Outcome
Expand Down Expand Up @@ -51,14 +52,14 @@ struct ErrorStatus
};

///! @brief Check whether the given ErrorStatus is an error.
constexpr bool
OPENTIME_EXPORT 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
OPENTIME_EXPORT constexpr bool
is_error(const ErrorStatus* es) noexcept
{
return es && ErrorStatus::Outcome::OK != es->outcome;
Expand Down
37 changes: 20 additions & 17 deletions src/opentime/rationalTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,15 @@
namespace opentime { namespace OPENTIME_VERSION {

/// @brief This enumeration provides options for drop frame timecode.
enum IsDropFrameRate : int
enum OPENTIME_EXPORT IsDropFrameRate : int
{
InferFromRate = -1,
ForceNo = 0,
ForceYes = 1,
};

/// @brief Returns the absolute value.
///
/// \todo Document why this function is used instead of "std::fabs()".
constexpr double
fabs(double val) noexcept
{
union
{
double f;
uint64_t i;
} bits = { val };
bits.i &= std::numeric_limits<uint64_t>::max() / 2;
return bits.f;
}

/// @brief This class represents a measure of time defined by a value and rate.
class RationalTime
class OPENTIME_EXPORT RationalTime
{
public:
/// @brief Construct a new time with an optional value and rate.
Expand Down Expand Up @@ -419,6 +404,24 @@ class RationalTime
friend class TimeRange;

double _value, _rate;

/// @brief Returns the absolute value.
///
/// \todo This function is used instead of "std::fabs()" so we can mark it as
/// constexpr. We can remove this and replace it with the std version when we
/// upgrade to C++ 23. There are two copies of this function, in both
/// RationalTime and TimeRange.
static constexpr double
fabs(double val) noexcept
{
union
{
double f;
uint64_t i;
} bits = { val };
bits.i &= std::numeric_limits<uint64_t>::max() / 2;
return bits.f;
}
};

}} // namespace opentime::OPENTIME_VERSION
22 changes: 20 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_EXPORT 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_EXPORT TimeRange
{
public:
/// @brief Construct a new time range with a zero start time and duration.
Expand Down Expand Up @@ -441,6 +441,24 @@ class TimeRange
{
return rhs - lhs >= epsilon;
}

/// @brief Returns the absolute value.
///
/// \todo This function is used instead of "std::fabs()" so we can mark it as
/// constexpr. We can remove this and replace it with the std version when we
/// upgrade to C++ 23. There are two copies of this function, in both
/// RationalTime and TimeRange.
static constexpr double
fabs(double val) noexcept
{
union
{
double f;
uint64_t i;
} bits = { val };
bits.i &= std::numeric_limits<uint64_t>::max() / 2;
return bits.f;
}
};

}} // namespace opentime::OPENTIME_VERSION
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_EXPORT TimeTransform
{
public:
/// @brief Construct a new transform with an optional offset, scale, and rate.
Expand Down
8 changes: 6 additions & 2 deletions src/opentimelineio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ 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
Expand All @@ -128,6 +127,10 @@ configure_file(
${CMAKE_CURRENT_BINARY_DIR}/version.h
)

generate_export_header(
opentimelineio
EXPORT_FILE_NAME export.h)

if(OTIO_CXX_INSTALL)
install(FILES ${OPENTIMELINEIO_HEADER_FILES}
DESTINATION "${OTIO_RESOLVED_CXX_INSTALL_DIR}/include/opentimelineio")
Expand Down Expand Up @@ -164,6 +167,7 @@ if(OTIO_CXX_INSTALL)

install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/export.h
${CMAKE_CURRENT_BINARY_DIR}/version.h
DESTINATION
"${OTIO_RESOLVED_CXX_INSTALL_DIR}/include/opentimelineio"
Expand Down
22 changes: 11 additions & 11 deletions src/opentimelineio/algo/editAlgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace opentimelineio { namespace OPENTIMELINEIO_VERSION { namespace algo {

//! Enum used by 3/4 Point Edit (aka. as fill)
enum class ReferencePoint
enum class OPENTIMELINEIO_EXPORT ReferencePoint
{
Source,
Sequence,
Expand Down 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(
OPENTIMELINEIO_EXPORT 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(
OPENTIMELINEIO_EXPORT 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(
OPENTIMELINEIO_EXPORT 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(
OPENTIMELINEIO_EXPORT 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);
OPENTIMELINEIO_EXPORT 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);
OPENTIMELINEIO_EXPORT 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(
OPENTIMELINEIO_EXPORT 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(
OPENTIMELINEIO_EXPORT 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(
OPENTIMELINEIO_EXPORT 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(
OPENTIMELINEIO_EXPORT 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 OPENTIMELINEIO_EXPORT AnyDictionary : private std::map<std::string, std::any>
{
public:
using map::map;
Expand Down
3 changes: 2 additions & 1 deletion src/opentimelineio/anyVector.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 @@ -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<std::any>
class OPENTIMELINEIO_EXPORT AnyVector : private std::vector<std::any>
{
public:
using vector::vector;
Expand Down
2 changes: 1 addition & 1 deletion src/opentimelineio/clip.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 OPENTIMELINEIO_EXPORT Clip : public Item
{
public:
/// @brief The default media within a clip.
Expand Down
5 changes: 3 additions & 2 deletions src/opentimelineio/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <cmath>
#include <vector>

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

namespace opentimelineio { namespace OPENTIMELINEIO_VERSION {
Expand All @@ -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 OPENTIMELINEIO_EXPORT Color
{
public:
struct Schema
Expand Down Expand Up @@ -88,4 +89,4 @@ class Color
std::string _name;
};

}} // namespace opentimelineio::OPENTIMELINEIO_VERSION
}} // namespace opentimelineio::OPENTIMELINEIO_VERSION
2 changes: 1 addition & 1 deletion src/opentimelineio/composable.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 OPENTIMELINEIO_EXPORT Composable : public SerializableObjectWithMetadata
{
public:
/// @brief This struct provides the Composable schema.
Expand Down
2 changes: 1 addition & 1 deletion src/opentimelineio/composition.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 OPENTIMELINEIO_EXPORT Composition : public Item
{
public:
/// @brief This struct provides the Composition schema.
Expand Down
Loading