/*!
* COPYRIGHT (C) 2010-2020 Emeric Grange - All Rights Reserved
*
* This file is part of MiniVideo.
*
* MiniVideo is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MiniVideo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MiniVideo. If not, see .
*
* \author Emeric Grange
* \date 2016
*/
// Library public header
#include "minivideo.h"
#include "import.h"
#include "portable_endian.h"
// C standard libraries
#include
#include
#include
/* ************************************************************************** */
void minivideo_print_infos(void)
{
printf("minivideo_print_infos()\n");
//printf("* Library version '%d.%d-%d'\n", minivideo_VERSION_MAJOR,
// minivideo_VERSION_MINOR,
// minivideo_VERSION_PATCH);
#if defined(__ICC) || defined(__INTEL_COMPILER)
printf("* Library built with ICC '%d / %s'\n", __INTEL_COMPILER, __INTEL_COMPILER_BUILD_DATE);
#elif defined(_MSC_VER)
printf("* Library built with MSVC '%d'\n", _MSC_VER);
#elif defined(__clang__)
printf("* Library built with CLANG '%d.%d'\n", __clang_major__, __clang_minor__);
#elif defined(__GNUC__) || defined(__GNUG__)
printf("* Library built with GCC '%d.%d.%d'\n", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#else
printf("* Library built with an unknown compiler\n");
#endif
printf("* Library built on '%s, %s'\n", __DATE__ , __TIME__);
#if ENABLE_DEBUG == 1
printf("* This is a " BLD_YELLOW "DEBUG" CLR_RESET " build\n" CLR_RESET);
#endif
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
printf(OUT_YELLOW "* Address Sanitizer is ENABLED\n" CLR_RESET);
#endif
#else
#if defined(__SANITIZE_ADDRESS__)
printf(OUT_YELLOW "* Address Sanitizer is ENABLED\n" CLR_RESET);
#endif
#endif // defined(__has_feature)
}
/* ************************************************************************** */
void minivideo_print_features(void)
{
printf("minivideo_print_features()\n");
#if ENABLE_STBIMWRITE
printf("* STB_IMAGE_WRITE support is " "ON\n" );
#else
printf("* STB_IMAGE_WRITE support is " "OFF\n" );
#endif
#if ENABLE_WEBP
printf("* EXTERNAL WEBP support is " BLD_GREEN "ON\n" );
#else
printf("* EXTERNAL WEBP support is " "OFF\n" );
#endif
#if ENABLE_JPEG
printf("* EXTERNAL JPEG support is " BLD_GREEN "ON\n" );
#else
printf("* EXTERNAL JPEG support is " "OFF\n" );
#endif
#if ENABLE_PNG
printf("* EXTERNAL PNG support is " BLD_GREEN "ON\n" );
#else
printf("* EXTERNAL PNG support is " "OFF\n" );
#endif
#if ENABLE_COLORS
printf("* COLORS are " BLD_GREEN "ON\n" );
#else
printf("* COLORS are OFF\n");
#endif
#if ENABLE_DEBUG
printf("* DEBUG traces are " BLD_GREEN "ON\n" );
TRACE_ERROR(MAIN, "TEST error");
TRACE_WARNING(MAIN, "TEST warning");
TRACE_INFO(MAIN, "TEST info");
TRACE_1(MAIN, "TEST lvl 1");
TRACE_2(MAIN, "TEST lvl 2");
TRACE_3(MAIN, "TEST lvl 3");
#else
printf("* DEBUG traces are " "OFF\n" );
#endif
}
/* ************************************************************************** */
void minivideo_get_infos(int *minivideo_major, int *minivideo_minor, int *minivideo_patch,
const char **minivideo_builddate,
const char **minivideo_buildtime,
bool *minivideo_builddebug)
{
if (minivideo_major && minivideo_minor && minivideo_patch)
{
//*minivideo_major = minivideo_VERSION_MAJOR;
//*minivideo_minor = minivideo_VERSION_MINOR;
//*minivideo_patch = minivideo_VERSION_PATCH;
*minivideo_major = 1;
*minivideo_minor = 0;
*minivideo_patch = 0;
}
if (minivideo_builddate && minivideo_buildtime)
{
*minivideo_builddate = __DATE__;
*minivideo_buildtime = __TIME__;
}
if (minivideo_builddebug)
{
#if ENABLE_DEBUG == 1
*minivideo_builddebug = true;
#else
*minivideo_builddebug = false;
#endif
}
}
/* ************************************************************************** */
int minivideo_endianness(void)
{
printf("minivideo_endianness()\n" );
int endianness = -1;
int i = 1;
char *p = (char *)&i;
if (p[0] == 1)
{
printf("* Host system is " "LITTLE_ENDIAN" "\n");
endianness = __LITTLE_ENDIAN; // 1234
}
else
{
printf("* Host system is " "BIG_ENDIAN" "\n");
endianness = __BIG_ENDIAN; // 4321
}
return endianness;
}
/* ************************************************************************** */
int minivideo_open(const char *input_filepath,
MediaFile_t **input_media)
{
return import_fileOpen(input_filepath, input_media);
}
int minivideo_close(MediaFile_t **input_media)
{
return import_fileClose(input_media);
}