refactor(codec): de-Qt oakcodec and wrap it in a pure C ABI; switch common handles to refcounted value structs
- oakcodec: de-Qt all 20 sources (QThread decode loop -> std::thread,
QObject/signals -> callbacks), pure C ABI in include/codec with
refcounted neutral handles (OakFrame/OakDecoder/OakEncoder),
framemanager moved in from render, frame_to_buffer/buffer_to_frame
moved in from oakcommon oiioutils, codec->task via submit callback
(M8 will register), all cross-module calls go through the other
side's C API, -fvisibility=hidden + OAKCODEC_API
- oakcommon: handles become refcounted value structs
{ctx, addref, release, abi_version} (FFmpeg-style), pass-by-value
signatures, free() as release wrapper; init_from_native/get_native
for copyable value objects; OakCommonXxx renamed to OakXxx
- oakcommon: add logging (log_debug/info/warning/critical with level
filtering and sink injection) + printf-style oakcommon_log C wrapper
- oakrender: add CancelAtom C API family; complete
oakrender_color_processor_convert_frame; fix get_processor() missing
definition and OCIO env var lookup
- tests: oakcommon 174, oaknode 96, oakrender 42, oakcodec 18, all
green in their standalone builds
This commit is contained in:
@@ -28,13 +28,6 @@
|
||||
#include "colortransform.h"
|
||||
#include "project.h"
|
||||
|
||||
// Same handle-echo pattern as sequence.cpp: oakcommon defines
|
||||
// `struct OakCommonColorTransform { olive::ColorTransform impl; }`
|
||||
// (src/common/c_api/colortransform.cpp) without exporting the definition.
|
||||
struct OakCommonColorTransform {
|
||||
olive::ColorTransform impl;
|
||||
};
|
||||
|
||||
struct OakNodeColorManager {
|
||||
olive::ColorManager impl;
|
||||
};
|
||||
@@ -349,21 +342,30 @@ int oaknode_colormanager_get_default_luma_coefs(OakNodeColorManager *manager,
|
||||
}
|
||||
|
||||
int oaknode_colormanager_get_compliant_color_transform(
|
||||
OakNodeColorManager *manager, const OakCommonColorTransform *transform,
|
||||
int force_display, OakCommonColorTransform **out)
|
||||
OakNodeColorManager *manager, OakColorTransform transform,
|
||||
int force_display, OakColorTransform *out)
|
||||
{
|
||||
if (!manager || !transform || !out) {
|
||||
if (!manager || !out) {
|
||||
return OAKNODE_E_INVALID;
|
||||
}
|
||||
const olive::ColorTransform *native =
|
||||
oakcommon_colortransform_get_native(transform);
|
||||
if (!native) {
|
||||
return OAKNODE_E_INVALID;
|
||||
}
|
||||
if (!has_config(&manager->impl)) {
|
||||
return OAKNODE_E_STATE;
|
||||
}
|
||||
try {
|
||||
*out = new OakCommonColorTransform{
|
||||
manager->impl.get_compliant_color_space(transform->impl,
|
||||
force_display != 0)};
|
||||
const olive::ColorTransform compliant =
|
||||
manager->impl.get_compliant_color_space(*native,
|
||||
force_display != 0);
|
||||
*out = oakcommon_colortransform_init_from_native(&compliant);
|
||||
} catch (...) {
|
||||
return OAKNODE_E_NOMEM;
|
||||
}
|
||||
if (!out->ctx) {
|
||||
return OAKNODE_E_NOMEM;
|
||||
}
|
||||
return OAKNODE_OK;
|
||||
}
|
||||
|
||||
+15
-14
@@ -28,15 +28,6 @@
|
||||
#include "project/sequence/sequence.h"
|
||||
#include "videoparams.h"
|
||||
|
||||
// oakcommon defines its handle as `struct OakCommonVideoParams {
|
||||
// olive::VideoParams impl; }` (src/common/c_api/videoparams.cpp) without
|
||||
// exporting the definition. Echoing the identical layout here is the only
|
||||
// way to hand native VideoParams values across without a field-by-field
|
||||
// copy; keep in sync with oakcommon (flagged in the family-C report).
|
||||
struct OakCommonVideoParams {
|
||||
olive::VideoParams impl;
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
@@ -244,7 +235,7 @@ int oaknode_sequence_get_audio_stream_count(OakNodeSequence *sequence,
|
||||
}
|
||||
|
||||
int oaknode_sequence_get_video_params(OakNodeSequence *sequence, int index,
|
||||
OakCommonVideoParams **out)
|
||||
OakVideoParams *out)
|
||||
{
|
||||
if (!sequence || !out || index < 0) {
|
||||
return OAKNODE_E_INVALID;
|
||||
@@ -253,24 +244,34 @@ int oaknode_sequence_get_video_params(OakNodeSequence *sequence, int index,
|
||||
return OAKNODE_E_NOT_FOUND;
|
||||
}
|
||||
try {
|
||||
*out = new OakCommonVideoParams{impl(sequence)->get_video_params(index)};
|
||||
const olive::VideoParams params =
|
||||
impl(sequence)->get_video_params(index);
|
||||
*out = oakcommon_videoparams_init_from_native(¶ms);
|
||||
} catch (...) {
|
||||
return OAKNODE_E_NOMEM;
|
||||
}
|
||||
if (!out->ctx) {
|
||||
return OAKNODE_E_NOMEM;
|
||||
}
|
||||
return OAKNODE_OK;
|
||||
}
|
||||
|
||||
int oaknode_sequence_set_video_params(OakNodeSequence *sequence, int index,
|
||||
const OakCommonVideoParams *params)
|
||||
OakVideoParams params)
|
||||
{
|
||||
if (!sequence || !params || index < 0) {
|
||||
if (!sequence || index < 0) {
|
||||
return OAKNODE_E_INVALID;
|
||||
}
|
||||
const olive::VideoParams *native =
|
||||
oakcommon_videoparams_get_native(params);
|
||||
if (!native) {
|
||||
return OAKNODE_E_INVALID;
|
||||
}
|
||||
if (index >= impl(sequence)->get_video_stream_count()) {
|
||||
return OAKNODE_E_NOT_FOUND;
|
||||
}
|
||||
try {
|
||||
impl(sequence)->set_video_params(params->impl, index);
|
||||
impl(sequence)->set_video_params(*native, index);
|
||||
} catch (...) {
|
||||
return OAKNODE_E_FAILED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user