Files
oak-editor/include/codec/conform.h
T
Mike-Solar 3d004c081b 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
2026-08-06 18:50:07 +08:00

107 lines
3.5 KiB
C

/***
Oak Video Editor - Non-Linear Video Editor
Copyright (C) 2026 Oak Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef OAK_EDITOR_CODEC_CONFORM_H
#define OAK_EDITOR_CODEC_CONFORM_H
#include <stdint.h>
#include "error.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @file conform.h
* @brief C ABI for the oakcodec audio conform manager
* (olive::ConformManager): pcm waveform cache files used for fast
* audio scrubbing.
*
* Interim state (pre-M8): actual conform work is delegated to the global
* task submit callback (see task.h). While no callback is registered,
* state queries report OAKCODEC_CONFORM_UNAVAILABLE.
*/
#define OAKCODEC_CONFORM_EXISTS 0
#define OAKCODEC_CONFORM_GENERATING 1
#define OAKCODEC_CONFORM_UNAVAILABLE 2
/**
* @brief Create the ConformManager singleton (no-op when it exists).
*/
OAKCODEC_API int oakcodec_conform_create_instance(void);
/**
* @brief Destroy the ConformManager singleton (no-op when absent).
*/
OAKCODEC_API int oakcodec_conform_destroy_instance(void);
/**
* @brief Query the conform state of one audio stream, starting the
* conform when needed and possible.
*
* Addresses the source by filename/stream_index and the target audio
* format by sample_rate/channel_layout/sample_format
* (olive::core::SampleFormat::Format as int).
*
* When the conform files do not exist and a task submit callback is
* registered (task.h), the conform is submitted synchronously and the
* filesystem is re-checked; `wait` only controls whether a post-submit
* miss is reported as OAKCODEC_CONFORM_UNAVAILABLE (wait != 0) or
* OAKCODEC_CONFORM_GENERATING (wait == 0). Without a registrar the
* result is always OAKCODEC_CONFORM_UNAVAILABLE.
*
* @return One of OAKCODEC_CONFORM_* (non-negative), or a negative
* OAKCODEC_E_* code for invalid arguments.
*/
OAKCODEC_API int oakcodec_conform_get_state(const char *cache_path,
const char *source_filename, int stream_index,
int sample_rate, uint64_t channel_layout,
int sample_format, int wait);
/**
* @brief Number of conform (pcm) files for the given stream/params — one
* per channel; 0 on invalid arguments.
*/
OAKCODEC_API int oakcodec_conform_filename_count(const char *cache_path,
const char *source_filename, int stream_index,
int sample_rate, uint64_t channel_layout,
int sample_format);
/**
* @brief The `index`-th conform filename (buf/size getter).
*
* @return Required buffer size including NUL (non-negative), or a
* negative OAKCODEC_E_* code (OAKCODEC_E_NOT_FOUND when index is
* out of range).
*/
OAKCODEC_API int oakcodec_conform_filename_at(const char *cache_path,
const char *source_filename,
int stream_index, int sample_rate,
uint64_t channel_layout, int sample_format,
int index, char *buf, int buf_size);
#ifdef __cplusplus
}
#endif
#endif //OAK_EDITOR_CODEC_CONFORM_H