SDL_kitchensink
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
kitlib.h File Reference

Library initialization and deinitialization functionality. More...

#include "kitchensink/kitconfig.h"

Go to the source code of this file.

Data Structures

struct  Kit_Version
 SDL_kitchensink library version container. More...
 

Typedefs

typedef struct Kit_Version Kit_Version
 SDL_kitchensink library version container.
 
typedef enum Kit_HintType Kit_HintType
 Library hint types. Used as keys for Kit_SetHint().
 

Enumerations

enum  {
  KIT_FONT_HINTING_NONE = 0 , KIT_FONT_HINTING_LIGHT , KIT_FONT_HINTING_NORMAL , KIT_FONT_HINTING_NATIVE ,
  KIT_FONT_HINTING_COUNT
}
 Font hinting options. Used as values for Kit_SetHint(KIT_HINT_FONT_HINTING, ...). More...
 
enum  Kit_HintType {
  KIT_HINT_FONT_HINTING , KIT_HINT_THREAD_COUNT , KIT_HINT_VIDEO_BUFFER_FRAMES , KIT_HINT_AUDIO_BUFFER_FRAMES ,
  KIT_HINT_SUBTITLE_BUFFER_FRAMES
}
 Library hint types. Used as keys for Kit_SetHint(). More...
 
enum  { KIT_INIT_NETWORK = 0x1 , KIT_INIT_ASS = 0x2 }
 Library initialization options, please see Kit_Init() More...
 

Functions

KIT_API int Kit_Init (unsigned int flags)
 Initialize SDL_kitchensink library.
 
KIT_API void Kit_Quit ()
 Deinitializes SDL_kitchensink.
 
KIT_API void Kit_SetHint (Kit_HintType type, int value)
 Sets a library-wide hint.
 
KIT_API int Kit_GetHint (Kit_HintType type)
 Gets a previously set or default hint value.
 
KIT_API void Kit_GetVersion (Kit_Version *version)
 Can be used to fetch the version of the linked SDL_kitchensink library.
 

Detailed Description

Library initialization and deinitialization functionality.

Author
Tuomas Virtanen
Date
2018-06-25

Typedef Documentation

◆ Kit_HintType

typedef enum Kit_HintType Kit_HintType

Library hint types. Used as keys for Kit_SetHint().

Note that all of these must be set before player initialization for them to take effect!

◆ Kit_Version

typedef struct Kit_Version Kit_Version

SDL_kitchensink library version container.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Font hinting options. Used as values for Kit_SetHint(KIT_HINT_FONT_HINTING, ...).

Enumerator
KIT_FONT_HINTING_NONE 

No hinting. This is recommended option.

KIT_FONT_HINTING_LIGHT 

Light hinting. Use this if you need hinting.

KIT_FONT_HINTING_NORMAL 

Not recommended, please see libass docs for details.

KIT_FONT_HINTING_NATIVE 

Not recommended, please see libass docs for details.

KIT_FONT_HINTING_COUNT 

◆ anonymous enum

anonymous enum

Library initialization options, please see Kit_Init()

Enumerator
KIT_INIT_NETWORK 

Initialise ffmpeg network support.

KIT_INIT_ASS 

Initialize libass support (library must be linked statically or loadable dynamically)

◆ Kit_HintType

Library hint types. Used as keys for Kit_SetHint().

Note that all of these must be set before player initialization for them to take effect!

Enumerator
KIT_HINT_FONT_HINTING 

Set font hinting mode (currently used for libass)

KIT_HINT_THREAD_COUNT 

Set thread count for ffmpeg (1 by default). Set to 0 for autodetect.

KIT_HINT_VIDEO_BUFFER_FRAMES 

Video output buffer frames (3 by default)

KIT_HINT_AUDIO_BUFFER_FRAMES 

Audio output buffers (64 by default)

KIT_HINT_SUBTITLE_BUFFER_FRAMES 

Subtitle output buffers (64 by default, used by image subtitles)

Function Documentation

◆ Kit_GetHint()

KIT_API int Kit_GetHint ( Kit_HintType  type)

Gets a previously set or default hint value.

Parameters
typeHint type (refer to Kit_HintType for options)
Returns
Hint value

◆ Kit_GetVersion()

KIT_API void Kit_GetVersion ( Kit_Version version)

Can be used to fetch the version of the linked SDL_kitchensink library.

Parameters
versionAllocated Kit_Version

◆ Kit_Init()

KIT_API int Kit_Init ( unsigned int  flags)

Initialize SDL_kitchensink library.

This MUST be run before doing anything. After you are done using the library, you should use Kit_Quit() to deinitialize everything. Otherwise there might be resource leaks.

Following flags can be used to initialize subsystems:

  • KIT_INIT_NETWORK for ffmpeg network support (playback from the internet, for example)
  • KIT_INIT_ASS for libass subtitles (text and ass/ssa subtitle support)

Note that if this function fails, the failure reason should be available via Kit_GetError().

For example:

fprintf(stderr, "Error: %s\n", Kit_GetError());
return 1;
}
KIT_API const char * Kit_GetError()
Returns the latest error. This is set by SDL_kitchensink library functions on error.
KIT_API int Kit_Init(unsigned int flags)
Initialize SDL_kitchensink library.
@ KIT_INIT_NETWORK
Initialise ffmpeg network support.
Definition kitlib.h:56
@ KIT_INIT_ASS
Initialize libass support (library must be linked statically or loadable dynamically)
Definition kitlib.h:57
Parameters
flagsLibrary initialization flags
Returns
Returns 0 on success, 1 on failure.

◆ Kit_Quit()

KIT_API void Kit_Quit ( )

Deinitializes SDL_kitchensink.

Note that any calls to library functions after this will cause undefined behaviour!

◆ Kit_SetHint()

KIT_API void Kit_SetHint ( Kit_HintType  type,
int  value 
)

Sets a library-wide hint.

This can be used to set hints on how the library should behave. See Kit_HintType for all the options.

Parameters
typeHint type (refer to Kit_HintType for options)
valueValue for the hint