2026-03-27 21:45:40 -04:00
|
|
|
#ifndef CHANNEL_H
|
|
|
|
|
#define CHANNEL_H
|
|
|
|
|
|
2026-03-27 23:19:42 -04:00
|
|
|
#include <SDL2/SDL.h>
|
2026-03-27 21:45:40 -04:00
|
|
|
#include <limits.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
|
|
typedef struct Channel {
|
|
|
|
|
int number;
|
|
|
|
|
char name[64];
|
2026-03-28 00:25:06 -04:00
|
|
|
char description[256];
|
|
|
|
|
double total_duration_seconds;
|
|
|
|
|
struct ProgramEntry *programs;
|
|
|
|
|
int program_count;
|
|
|
|
|
} Channel;
|
|
|
|
|
|
|
|
|
|
typedef struct ProgramEntry {
|
2026-03-27 21:45:40 -04:00
|
|
|
char file_path[PATH_MAX];
|
|
|
|
|
char file_name[128];
|
|
|
|
|
char program_title[128];
|
|
|
|
|
double duration_seconds;
|
2026-03-28 00:25:06 -04:00
|
|
|
double start_offset_seconds;
|
|
|
|
|
} ProgramEntry;
|
2026-03-27 21:45:40 -04:00
|
|
|
|
|
|
|
|
typedef struct ChannelList {
|
|
|
|
|
Channel *items;
|
|
|
|
|
int count;
|
|
|
|
|
} ChannelList;
|
|
|
|
|
|
|
|
|
|
int channel_list_load(ChannelList *list, const char *media_dir);
|
|
|
|
|
void channel_list_destroy(ChannelList *list);
|
2026-03-28 10:56:27 -04:00
|
|
|
time_t channel_wall_time_from_ticks(time_t app_start_time, Uint64 app_start_ticks, Uint64 now_ticks);
|
2026-03-28 12:46:58 -04:00
|
|
|
double channel_schedule_elapsed_seconds(time_t app_start_time, time_t target_time);
|
2026-03-27 21:45:40 -04:00
|
|
|
double channel_live_position(const Channel *channel, time_t app_start_time, time_t now);
|
2026-03-27 23:19:42 -04:00
|
|
|
double channel_live_position_precise(const Channel *channel, Uint64 app_start_ticks, Uint64 now_ticks);
|
2026-03-28 12:46:58 -04:00
|
|
|
const ProgramEntry *channel_resolve_program_at_elapsed(const Channel *channel,
|
|
|
|
|
double elapsed_seconds,
|
|
|
|
|
double *program_seek_seconds,
|
|
|
|
|
int *program_index);
|
2026-03-28 00:25:06 -04:00
|
|
|
const ProgramEntry *channel_resolve_program(const Channel *channel,
|
|
|
|
|
Uint64 app_start_ticks,
|
|
|
|
|
Uint64 now_ticks,
|
|
|
|
|
double *program_seek_seconds,
|
|
|
|
|
int *program_index);
|
|
|
|
|
const ProgramEntry *channel_program_at_index(const Channel *channel, int program_index);
|
2026-03-27 21:45:40 -04:00
|
|
|
|
|
|
|
|
#endif
|