#ifndef KITPLAYER_H #define KITPLAYER_H #include "kitchensink/kitsource.h" #include "kitchensink/kitconfig.h" #include #include #include #include #ifdef __cplusplus extern "C" { #endif #define KIT_CODECMAX 16 #define KIT_CODECNAMEMAX 128 typedef enum Kit_PlayerState { KIT_STOPPED = 0, ///< Playback stopped or has not started yet. KIT_PLAYING, ///< Playback started & player is actively decoding. KIT_PAUSED, ///< Playback paused; player is actively decoding but no new data is given out. KIT_CLOSED ///< Playback is stopped and player is closing. } Kit_PlayerState; typedef struct Kit_AudioFormat { int stream_idx; ///< Stream index bool is_enabled; ///< Is stream enabled unsigned int format; ///< SDL Audio Format bool is_signed; ///< Signedness int bytes; ///< Bytes per sample per channel int samplerate; ///< Sampling rate int channels; ///< Channels } Kit_AudioFormat; typedef struct Kit_VideoFormat { int stream_idx; ///< Stream index bool is_enabled; ///< Is stream enabled unsigned int format; ///< SDL Pixel Format int width; ///< Width in pixels int height; ///< Height in pixels } Kit_VideoFormat; typedef struct Kit_SubtitleFormat { int stream_idx; ///< Stream index bool is_enabled; ///< Is stream enabled } Kit_SubtitleFormat; typedef struct Kit_Player { // Local state Kit_PlayerState state; ///< Playback state Kit_VideoFormat vformat; ///< Video format information Kit_AudioFormat aformat; ///< Audio format information Kit_SubtitleFormat sformat; ///< Subtitle format information // Synchronization double clock_sync; ///< Clock sync point double pause_start; ///< Timestamp of pause beginning double vclock_pos; ///< Video stream last pts // Threading SDL_Thread *dec_thread; ///< Decoder thread SDL_mutex *vmutex; ///< Video stream buffer lock SDL_mutex *amutex; ///< Audio stream buffer lock SDL_mutex *smutex; ///< Subtitle stream buffer lock SDL_mutex *cmutex; ///< Control stream buffer lock // Buffers void *abuffer; ///