30 lines
846 B
C
30 lines
846 B
C
|
|
#ifndef PLAYER_H
|
||
|
|
#define PLAYER_H
|
||
|
|
|
||
|
|
#include <SDL2/SDL.h>
|
||
|
|
#include <time.h>
|
||
|
|
|
||
|
|
#include "channel.h"
|
||
|
|
#include "frame_queue.h"
|
||
|
|
|
||
|
|
typedef struct Player {
|
||
|
|
FrameQueue frame_queue;
|
||
|
|
SDL_Thread *thread;
|
||
|
|
SDL_atomic_t stop_requested;
|
||
|
|
const ChannelList *channels;
|
||
|
|
int current_index;
|
||
|
|
time_t app_start_time;
|
||
|
|
Uint32 tuning_blackout_until;
|
||
|
|
SDL_mutex *error_mutex;
|
||
|
|
char last_error[256];
|
||
|
|
} Player;
|
||
|
|
|
||
|
|
int player_init(Player *player, const ChannelList *channels, time_t app_start_time);
|
||
|
|
void player_destroy(Player *player);
|
||
|
|
int player_tune(Player *player, int channel_index);
|
||
|
|
int player_consume_latest_frame(Player *player, FrameData *out);
|
||
|
|
double player_live_position(const Player *player, time_t now);
|
||
|
|
int player_is_in_blackout(const Player *player);
|
||
|
|
void player_get_error(Player *player, char *buffer, size_t buffer_size);
|
||
|
|
|
||
|
|
#endif
|