diff options
author | Tuomas Virtanen <katajakasa@gmail.com> | 2018-06-24 23:30:42 +0300 |
---|---|---|
committer | Tuomas Virtanen <katajakasa@gmail.com> | 2018-06-24 23:30:42 +0300 |
commit | d7d5cb75e6fa7f0d2eaeb9cdaf2812dc4c5be466 (patch) | |
tree | 63a68f7fceb4d4a9c06a0e5054375da0477f081f /examples/example_simple.c | |
parent | 1d06ec23f264e18a188bf46b72c8794c82c4b89e (diff) |
API rework #36, #37
Diffstat (limited to 'examples/example_simple.c')
-rw-r--r-- | examples/example_simple.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/examples/example_simple.c b/examples/example_simple.c index 0221863..d3b7146 100644 --- a/examples/example_simple.c +++ b/examples/example_simple.c @@ -85,16 +85,17 @@ int main(int argc, char *argv[]) { Kit_PlayerInfo pinfo; Kit_GetPlayerInfo(player, &pinfo); - if(!pinfo.video.is_enabled) { + // Make sure there is video in the file to play first. + if(Kit_GetPlayerVideoStream(player) == -1) { fprintf(stderr, "File contains no video!\n"); return 1; } // Init audio SDL_memset(&wanted_spec, 0, sizeof(wanted_spec)); - wanted_spec.freq = pinfo.audio.samplerate; - wanted_spec.format = pinfo.audio.format; - wanted_spec.channels = pinfo.audio.channels; + wanted_spec.freq = pinfo.audio.output.samplerate; + wanted_spec.format = pinfo.audio.output.format; + wanted_spec.channels = pinfo.audio.output.channels; audio_dev = SDL_OpenAudioDevice(NULL, 0, &wanted_spec, &audio_spec, 0); SDL_PauseAudioDevice(audio_dev, 0); @@ -102,10 +103,10 @@ int main(int argc, char *argv[]) { SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); SDL_Texture *video_tex = SDL_CreateTexture( renderer, - pinfo.video.format, + pinfo.video.output.format, SDL_TEXTUREACCESS_STATIC, - pinfo.video.width, - pinfo.video.height); + pinfo.video.output.width, + pinfo.video.output.height); if(video_tex == NULL) { fprintf(stderr, "Error while attempting to create a video texture\n"); return 1; @@ -115,7 +116,7 @@ int main(int argc, char *argv[]) { SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest"); // Always nearest for atlas operations SDL_Texture *subtitle_tex = SDL_CreateTexture( renderer, - pinfo.subtitle.format, + pinfo.subtitle.output.format, SDL_TEXTUREACCESS_STATIC, ATLAS_WIDTH, ATLAS_HEIGHT); if(subtitle_tex == NULL) { @@ -130,7 +131,7 @@ int main(int argc, char *argv[]) { Kit_PlayerPlay(player); // Get movie area size - SDL_RenderSetLogicalSize(renderer, pinfo.video.width, pinfo.video.height); + SDL_RenderSetLogicalSize(renderer, pinfo.video.output.width, pinfo.video.output.height); while(run) { if(Kit_GetPlayerState(player) == KIT_STOPPED) { run = false; |