freepassport-c/src/channel.h

47 lines
1.8 KiB
C

#ifndef CHANNEL_H
#define CHANNEL_H
#include <SDL2/SDL.h>
#include <limits.h>
#include <time.h>
typedef struct Channel {
int number;
char name[64];
char description[256];
double total_duration_seconds;
struct ProgramEntry *programs;
int program_count;
} Channel;
typedef struct ProgramEntry {
char file_path[PATH_MAX];
char file_name[128];
char program_title[128];
double duration_seconds;
double start_offset_seconds;
} ProgramEntry;
typedef struct ChannelList {
Channel *items;
int count;
} ChannelList;
int channel_list_load(ChannelList *list, const char *media_dir);
void channel_list_destroy(ChannelList *list);
time_t channel_wall_time_from_ticks(time_t app_start_time, Uint64 app_start_ticks, Uint64 now_ticks);
double channel_schedule_elapsed_seconds(time_t app_start_time, time_t target_time);
double channel_live_position(const Channel *channel, time_t app_start_time, time_t now);
double channel_live_position_precise(const Channel *channel, Uint64 app_start_ticks, Uint64 now_ticks);
const ProgramEntry *channel_resolve_program_at_elapsed(const Channel *channel,
double elapsed_seconds,
double *program_seek_seconds,
int *program_index);
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);
#endif