|
CorsixTH engine (the C++ part)
Open source implementation of Theme Hospital
|
#include <th_movie.h>
Public Member Functions | |
| movie_player () | |
| Construct a new movie_player. | |
| ~movie_player () | |
| Destroy the movie_player. | |
| void | set_renderer (SDL_Renderer *pRenderer) |
| bool | movies_enabled () const |
| Return whether movies were compiled into CorsixTH. | |
| bool | load (const char *szFilepath) |
| Load the movie with the given file name. | |
| void | unload () |
| void | play (int requested_audio_channel) |
| void | stop () |
| Stop the currently playing movie. | |
| void | togglePause () |
| int | get_native_height () const |
| Return the original height of the movie. | |
| int | get_native_width () const |
| Return the original width of the movie. | |
| bool | has_audio_track () const |
| Return whether the movie has an audio stream. | |
| double | get_movie_length () const |
| Return the length of the movie in milliseconds. | |
| const char * | get_last_error () const |
| Return a text description of the last error encountered. | |
| void | clear_last_error () |
| double | refresh (const SDL_Rect &destination_rect) |
| void | deallocate_picture_buffer () |
| void | allocate_picture_buffer () |
| Allocate the picture buffer for the current renderer. | |
| void | read_streams () |
| void | run_video () |
| void | copy_audio_to_stream (uint8_t *pbStream, int iStreamSize) |
Movie player for CorsixTH
The movie player is designed to be preinitialized and used for multiple movies. After initializing the movie player, call movie_player::set_renderer to assign the current SDL renderer to the movie player. Then movie_player::load the desired movie and finally movie_player::play it.
| movie_player::movie_player | ( | ) |
Construct a new movie_player.
| movie_player::~movie_player | ( | ) |
Destroy the movie_player.
| void movie_player::allocate_picture_buffer | ( | ) |
Allocate the picture buffer for the current renderer.
| void movie_player::clear_last_error | ( | ) |
Clear the last error so that if there is no more errors before the next call to movie_player::get_last_error() it will return an empty string.
Read audio from the audio packet queue, and copy it into the audio buffer for playback
| void movie_player::deallocate_picture_buffer | ( | ) |
Deallocate the picture buffer and free any resources associated with it.
Return a text description of the last error encountered.
| double movie_player::get_movie_length | ( | ) | const |
Return the length of the movie in milliseconds.
| int movie_player::get_native_height | ( | ) | const |
Return the original height of the movie.
| int movie_player::get_native_width | ( | ) | const |
Return the original width of the movie.
| bool movie_player::has_audio_track | ( | ) | const |
Return whether the movie has an audio stream.
| bool movie_player::movies_enabled | ( | ) | const |
Return whether movies were compiled into CorsixTH.
Play the currently loaded movie
| requested_audio_channel | The audio channel to use |
| void movie_player::read_streams | ( | ) |
Read packets from the movie and allocate them to the appropriate stream packet queues. Signal if we have reached the end of the movie.
Draw the next frame if it is time to do so
| destination_rect | The location and dimensions in the renderer on which to draw the movie |
| void movie_player::run_video | ( | ) |
Read video frames from the video packet queue and write them to the picture queue.
| void movie_player::set_renderer | ( | SDL_Renderer * | pRenderer | ) |
Assign the renderer on which to draw the movie.
movie_player does not take ownership of the render, it is up to the caller to delete it, after deleting movie_player or setting a different renderer.
| void movie_player::stop | ( | ) |
Stop the currently playing movie.
| void movie_player::togglePause | ( | ) |
Pause the currently playing movie
This method is not thread safe, it should only be called from the event thread.
| void movie_player::unload | ( | ) |
Unload and free the currently loaded movie.