diff options
author | Tuomas Virtanen <katajakasa@gmail.com> | 2018-06-23 17:53:11 +0300 |
---|---|---|
committer | Tuomas Virtanen <katajakasa@gmail.com> | 2018-06-23 17:53:11 +0300 |
commit | 60dd75397f1ce9c4a56e74ee0bb94cebd4ab831c (patch) | |
tree | 03b39dc8f6f1b2167971dd6b3a7fa89a3ee29bda /include | |
parent | 329de67ea44552c1d08e23203daee7e878ffd759 (diff) |
Implement new API for subtitle screen size and stream indexes
Diffstat (limited to 'include')
-rw-r--r-- | include/kitchensink/internal/audio/kitaudio.h | 2 | ||||
-rw-r--r-- | include/kitchensink/internal/kitdecoder.h | 1 | ||||
-rw-r--r-- | include/kitchensink/internal/subtitle/kitatlas.h | 3 | ||||
-rw-r--r-- | include/kitchensink/internal/subtitle/kitsubtitle.h | 3 | ||||
-rw-r--r-- | include/kitchensink/internal/subtitle/renderers/kitsubrenderer.h | 7 | ||||
-rw-r--r-- | include/kitchensink/internal/video/kitvideo.h | 2 | ||||
-rw-r--r-- | include/kitchensink/kitplayer.h | 22 | ||||
-rw-r--r-- | include/kitchensink/kitsource.h | 5 |
8 files changed, 29 insertions, 16 deletions
diff --git a/include/kitchensink/internal/audio/kitaudio.h b/include/kitchensink/internal/audio/kitaudio.h index ac6753b..105c9f6 100644 --- a/include/kitchensink/internal/audio/kitaudio.h +++ b/include/kitchensink/internal/audio/kitaudio.h @@ -6,7 +6,7 @@ #include "kitchensink/kitplayer.h"
#include "kitchensink/internal/kitdecoder.h"
-KIT_LOCAL Kit_Decoder* Kit_CreateAudioDecoder(const Kit_Source *src, Kit_AudioFormat *format);
+KIT_LOCAL Kit_Decoder* Kit_CreateAudioDecoder(const Kit_Source *src, int stream_index, Kit_AudioFormat *format);
KIT_LOCAL int Kit_GetAudioDecoderData(Kit_Decoder *dec, unsigned char *buf, int len);
#endif // KITAUDIO_H
diff --git a/include/kitchensink/internal/kitdecoder.h b/include/kitchensink/internal/kitdecoder.h index 89a293e..b4b3f36 100644 --- a/include/kitchensink/internal/kitdecoder.h +++ b/include/kitchensink/internal/kitdecoder.h @@ -38,6 +38,7 @@ KIT_LOCAL struct Kit_Decoder { KIT_LOCAL Kit_Decoder* Kit_CreateDecoder(const Kit_Source *src, int stream_index,
int out_b_size, dec_free_packet_cb free_out_cb);
+KIT_LOCAL int Kit_SetDecoderStreamIndex(Kit_Decoder *dec, int stream_index);
KIT_LOCAL void Kit_SetDecoderClockSync(Kit_Decoder *dec, double sync);
KIT_LOCAL void Kit_ChangeDecoderClockSync(Kit_Decoder *dec, double sync);
KIT_LOCAL bool Kit_CanWriteDecoderInput(Kit_Decoder *dec);
diff --git a/include/kitchensink/internal/subtitle/kitatlas.h b/include/kitchensink/internal/subtitle/kitatlas.h index ad583a1..7701966 100644 --- a/include/kitchensink/internal/subtitle/kitatlas.h +++ b/include/kitchensink/internal/subtitle/kitatlas.h @@ -27,14 +27,13 @@ typedef struct Kit_TextureAtlas { int cur_items; //< Current items count
int max_items; //< Maximum items count
int max_shelves; //< Maximum shelf count
- int border; //< Cleared border between atlas items in texture
int w; //< Current atlas width
int h; //< Current atlas height
Kit_TextureAtlasItem *items; //< Cached items
Kit_Shelf *shelves; //< Atlas shelves
} Kit_TextureAtlas;
-KIT_LOCAL Kit_TextureAtlas* Kit_CreateAtlas(int w, int h);
+KIT_LOCAL Kit_TextureAtlas* Kit_CreateAtlas();
KIT_LOCAL void Kit_FreeAtlas(Kit_TextureAtlas *atlas);
KIT_LOCAL void Kit_RefreshAtlas(Kit_TextureAtlas *atlas, double current_pts);
KIT_LOCAL void Kit_ClearAtlasContent(Kit_TextureAtlas *atlas);
diff --git a/include/kitchensink/internal/subtitle/kitsubtitle.h b/include/kitchensink/internal/subtitle/kitsubtitle.h index 25a6ecf..34b8103 100644 --- a/include/kitchensink/internal/subtitle/kitsubtitle.h +++ b/include/kitchensink/internal/subtitle/kitsubtitle.h @@ -8,7 +8,8 @@ #include "kitchensink/kitplayer.h"
#include "kitchensink/internal/kitdecoder.h"
-KIT_LOCAL Kit_Decoder* Kit_CreateSubtitleDecoder(const Kit_Source *src, Kit_SubtitleFormat *format, int w, int h);
+KIT_LOCAL Kit_Decoder* Kit_CreateSubtitleDecoder(const Kit_Source *src, int stream_index, Kit_SubtitleFormat *format, int w, int h);
KIT_LOCAL int Kit_GetSubtitleDecoderData(Kit_Decoder *dec, SDL_Texture *texture, SDL_Rect *sources, SDL_Rect *targets, int limit);
+KIT_LOCAL void Kit_SetSubtitleDecoderSize(Kit_Decoder *dec, int w, int h);
#endif // KITSUBTITLE_H
diff --git a/include/kitchensink/internal/subtitle/renderers/kitsubrenderer.h b/include/kitchensink/internal/subtitle/renderers/kitsubrenderer.h index 5c1a5b6..84b815b 100644 --- a/include/kitchensink/internal/subtitle/renderers/kitsubrenderer.h +++ b/include/kitchensink/internal/subtitle/renderers/kitsubrenderer.h @@ -9,20 +9,23 @@ typedef struct Kit_TextureAtlas Kit_TextureAtlas; typedef struct Kit_Decoder Kit_Decoder;
typedef void (*ren_render_cb)(Kit_SubtitleRenderer *ren, void *src, double start_pts, double end_pts);
-typedef int (*ren_get_data_db)(Kit_SubtitleRenderer *ren, Kit_TextureAtlas *atlas, double current_pts);
+typedef int (*ren_get_data_cb)(Kit_SubtitleRenderer *ren, Kit_TextureAtlas *atlas, double current_pts);
+typedef void (*ren_set_size_cb)(Kit_SubtitleRenderer *ren, int w, int h);
typedef void (*ren_close_cb)(Kit_SubtitleRenderer *ren);
struct Kit_SubtitleRenderer {
Kit_Decoder *dec;
void *userdata;
ren_render_cb ren_render; ///< Subtitle rendering function callback
- ren_get_data_db ren_get_data; ///< Subtitle data getter function callback
+ ren_get_data_cb ren_get_data; ///< Subtitle data getter function callback
+ ren_set_size_cb ren_set_size; ///< Screen size setter function callback
ren_close_cb ren_close; ///< Subtitle renderer close function callback
};
KIT_LOCAL Kit_SubtitleRenderer* Kit_CreateSubtitleRenderer(Kit_Decoder *dec);
KIT_LOCAL void Kit_RunSubtitleRenderer(Kit_SubtitleRenderer *ren, void *src, double start_pts, double end_pts);
KIT_LOCAL int Kit_GetSubtitleRendererData(Kit_SubtitleRenderer *ren, Kit_TextureAtlas *atlas, double current_pts);
+KIT_LOCAL void Kit_SetSubtitleRendererSize(Kit_SubtitleRenderer *ren, int w, int h);
KIT_LOCAL void Kit_CloseSubtitleRenderer(Kit_SubtitleRenderer *ren);
#endif // KITSUBRENDERER_H
diff --git a/include/kitchensink/internal/video/kitvideo.h b/include/kitchensink/internal/video/kitvideo.h index 5a5624f..1e158a7 100644 --- a/include/kitchensink/internal/video/kitvideo.h +++ b/include/kitchensink/internal/video/kitvideo.h @@ -6,7 +6,7 @@ #include "kitchensink/kitplayer.h"
#include "kitchensink/internal/kitdecoder.h"
-KIT_LOCAL Kit_Decoder* Kit_CreateVideoDecoder(const Kit_Source *src, Kit_VideoFormat *format);
+KIT_LOCAL Kit_Decoder* Kit_CreateVideoDecoder(const Kit_Source *src, int stream_index, Kit_VideoFormat *format);
KIT_LOCAL int Kit_GetVideoDecoderData(Kit_Decoder *dec, SDL_Texture *texture);
#endif // KITVIDEO_H
diff --git a/include/kitchensink/kitplayer.h b/include/kitchensink/kitplayer.h index b38385a..04e1a0b 100644 --- a/include/kitchensink/kitplayer.h +++ b/include/kitchensink/kitplayer.h @@ -52,13 +52,27 @@ typedef struct Kit_PlayerInfo { Kit_SubtitleFormat subtitle; ///< Subtitle format information } Kit_PlayerInfo; -KIT_API Kit_Player* Kit_CreatePlayer(const Kit_Source *src); +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); KIT_API void Kit_ClosePlayer(Kit_Player *player); +KIT_API void Kit_SetPlayerScreenSize(Kit_Player *player, int w, int h); +KIT_API int Kit_SetPlayerVideoStream(Kit_Player *player, int index); +KIT_API int Kit_SetPlayerAudioStream(Kit_Player *player, int index); +KIT_API int Kit_SetPlayerSubtitleStream(Kit_Player *player, int index); + KIT_API int Kit_UpdatePlayer(Kit_Player *player); -KIT_API int Kit_GetVideoData(Kit_Player *player, SDL_Texture *texture); -KIT_API int Kit_GetSubtitleData(Kit_Player *player, SDL_Texture *texture, SDL_Rect *sources, SDL_Rect *targets, int limit); -KIT_API int Kit_GetAudioData(Kit_Player *player, unsigned char *buffer, int length); +KIT_API int Kit_GetPlayerVideoData(Kit_Player *player, SDL_Texture *texture); +KIT_API int Kit_GetPlayerSubtitleData(Kit_Player *player, + SDL_Texture *texture, + SDL_Rect *sources, + SDL_Rect *targets, + int limit); +KIT_API int Kit_GetPlayerAudioData(Kit_Player *player, unsigned char *buffer, int length); KIT_API void Kit_GetPlayerInfo(const Kit_Player *player, Kit_PlayerInfo *info); KIT_API Kit_PlayerState Kit_GetPlayerState(const Kit_Player *player); diff --git a/include/kitchensink/kitsource.h b/include/kitchensink/kitsource.h index e20dc8a..0ca8e26 100644 --- a/include/kitchensink/kitsource.h +++ b/include/kitchensink/kitsource.h @@ -21,9 +21,6 @@ typedef enum Kit_StreamType { } Kit_StreamType; typedef struct Kit_Source { - int audio_stream_index; ///< Audio stream index - int video_stream_index; ///< Video stream index - int subtitle_stream_index; ///< Subtitle stream index void *format_ctx; ///< FFmpeg: Videostream format context void *avio_ctx; ///< FFmpeg: AVIO context } Kit_Source; @@ -43,8 +40,6 @@ KIT_API void Kit_CloseSource(Kit_Source *src); KIT_API int Kit_GetSourceStreamInfo(const Kit_Source *src, Kit_StreamInfo *info, int index); KIT_API int Kit_GetSourceStreamCount(const Kit_Source *src); KIT_API int Kit_GetBestSourceStream(const Kit_Source *src, const Kit_StreamType type); -KIT_API int Kit_SetSourceStream(Kit_Source *src, const Kit_StreamType type, int index); -KIT_API int Kit_GetSourceStream(const Kit_Source *src, const Kit_StreamType type); #ifdef __cplusplus } |