MediaManagerC

Plain-C interface to MediaManager for use with FFI bindings.

#include <media_manager.h>

Functions

void media_manager_configure(const char* media_path, const char* host, const char* user, int32_t min_free_space_mb)

Configures the media directory and remote transfer settings. Call once at startup.

ParameterTypeDescription
media_path const char* Local directory where all media files are stored.
host const char* Onboard computer IP address or hostname used for transfers.
user const char* SSH username for remote connections.
min_free_space_mb int32_t Minimum free space in MB required before accepting new media.
int32_t media_manager_scan(RogueMediaItem* buf, int32_t buf_count)

Scans the media directory and fills a caller-supplied buffer with discovered items.

ParameterTypeDescription
buf RogueMediaItem* Buffer to receive items, ordered newest first. Pass NULL to query the count only.
buf_count int32_t Capacity of buf in items. Pass 0 when buf is NULL.

Returns: int32_t

void media_manager_on_master_ready(const char* remote_path, uint64_t size_bytes, uint32_t duration_secs)

Notifies the manager that an onboard master recording is finalized and ready to fetch.

ParameterTypeDescription
remote_path const char* Absolute path to the master file on the onboard computer.
size_bytes uint64_t File size in bytes.
duration_secs uint32_t Recording duration in seconds.
void media_manager_fetch(const char* uuid)

Asynchronously transfers the master file for the given item.

ParameterTypeDescription
uuid const char* UUID of the media item to fetch. Does nothing if no remote path is known for this UUID.
void media_manager_refresh_remote(void)

Refresh the downloadable list by listing the onboard media directory over SSH and reconciling it against local files. Async; fires the on-changed callback when the list updates.

void media_manager_delete_item(const char* uuid)

Deletes all local files for the given item and clears its cached state.

ParameterTypeDescription
uuid const char* UUID of the media item to delete.
int32_t media_manager_export_file(const char* uuid, int32_t is_video, const char* dest_dir, char* dest_path_out, int32_t buf_size)

Copies the best available local file for the given item to a destination directory.

ParameterTypeDescription
uuid const char* UUID of the media item to export.
is_video int32_t 1 if the item is a video, 0 if it is a photo.
dest_dir const char* Destination directory path.
dest_path_out char* Buffer that receives the full destination path on success.
buf_size int32_t Capacity of dest_path_out in bytes.

Returns: int32_t

int32_t media_manager_has_enough_free_space(void)

Returns whether the media volume has sufficient free space.

Returns: int32_t