mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Merge branch 'master' into wip/landscape
This commit is contained in:
commit
e8e36360f8
@ -8,6 +8,7 @@ include (GNUInstallDirs)
|
|||||||
include (${CMAKE_ROOT}/Modules/ExternalProject.cmake)
|
include (${CMAKE_ROOT}/Modules/ExternalProject.cmake)
|
||||||
|
|
||||||
include_directories (${CMAKE_INSTALL_PREFIX}/include)
|
include_directories (${CMAKE_INSTALL_PREFIX}/include)
|
||||||
|
include_directories (${CMAKE_INSTALL_PREFIX}/include/SDL2)
|
||||||
link_directories (${CMAKE_INSTALL_PREFIX}/lib)
|
link_directories (${CMAKE_INSTALL_PREFIX}/lib)
|
||||||
|
|
||||||
project (planetblupi)
|
project (planetblupi)
|
||||||
|
@ -36,7 +36,7 @@ bool
|
|||||||
CMovie::initAVI ()
|
CMovie::initAVI ()
|
||||||
{
|
{
|
||||||
// Initialize Kitchensink with network support and all formats.
|
// Initialize Kitchensink with network support and all formats.
|
||||||
Sint32 err = Kit_Init (KIT_INIT_FORMATS);
|
Sint32 err = Kit_Init (0);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Unable to initialize Kitchensink: %s", Kit_GetError ());
|
fprintf (stderr, "Unable to initialize Kitchensink: %s", Kit_GetError ());
|
||||||
@ -104,7 +104,11 @@ CMovie::fileOpenMovie (const std::string & pFilename)
|
|||||||
if (m_movie)
|
if (m_movie)
|
||||||
{
|
{
|
||||||
// Create the player
|
// Create the player
|
||||||
m_player = Kit_CreatePlayer (m_movie);
|
m_player = Kit_CreatePlayer (
|
||||||
|
m_movie, Kit_GetBestSourceStream (m_movie, KIT_STREAMTYPE_VIDEO),
|
||||||
|
Kit_GetBestSourceStream (m_movie, KIT_STREAMTYPE_AUDIO),
|
||||||
|
Kit_GetBestSourceStream (m_movie, KIT_STREAMTYPE_SUBTITLE), LXIMAGE (),
|
||||||
|
LYIMAGE ());
|
||||||
if (m_player == nullptr)
|
if (m_player == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -114,15 +118,15 @@ CMovie::fileOpenMovie (const std::string & pFilename)
|
|||||||
SDL_AudioSpec wanted_spec, audio_spec;
|
SDL_AudioSpec wanted_spec, audio_spec;
|
||||||
|
|
||||||
SDL_memset (&wanted_spec, 0, sizeof (wanted_spec));
|
SDL_memset (&wanted_spec, 0, sizeof (wanted_spec));
|
||||||
wanted_spec.freq = info.audio.samplerate;
|
wanted_spec.freq = info.audio.output.samplerate;
|
||||||
wanted_spec.format = info.audio.format;
|
wanted_spec.format = info.audio.output.format;
|
||||||
wanted_spec.channels = info.audio.channels;
|
wanted_spec.channels = info.audio.output.channels;
|
||||||
m_audioDev = SDL_OpenAudioDevice (nullptr, 0, &wanted_spec, &audio_spec, 0);
|
m_audioDev = SDL_OpenAudioDevice (nullptr, 0, &wanted_spec, &audio_spec, 0);
|
||||||
SDL_PauseAudioDevice (m_audioDev, 0);
|
SDL_PauseAudioDevice (m_audioDev, 0);
|
||||||
|
|
||||||
m_videoTex = SDL_CreateTexture (
|
m_videoTex = SDL_CreateTexture (
|
||||||
g_renderer, info.video.format, SDL_TEXTUREACCESS_TARGET, info.video.width,
|
g_renderer, info.video.output.format, SDL_TEXTUREACCESS_TARGET,
|
||||||
info.video.height);
|
info.video.output.width, info.video.output.height);
|
||||||
|
|
||||||
if (m_videoTex == nullptr)
|
if (m_videoTex == nullptr)
|
||||||
return false;
|
return false;
|
||||||
@ -260,9 +264,9 @@ CMovie::Render ()
|
|||||||
SDL_LockAudio ();
|
SDL_LockAudio ();
|
||||||
while (need > 0)
|
while (need > 0)
|
||||||
{
|
{
|
||||||
m_ret = Kit_GetAudioData (
|
m_ret = Kit_GetPlayerAudioData (
|
||||||
m_player, (unsigned char *) m_audiobuf, AUDIOBUFFER_SIZE,
|
m_player, (unsigned char *) m_audiobuf,
|
||||||
(size_t) SDL_GetQueuedAudioSize (m_audioDev));
|
AUDIOBUFFER_SIZE - (size_t) SDL_GetQueuedAudioSize (m_audioDev));
|
||||||
need -= m_ret;
|
need -= m_ret;
|
||||||
if (m_ret > 0)
|
if (m_ret > 0)
|
||||||
SDL_QueueAudio (m_audioDev, m_audiobuf, m_ret);
|
SDL_QueueAudio (m_audioDev, m_audiobuf, m_ret);
|
||||||
@ -287,7 +291,7 @@ CMovie::Render ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Refresh videotexture and render it
|
// Refresh videotexture and render it
|
||||||
Kit_GetVideoData (m_player, m_videoTex);
|
Kit_GetPlayerVideoData (m_player, m_videoTex);
|
||||||
|
|
||||||
SDL_Rect dstRect;
|
SDL_Rect dstRect;
|
||||||
dstRect.x = (LXIMAGE () - LXLOGIC ()) / 2;
|
dstRect.x = (LXIMAGE () - LXLOGIC ()) / 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user