feat: add native local-file playback

This commit is contained in:
2026-10-10 01:07:49 +02:00
commit 8a89d88254
11 changed files with 1722 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
#ifndef PERSONAL_PLAYER_H
#define PERSONAL_PLAYER_H
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct Player Player;
typedef enum PlayerStatus {
PLAYER_EMPTY, PLAYER_OPENING, PLAYER_PAUSED, PLAYER_PLAYING,
PLAYER_ENDED, PLAYER_ERROR
} PlayerStatus;
typedef struct PlayerState {
PlayerStatus status;
double position;
double duration;
bool has_audio;
bool has_video;
uint64_t revision;
char error[512];
} PlayerState;
// Commands are asynchronous. False means invalid input or a full command queue.
// Paths are copied before returning. All other calls require a live handle.
Player *player_create(void);
bool player_open(Player *player, const char *path);
bool player_play(Player *player);
bool player_pause(Player *player);
bool player_seek(Player *player, double seconds);
bool player_close(Player *player);
PlayerState player_get_state(Player *player);
// Joins the worker and stops audio; never invoke from an audio callback.
void player_destroy(Player *player);
#ifdef __cplusplus
}
#endif
#endif