Tscope5
video_internal.c
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // __ ______
4 // / /_______________ ____ ___ / ____/
5 // / __/ ___/ ___/ __ \/ __ \/ _ \ /___ )
6 // / /_(__ ) /__/ /_/ / /_/ / __/ ____/ /
7 // \__/____/\___/\____/ .___/\___/ /_____/
8 // /_/
9 //
10 /// \file video_internal.c
11 /// Definitions of internal video functions.
12 ////////////////////////////////////////////////////////////////////////////////
13 
14 
15 #include "../include/tscope5/video_internal.h"
16 #include "../include/tscope5/system_internal.h"
17 #include "../include/tscope5/audio_internal.h"
18 
19 #include <allegro5/allegro_video.h>
20 
21 /// Is the video subsystem installed?
23 
24 
25 ////////////////////////////////////////////////////////////////////////////////
26 /// Do some checks at the start of each video function.
27 ///
28 /// \param calling_function Name the function that calls for
29 /// this check or installation.
30 ///
31 /// Checks whether the video subsystem is installed.
32 /// If not, the video subsystem is installed.
33 ////////////////////////////////////////////////////////////////////////////////
34 void ts5_check_video(char *calling_function)
35 {
36  ts5_log(TS5_LOGLEVEL_6, "%s: ts5_check_video\n", calling_function);
38  ts5_install_video(calling_function);
39  }
40 }
41 
42 
43 ////////////////////////////////////////////////////////////////////////////////
44 /// Install the video subsystem.
45 ///
46 /// \param calling_function Name the function that calls for
47 /// this check or installation.
48 ///
49 /// This function is called automatically if necessary.
50 ////////////////////////////////////////////////////////////////////////////////
51 void ts5_install_video(char *calling_function)
52 {
54  ts5_install_tscope5(calling_function);
55  }
56 
58  ts5_install_audio(calling_function);
59  }
60 
62 
64  ts5_log(TS5_LOGLEVEL_1, "%s: Installing Tscope5 video\n",
65  calling_function);
66 
67  if (!al_init_video_addon()) {
68  ts5_fatal("%s: could not install Tscope5 video\n",
69  calling_function);
70  }
71 
72  atexit(ts5_uninstall_video);
73  }
74 }
75 
76 
77 ////////////////////////////////////////////////////////////////////////////////
78 /// Uninstall the video subsystem.
79 ///
80 /// This function is called automatically at the end of the program.
81 ////////////////////////////////////////////////////////////////////////////////
83 {
85 
86  ts5_log(TS5_LOGLEVEL_1, "Uninstalling Tscope5 video\n");
87 
88  al_shutdown_video_addon();
89 
91  }
92 }
int _ts5_is_tscope5_installed
Is Tscope5 installed?
int _ts5_is_audio_installed
Is the audio subsystem installed?
void ts5_install_video(char *calling_function)
Install the video subsystem.
void ts5_check_video(char *calling_function)
Do some checks at the start of each video function.
void ts5_log(const unsigned int level, const char *format,...)
Send info to a logging window.
Definition: system.c:45
void ts5_install_tscope5(char *calling_function)
Install Tscope5.
int _ts5_is_video_installed
Is the video subsystem installed?
void ts5_uninstall_video()
Uninstall the video subsystem.
void ts5_install_audio(char *calling_function)
Install the audio subsystem.
void ts5_fatal(const char *format,...)
Exit safely with an error message.
Definition: system.c:533