diff options
author | Tuomas Virtanen <katajakasa@gmail.com> | 2016-01-08 01:29:36 +0200 |
---|---|---|
committer | Tuomas Virtanen <katajakasa@gmail.com> | 2016-01-08 01:29:36 +0200 |
commit | cce3ee047e712f48059ed28b284cf5c194c34de8 (patch) | |
tree | b13dd1a2bb2eb1094d597d30c70002a166caf3ac /include/kitchensink/kitplayer.h | |
parent | d843d120ae3d87548e10f7ee0ded71a301d5d4b3 (diff) |
Code dump. Playback & decoding works, but no sync yet.
Diffstat (limited to 'include/kitchensink/kitplayer.h')
-rw-r--r-- | include/kitchensink/kitplayer.h | 56 |
1 files changed, 53 insertions, 3 deletions
diff --git a/include/kitchensink/kitplayer.h b/include/kitchensink/kitplayer.h index 3c88920..a4edb9b 100644 --- a/include/kitchensink/kitplayer.h +++ b/include/kitchensink/kitplayer.h @@ -2,19 +2,69 @@ #define KITPLAYER_H #include "kitchensink/kitsource.h" +#include "kitchensink/kitconfig.h" +#include <stdbool.h> + +#include <SDL2/SDL_render.h> #ifdef __cplusplus extern "C" { #endif -typedef struct Kit_Player { +#define KIT_CODECMAX 16 +#define KIT_CODECNAMEMAX 128 +#define KIT_VBUFFERSIZE 3 +#define KIT_ABUFFERSIZE 65536 + +typedef enum Kit_PlayerState { + KIT_STOPPED = 0, + KIT_PLAYING, + KIT_FINISHED +} Kit_PlayerState; +typedef struct Kit_AudioFormat { + int bytes; + bool is_signed; + int samplerate; + int channels; +} Kit_AudioFormat; + +typedef struct Kit_VideoFormat { + unsigned int format; + int width; + int height; +} Kit_VideoFormat; + +typedef struct Kit_Player { + Kit_PlayerState state; + Kit_VideoFormat vformat; + Kit_AudioFormat aformat; + void *abuffer; + void *vbuffer; + void *vcodec_ctx; + void *acodec_ctx; + void *swr; + void *sws; + const Kit_Source *src; } Kit_Player; -Kit_Player* Kit_CreatePlayer(Kit_Source *src); -void Kit_ClosePlayer(Kit_Player *player); +typedef struct Kit_PlayerInfo { + char acodec[KIT_CODECMAX]; + char acodec_name[KIT_CODECNAMEMAX]; + char vcodec[KIT_CODECMAX]; + char vcodec_name[KIT_CODECNAMEMAX]; + Kit_VideoFormat video; + Kit_AudioFormat audio; +} Kit_PlayerInfo; +KIT_API Kit_Player* Kit_CreatePlayer(const Kit_Source *src); +KIT_API void Kit_ClosePlayer(Kit_Player *player); +KIT_API int Kit_UpdatePlayer(Kit_Player *player); +KIT_API int Kit_RefreshTexture(Kit_Player *player, SDL_Texture *texture); +KIT_API int Kit_GetAudioData(Kit_Player *player, unsigned char *buffer, size_t length); +KIT_API int Kit_GetPlayerState(Kit_Player *player); +KIT_API void Kit_GetPlayerInfo(const Kit_Player *player, Kit_PlayerInfo *info); #ifdef __cplusplus } |