From b073e4c6aad0a4c35ea89c4592d5b48a39bb61f5 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Wed, 14 Oct 2020 22:19:21 +0300 Subject: Use libmpg123 to decode MPEG audio mpg123 is configured as an optional dependency. Works for full files currently. --- src/main.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 464176e6..de9132ab 100644 --- a/src/main.c +++ b/src/main.c @@ -20,25 +20,25 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#if defined (iPlatformMsys) -# define SDL_MAIN_HANDLED -#endif -#include - #include "app.h" #if defined (iPlatformApple) -extern void enableMomentumScroll_MacOS(void); -extern void registerURLHandler_MacOS(void); +# include "macos.h" #endif - #if defined (iPlatformMsys) # include "win32.h" +# define SDL_MAIN_HANDLED #endif +#if defined (LAGRANGE_ENABLE_MPG123) +# include +#endif + +#include +#include +#include int main(int argc, char **argv) { + printf("Lagrange: A Beautiful Gemini Client\n"); #if defined (iPlatformApple) enableMomentumScroll_MacOS(); registerURLHandler_MacOS(); @@ -47,10 +47,12 @@ int main(int argc, char **argv) { /* MSYS runtime takes care of WinMain. */ setDPIAware_Win32(); SDL_SetMainReady(); +#endif + /* Initialize libraries. */ +#if defined (LAGRANGE_ENABLE_MPG123) + mpg123_init(); #endif init_Foundation(); - printf("Lagrange: A Beautiful Gemini Client\n"); - /* Initialize SDL. */ SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1"); if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER)) { fprintf(stderr, "SDL init failed: %s\n", SDL_GetError()); @@ -58,5 +60,8 @@ int main(int argc, char **argv) { } run_App(argc, argv); SDL_Quit(); +#if defined (LAGRANGE_ENABLE_MPG123) + mpg123_exit(); +#endif return 0; } -- cgit v1.2.3