SDL_kitchensink
Loading...
Searching...
No Matches
kitplayer.h
Go to the documentation of this file.
1#ifndef KITPLAYER_H
2#define KITPLAYER_H
3
16
17#include <SDL_render.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
26typedef enum Kit_PlayerState {
32
36typedef struct Kit_Player {
38 void *decoders[3];
39 void *dec_thread;
40 void *dec_lock;
41 const Kit_Source *src;
44
48typedef struct Kit_PlayerStreamInfo {
52
57typedef struct Kit_PlayerInfo {
62
106 int video_stream_index,
107 int audio_stream_index,
108 int subtitle_stream_index,
109 int screen_w,
110 int screen_h);
111
121
134KIT_API void Kit_SetPlayerScreenSize(Kit_Player *player, int w, int h);
135
145
155
165
172KIT_API int Kit_GetPlayerVideoData(Kit_Player *player, SDL_Texture *texture);
173
197KIT_API int Kit_GetPlayerVideoDataArea(Kit_Player *player, SDL_Texture *texture, SDL_Rect *area);
198
236 SDL_Texture *texture,
237 SDL_Rect *sources,
238 SDL_Rect *targets,
239 int limit);
240
261KIT_API int Kit_GetPlayerAudioData(Kit_Player *player, unsigned char *buffer, int length);
262
273
281
293
305
317
329KIT_API int Kit_PlayerSeek(Kit_Player *player, double time);
330
340
350
367KIT_API int Kit_GetPlayerAspectRatio(const Kit_Player *player, int *num, int *den);
368
369#ifdef __cplusplus
370}
371#endif
372
373#endif // KITPLAYER_H
Codec type.
Public API configurations.
#define KIT_API
Definition kitconfig.h:30
Audio/video output format type.
Kit_PlayerState
Playback states.
Definition kitplayer.h:26
@ KIT_PAUSED
Playback paused; player is actively decoding but no new data is given out.
Definition kitplayer.h:29
@ KIT_STOPPED
Playback stopped or has not started yet.
Definition kitplayer.h:27
@ KIT_PLAYING
Playback started & player is actively decoding.
Definition kitplayer.h:28
@ KIT_CLOSED
Playback is stopped and player is closing.
Definition kitplayer.h:30
KIT_API void Kit_ClosePlayer(Kit_Player *player)
Close previously initialized player.
KIT_API int Kit_PlayerSeek(Kit_Player *player, double time)
Seek to timestamp.
KIT_API int Kit_GetPlayerVideoStream(const Kit_Player *player)
Gets the current video stream index.
KIT_API void Kit_GetPlayerInfo(const Kit_Player *player, Kit_PlayerInfo *info)
Fetches information about the currently selected streams.
KIT_API int Kit_GetPlayerSubtitleStream(const Kit_Player *player)
Gets the current subtitle stream index.
KIT_API void Kit_PlayerPause(Kit_Player *player)
Pauses playback.
KIT_API double Kit_GetPlayerPosition(const Kit_Player *player)
Get the current position of the playback.
KIT_API void Kit_SetPlayerScreenSize(Kit_Player *player, int w, int h)
Sets the current screen size in pixels.
KIT_API int Kit_GetPlayerAudioData(Kit_Player *player, unsigned char *buffer, int length)
Fetches audio data from the player.
KIT_API int Kit_GetPlayerAudioStream(const Kit_Player *player)
Gets the current audio stream index.
KIT_API double Kit_GetPlayerDuration(const Kit_Player *player)
Get the duration of the source.
KIT_API Kit_PlayerState Kit_GetPlayerState(const Kit_Player *player)
Returns the current state of the player.
KIT_API int Kit_GetPlayerSubtitleData(Kit_Player *player, SDL_Texture *texture, SDL_Rect *sources, SDL_Rect *targets, int limit)
Fetches subtitle data from the player.
KIT_API int Kit_GetPlayerVideoDataArea(Kit_Player *player, SDL_Texture *texture, SDL_Rect *area)
Fetches a new video frame from the player.
KIT_API int Kit_GetPlayerVideoData(Kit_Player *player, SDL_Texture *texture)
Fetches a new video frame from the player.
KIT_API int Kit_GetPlayerAspectRatio(const Kit_Player *player, int *num, int *den)
Get the player aspect ratio, if playing video.
KIT_API void Kit_PlayerStop(Kit_Player *player)
Stops playback.
KIT_API Kit_Player * Kit_CreatePlayer(const Kit_Source *src, int video_stream_index, int audio_stream_index, int subtitle_stream_index, int screen_w, int screen_h)
Creates a new player from a source.
KIT_API void Kit_PlayerPlay(Kit_Player *player)
Starts playback.
Video/Audio source file handling.
Contains information about the used codec for playback.
Definition kitcodec.h:22
Contains information about the data format coming out from the player.
Definition kitformat.h:19
Player state container.
Definition kitplayer.h:36
void * dec_lock
Decoder lock.
Definition kitplayer.h:40
double pause_started
Temporary flag for handling pauses.
Definition kitplayer.h:42
void * decoders[3]
Decoder contexts.
Definition kitplayer.h:38
void * dec_thread
Decoder thread.
Definition kitplayer.h:39
const Kit_Source * src
Reference to Audio/Video source.
Definition kitplayer.h:41
Kit_PlayerState state
Playback state.
Definition kitplayer.h:37
Contains information about the streams selected for playback.
Definition kitplayer.h:57
Kit_PlayerStreamInfo subtitle
Subtitle stream data.
Definition kitplayer.h:60
Kit_PlayerStreamInfo audio
Audio stream data.
Definition kitplayer.h:59
Kit_PlayerStreamInfo video
Video stream data.
Definition kitplayer.h:58
Contains data about a stream selected for playback.
Definition kitplayer.h:48
Kit_Codec codec
Decoder codec information.
Definition kitplayer.h:49
Kit_OutputFormat output
Information about the output format.
Definition kitplayer.h:50
Audio/video source.
Definition kitsource.h:43