Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:

jobs:
build:
runs-on: macos-latest
runs-on: macos-26

steps:
- uses: actions/checkout@v6
Expand Down
5 changes: 2 additions & 3 deletions Examples/Sources/cxx_example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "opentime/timeRange.h"
#include "opentimelineio/optional.h"

namespace otio = opentimelineio::OPENTIMELINEIO_VERSION;
namespace otio = opentimelineio::OPENTIMELINEIO_VERSION_NS;

otio::SerializableObject* create_stuff() {
auto x = new otio::SerializableObjectWithMetadata;
Expand All @@ -20,7 +20,7 @@ otio::SerializableObject* create_stuff() {
x->metadata()["stuff4"] = 3.14159;
x->metadata()["stuff5"] = opentime::RationalTime();
x->metadata()["stuff6"] = opentime::TimeRange();

otio::AnyVector junk;
junk.push_back(13);
junk.push_back("hello");
Expand All @@ -34,4 +34,3 @@ int main() {
std::string s = so->to_json_string(&status);
printf("%s\n", s.c_str());
}

2 changes: 1 addition & 1 deletion OpenTimelineIO
10 changes: 5 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ let package = Package(
.target(name: "OpenTime_CXX",
dependencies: ["otio_header_root"],
path: "OpenTimelineIO/src/opentime",
exclude: ["CMakeLists.txt", "OpenTimeConfig.cmake.in"],
exclude: ["CMakeLists.txt", "OpenTimeConfig.cmake.in", "version.h.in"],
sources: ["."],
publicHeadersPath: ".",
cxxSettings: [ .headerSearchPath(".")]),
cxxSettings: [.headerSearchPath(".")]),

.target(name: "OpenTimelineIO_CXX",
dependencies: ["OpenTime_CXX"],
path: "OpenTimelineIO/src/opentimelineio",
exclude: ["CMakeLists.txt", "CORE_VERSION_MAP.last.cpp", "OpenTimelineIOConfig.cmake.in"],
exclude: ["CMakeLists.txt", "CORE_VERSION_MAP.last.cpp", "OpenTimelineIOConfig.cmake.in", "version.h.in"],
sources: ["."],
publicHeadersPath: ".",
cxxSettings: [
.headerSearchPath("."),
.headerSearchPath("../deps/any/"),
.headerSearchPath("../deps/Imath/src/Imath"),
.headerSearchPath("../deps/Imath/src"),
.headerSearchPath("../../../Sources/cpp"),
.headerSearchPath("../deps/rapidjson/include")]),

Expand All @@ -58,7 +58,7 @@ let package = Package(
sources: ["objc"],
publicHeadersPath: "objc/include",
cxxSettings: [
.headerSearchPath("../OpenTimelineIO/src/deps/Imath/src/Imath"),
.headerSearchPath("../OpenTimelineIO/src/deps/Imath/src"),
.headerSearchPath("../Sources/cpp"),
.headerSearchPath("objc/include")]),

Expand Down
7 changes: 3 additions & 4 deletions Sources/objc/CxxAny.mm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
case CxxAny::BOOL_:
return std::any(cxxAny.value.b);
case CxxAny::INT:
if (cxxAny.value.i < -INT_MIN || cxxAny.value.i > INT_MAX) {
if (cxxAny.value.i < INT_MIN || cxxAny.value.i > INT_MAX) {
return std::any(cxxAny.value.i);
}
else {
Expand Down Expand Up @@ -50,12 +50,11 @@
namespace {
struct _ToCxxAny {
std::map<std::type_index, std::function<void (std::any const&, CxxAny*)>> function_map;

_ToCxxAny() {
auto& m = function_map;
m[std::type_index(typeid(void))] = [](std::any const& a, CxxAny* cxxAny) {
cxxAny->type_code = CxxAny::NONE;

};
m[std::type_index(typeid(bool))] = [](std::any const& a, CxxAny* cxxAny) {
cxxAny->type_code = CxxAny::BOOL_;
Expand Down Expand Up @@ -108,7 +107,7 @@
void otio_any_to_cxx_any(std::any const& a, CxxAny* cxxAny) {
static auto toCxxAny = _ToCxxAny();
auto e = toCxxAny.function_map.find(std::type_index(a.type()));

if (e != toCxxAny.function_map.end()) {
e->second(a, cxxAny);
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/objc/include/CxxAnyDictionaryMutationStamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#if defined(__cplusplus)
#import <opentimelineio/anyDictionary.h>
namespace otio = opentimelineio::OPENTIMELINEIO_VERSION;
namespace otio = opentimelineio::OPENTIMELINEIO_VERSION_NS;
#endif

NS_ASSUME_NONNULL_BEGIN
Expand Down
2 changes: 1 addition & 1 deletion Sources/objc/include/CxxAnyVectorMutationStamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#if defined(__cplusplus)
#import <opentimelineio/anyVector.h>
namespace otio = opentimelineio::OPENTIMELINEIO_VERSION;
namespace otio = opentimelineio::OPENTIMELINEIO_VERSION_NS;
#endif

NS_ASSUME_NONNULL_BEGIN
Expand Down
2 changes: 1 addition & 1 deletion Sources/objc/include/CxxRetainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#if defined(__cplusplus)
#import <opentimelineio/serializableObject.h>
namespace otio = opentimelineio::OPENTIMELINEIO_VERSION;
namespace otio = opentimelineio::OPENTIMELINEIO_VERSION_NS;
#endif

NS_ASSUME_NONNULL_BEGIN
Expand Down
26 changes: 13 additions & 13 deletions Sources/objc/include/CxxVectorProperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@

#if defined(__cplusplus)
#import <opentimelineio/serializableObject.h>
namespace otio = opentimelineio::OPENTIMELINEIO_VERSION;
namespace otio = opentimelineio::OPENTIMELINEIO_VERSION_NS;

class CxxSOVectorBase {
public:
CxxSOVectorBase();
CxxSOVectorBase& operator=(CxxSOVectorBase const&) = delete;
CxxSOVectorBase(CxxSOVectorBase const&) = delete;
virtual ~CxxSOVectorBase();

virtual otio::SerializableObject* _Nullable fetch(int index) = 0;
virtual int size() = 0;
virtual void clear() = 0;

virtual void store(int index, otio::SerializableObject* _Nonnull) = 0;
virtual void moveIndex(int fromIndex, int toIndex) = 0;
virtual void removeAtEnd() = 0;
Expand All @@ -38,25 +38,25 @@ class CxxSOVector : public CxxSOVectorBase {
: _v{* new std::vector<otio::SerializableObject::Retainer<T>>}, _owner{true}
{
}

CxxSOVector(std::vector<otio::SerializableObject::Retainer<T>>& v)
: _v{v}, _owner{false} {
}

virtual otio::SerializableObject* _Nullable fetch(int index) {
return index < _v.size() ? _v[index] : nullptr;
}

virtual int size() {
return int(_v.size());
}

virtual ~CxxSOVector() {
if (_owner) {
delete &_v;
}
}

virtual void clear() {
_v.clear();
}
Expand All @@ -69,19 +69,19 @@ class CxxSOVector : public CxxSOVectorBase {
_v.emplace_back(otio::SerializableObject::Retainer<T>((T*)so));
}
}

virtual void moveIndex(int fromIndex, int toIndex) {
std::swap(_v[fromIndex], _v[toIndex]);
}

virtual void append(otio::SerializableObject* _Nonnull so) {
_v.emplace_back(otio::SerializableObject::Retainer<T>((T*)so));
}

virtual void removeAtEnd() {
_v.pop_back();
}

virtual void shrinkOrGrow(int n, bool grow) {
if (grow) {
for (int i = 0; i < n; i++) {
Expand All @@ -93,13 +93,13 @@ class CxxSOVector : public CxxSOVectorBase {
_v.clear();
return;
}

for (int i = 0; i < n; i++) {
_v.pop_back();
}
}
}

virtual void setContents(CxxSOVectorBase* _Nonnull src, bool destroyingSrc) {
CxxSOVector* typedSrc = (CxxSOVector*) src;
if (destroyingSrc) {
Expand Down
5 changes: 3 additions & 2 deletions Sources/objc/include/opentime.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ typedef struct CxxNonsense {
#import <opentime/timeRange.h>
#import <opentime/timeTransform.h>

namespace ot = opentime::OPENTIME_VERSION;
namespace ot = opentime::OPENTIME_VERSION_NS;

inline ot::RationalTime const& otioRationalTime(CxxRationalTime const& rt) {
return *((ot::RationalTime const*)(&rt));
Expand Down Expand Up @@ -60,14 +60,15 @@ extern "C" {
#endif



double rational_time_value_rescaled_to(CxxRationalTime const*, double new_rate);
double rational_time_value_rescaled_to_copy(CxxRationalTime, double new_rate);
CxxRationalTime rational_time_rescaled_to(CxxRationalTime const* rt, double new_rate);
bool rational_time_almost_equal(CxxRationalTime, CxxRationalTime, double);

CxxRationalTime rational_time_duration_from_start_end_time(CxxRationalTime, CxxRationalTime);
bool rational_time_is_valid_timecode_rate(double);
bool rational_time_is_smpte_timecode_rate(double);

CxxRationalTime rational_time_from_timecode(NSString* timecode, double rate, CxxErrorStruct* err);
CxxRationalTime rational_time_from_timestring(NSString* timestring, double rate, CxxErrorStruct* err);
Expand Down
7 changes: 6 additions & 1 deletion Sources/objc/opentime.mm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#import <opentimelineio/clip.h>
#import "opentime.h"

namespace otio = opentimelineio::OPENTIMELINEIO_VERSION;
namespace otio = opentimelineio::OPENTIMELINEIO_VERSION_NS;

static inline otio::RationalTime const* otioRationalTime(CxxRationalTime const* rt) {
return (otio::RationalTime const*)(rt);
Expand Down Expand Up @@ -41,10 +41,15 @@ CxxRationalTime rational_time_duration_from_start_end_time(CxxRationalTime s, Cx
otioRationalTime(e)));
}

// deprecated
bool rational_time_is_valid_timecode_rate(double rate) {
return otio::RationalTime::is_valid_timecode_rate(rate);
}

bool rational_time_is_smpte_timecode_rate(double rate) {
return otio::RationalTime::is_smpte_timecode_rate(rate);
}

static inline void deal_with_error(opentime::ErrorStatus const& error_status, CxxErrorStruct* err) {
if (error_status.outcome != error_status.OK) {
err->statusCode = error_status.outcome;
Expand Down
Loading
Loading