Initial community commit

This commit is contained in:
Jef
2024-09-24 14:54:57 +02:00
parent 537bcbc862
commit 20d28e80a5
16810 changed files with 4640254 additions and 2 deletions

View File

@ -0,0 +1,340 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2000-2005. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
* Bill May wmay@cisco.com
*/
#ifndef __MPEG4IP_INCLUDED__
#define __MPEG4IP_INCLUDED__
/* project wide applicable stuff here */
#ifndef _WIN32
#ifdef PACKAGE_BUGREPORT
#define TEMP_PACKAGE_BUGREPORT PACKAGE_BUGREPORT
#define TEMP_PACKAGE_NAME PACKAGE_NAME
#define TEMP_PACKAGE_STRING PACKAGE_STRING
#define TEMP_PACKAGE_TARNAME PACKAGE_TARNAME
#define TEMP_PACKAGE_VERSION PACKAGE_VERSION
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#include <mpeg4ip_config.h>
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#define PACKAGE_BUGREPORT TEMP_PACKAGE_BUGREPORT
#define PACKAGE_NAME TEMP_PACKAGE_NAME
#define PACKAGE_STRING TEMP_PACKAGE_STRING
#define PACKAGE_TARNAME TEMP_PACKAGE_TARNAME
#define PACKAGE_VERSION TEMP_PACKAGE_VERSION
#else
#include <mpeg4ip_config.h>
#endif
#endif
// the mpeg4ip_package and mpeg4ip_version are always in this
// file
#include "mpeg4ip_version.h"
#ifdef _WIN32
#include "mpeg4ip_win32.h"
#include "mpeg4ip_version.h"
#include "stdint.h"
#else /* UNIX */
/*****************************************************************************
* UNIX LIKE DEFINES BELOW THIS POINT
*****************************************************************************/
#ifdef sun
#include <sys/feature_tests.h>
#endif
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#else
#ifndef sun
#if _FILE_OFFSET_BITS < 64
#error File offset bits is already set to non-64 value
#endif
#endif
#endif
#ifndef _LARGEFILE_SOURCE
#define _LARGEFILE_SOURCE
#endif
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#if !defined(HAVE_INTTYPES_H) && !defined(HAVE_STDINT_H)
#error "Don't have stdint.h or inttypes.h - no way to get uint8_t"
#endif
#include <unistd.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <syslog.h>
#include <string.h>
#include <ctype.h>
#include <netdb.h>
#include <sys/stat.h>
#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif
#include <sys/param.h>
#ifdef __cplusplus
extern "C" {
#endif
char *strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif
#define OPEN_RDWR O_RDWR
#define OPEN_CREAT O_CREAT
#define OPEN_RDONLY O_RDONLY
#define closesocket close
#define IOSBINARY ios::bin
#if SIZEOF_LONG == 8
#define MAX_UINT64 -1LU
#define D64F "ld"
#define U64F "lu"
#define X64F "lx"
#define TO_D64(a) (a##L)
#define TO_U64(a) (a##LU)
#else
#define MAX_UINT64 -1LLU
#define D64F "lld"
#define U64F "llu"
#define X64F "llx"
#define TO_D64(a) (a##LL)
#define TO_U64(a) (a##LLU)
#endif
#ifdef HAVE_FPOS_T___POS
#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)((fpos).__pos)
#define VAR_TO_FPOS(fpos, var) (fpos).__pos = (var)
#else
#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)(fpos)
#define VAR_TO_FPOS(fpos, var) (fpos) = (var)
#endif
#define FOPEN_READ_BINARY "r"
#define FOPEN_WRITE_BINARY "w"
#define UINT64_TO_DOUBLE(a) ((double)(a))
#endif /* define unix */
/*****************************************************************************
* Generic type includes used in the whole package *
*****************************************************************************/
#define D64 "%"D64F
#define U64 "%"U64F
#define X64 "%"X64F
#define M_LLU TO_U64(1000)
#define M_64 TO_U64(1000)
#define LLU U64
#include <stdarg.h>
typedef void (*error_msg_func_t)(int loglevel,
const char *lib,
const char *fmt,
va_list ap);
typedef void (*lib_message_func_t)(int loglevel,
const char *lib,
const char *fmt,
...);
#ifndef HAVE_IN_PORT_T
typedef uint16_t in_port_t;
#endif
#ifndef HAVE_SOCKLEN_T
typedef unsigned int socklen_t;
#endif
#ifdef sun
#include <limits.h>
#define u_int8_t uint8_t
#define u_int16_t uint16_t
#define u_int32_t uint32_t
#define u_int64_t uint64_t
#define __STRING(expr) #expr
#endif
#ifndef HAVE_STRSEP
#ifdef __cplusplus
extern "C" {
#endif
char *strsep(char **strp, const char *delim);
#ifdef __cplusplus
}
#endif
#endif
#ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
#ifndef INADDR_NONE
#define INADDR_NONE (-1)
#endif
#define MALLOC_STRUCTURE(a) ((a *)malloc(sizeof(a)))
#define CHECK_AND_FREE(a) if ((a) != NULL) { free((void *)(a)); (a) = NULL;}
#define NUM_ELEMENTS_IN_ARRAY(name) ((sizeof((name))) / (sizeof(*(name))))
#define ADV_SPACE(a) {while (isspace(*(a)) && (*(a) != '\0'))(a)++;}
#ifndef HAVE_GTK
typedef char gchar;
typedef unsigned char guchar;
typedef int gint;
typedef unsigned int guint;
typedef long glong;
typedef unsigned long gulong;
typedef double gdouble;
typedef int gboolean;
typedef int16_t gint16;
typedef uint16_t guint16;
typedef int32_t gint32;
typedef uint32_t guint32;
typedef int64_t gint64;
typedef uint64_t guint64;
typedef uint8_t guint8;
typedef int8_t gint8;
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef __cplusplus
#ifndef bool
#if SIZEOF_BOOL == 8
typedef uint64_t bool;
#else
#if SIZEOF_BOOL == 4
typedef uint32_t bool;
#else
#if SIZEOF_BOOL == 2
typedef uint16_t bool;
#else
typedef unsigned char bool;
#endif
#endif
#endif
#ifndef false
#define false FALSE
#endif
#ifndef true
#define true TRUE
#endif
#endif
#endif
#ifndef ROUND
# ifdef HAVE_RINT
# define ROUND(f) rint(f)
# else
# define ROUND(f) (int)(floor((f) + 0.5))
# endif
#endif
#ifndef INT16_MAX
# define INT16_MAX (32767)
#endif
#ifndef INT16_MIN
# define INT16_MIN (-32767-1)
#endif
#ifndef UINT32_MAX
# define UINT32_MAX (4294967295U)
#endif
#ifndef UINT64_MAX
# define UINT64_MAX TO_U64(0xffffffffffffffff)
#endif
typedef enum audio_format_t {
AUDIO_FMT_U8 = 0,
AUDIO_FMT_S8,
AUDIO_FMT_U16LSB,
AUDIO_FMT_S16LSB,
AUDIO_FMT_U16MSB,
AUDIO_FMT_S16MSB,
AUDIO_FMT_U16,
AUDIO_FMT_S16,
AUDIO_FMT_FLOAT,
AUDIO_FMT_HW_AC3,
} audio_format_t;
#ifdef _WIN32
#define MP4_FILENAME_CHAR wchar_t
#else
#define MP4_FILENAME_CHAR char
#endif
#endif /* __MPEG4IP_INCLUDED__ */

View File

@ -0,0 +1,89 @@
/**
* Copyright (C) 2000, 2001 Billy Biggs <vektor@dumbterm.net>,
* Han Hjort <d95hjort@dtek.chalmers.se>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef BSWAP_H_INCLUDED
#define BSWAP_H_INCLUDED
#ifdef _WIN32
#include <config.h>
#endif
#if defined(WORDS_BIGENDIAN)
/* All bigendian systems are fine, just ignore the swaps. */
#define B2N_16(x) (x)
#define B2N_32(x) (x)
#define B2N_64(x) (x)
#else
#if defined(__linux__)
#include <byteswap.h>
#define B2N_16(x) x = bswap_16(x)
#define B2N_32(x) x = bswap_32(x)
#define B2N_64(x) x = bswap_64(x)
#elif defined(__NetBSD__)
#include <sys/endian.h>
#define B2N_16(x) BE16TOH(x)
#define B2N_32(x) BE32TOH(x)
#define B2N_64(x) BE64TOH(x)
#elif defined(__OpenBSD__)
#include <sys/endian.h>
#define B2N_16(x) x = swap16(x)
#define B2N_32(x) x = swap32(x)
#define B2N_64(x) x = swap64(x)
/* This is a slow but portable implementation, it has multiple evaluation
* problems so beware.
* FreeBSD and Solaris don't have <byteswap.h> or any other such
* functionality!
*/
#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(_WIN32)
#define B2N_16(x) \
x = ((((x) & 0xff00) >> 8) | \
(((x) & 0x00ff) << 8))
#define B2N_32(x) \
x = ((((x) & 0xff000000) >> 24) | \
(((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | \
(((x) & 0x000000ff) << 24))
#define B2N_64(x) \
x = ((((x) & 0xff00000000000000) >> 56) | \
(((x) & 0x00ff000000000000) >> 40) | \
(((x) & 0x0000ff0000000000) >> 24) | \
(((x) & 0x000000ff00000000) >> 8) | \
(((x) & 0x00000000ff000000) << 8) | \
(((x) & 0x0000000000ff0000) << 24) | \
(((x) & 0x000000000000ff00) << 40) | \
(((x) & 0x00000000000000ff) << 56))
#else
/* If there isn't a header provided with your system with this functionality
* add the relevant || define( ) to the portable implementation above.
*/
#error "You need to add endian swap macros for you're system"
#endif
#endif /* WORDS_BIGENDIAN */
#endif /* BSWAP_H_INCLUDED */

View File

@ -0,0 +1,156 @@
#ifdef WIN32
#define HAVE_IN_PORT_T
#define HAVE_SOCKLEN_T
#define __STDC__ 1
#else
#include "mpeg4ip.h"
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(HAVE_GETOPT) && !defined(HAVE_GETOPT_LONG) && !defined(HAVE_GETOPT_LONG_ONLY)
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
extern int opterr;
/* Set to an option character which was unrecognized. */
extern int optopt;
#endif
#if !defined(HAVE_GETOPT_LONG) && !defined(HAVE_GETOPT_LONG_ONLY)
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
zero.
The field `has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to
a compiled-in constant, such as set a value from `optarg', set the
option's `flag' field to zero and its `val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
struct option
{
# if defined __STDC__ && __STDC__
const char *name;
# else
char *name;
# endif
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the `has_arg' field of `struct option'. */
#ifndef no_argument
# define no_argument 0
# define required_argument 1
# define optional_argument 2
#endif
#endif /* no HAVE_GETOPT defines */
#ifndef HAVE_GETOPT
/* Get definitions and prototypes for functions to process the
arguments in ARGV (ARGC of them, minus the program name) for
options given in OPTS.
Return the option character from OPTS just read. Return -1 when
there are no more options. For unrecognized options, or options
missing arguments, `optopt' is set to the option letter, and '?' is
returned.
The OPTS string is a list of characters which are recognized option
letters, optionally followed by colons, specifying that that letter
takes an argument, to be placed in `optarg'.
If a letter in OPTS is followed by two colons, its argument is
optional. This behavior is specific to the GNU `getopt'.
The argument `--' causes premature termination of argument
scanning, explicitly telling `getopt' that there are no more
options.
If OPTS begins with `--', then non-option arguments are treated as
arguments to the option '\0'. This behavior is specific to the GNU
`getopt'. */
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts);
#endif /* HAVE_GETOPT */
#ifndef HAVE_GETOPT_LONG
extern int getopt_long (int ___argc, char *const *___argv, const char *__shortopts,
const struct option *__longopts, int *__longind);
#endif /* HAVE_GETOPT_LONG */
#ifndef HAVE_GETOPT_LONG_ONLY
extern int getopt_long_only (int ___argc, char *const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind);
#endif /* HAVE_GETOPT_LONG */
#if !defined(HAVE_GETOPT) || !defined(HAVE_GETOPT_LONG) || !defined(HAVE_GETOPT_LONG_ONLY)
extern int _getopt_internal (int ___argc, char *const *argv,
const char *optstring,
const struct option *longopts,
int *longind, int long_only);
#endif
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,6 @@
#define MPEG4IP_PACKAGE "mpeg4ip"
#define MPEG4IP_VERSION "1.5"
#define MPEG4IP_MAJOR_VERSION 0x1
#define MPEG4IP_MINOR_VERSION 0x5
#define MPEG4IP_CVS_VERSION 0x
#define MPEG4IP_HEX_VERSION ((MPEG4IP_MAJOR_VERSION << 16) | (MPEG4IP_MINOR_VERSION << 8) | MPEG4IP_CVS_VERSION)

View File

@ -0,0 +1,141 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2005. All Rights Reserved.
*
* Contributor(s):
* Bill May wmay@cisco.com
*/
/* windows defines */
#ifndef __MPEG4IP_WIN32_H__
#define __MPEG4IP_WIN32_H__
#define HAVE_IN_PORT_T
#define HAVE_SOCKLEN_T
#define NEED_SDL_VIDEO_IN_MAIN_THREAD
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock2.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#ifdef __GNUC__
#include <stdint.h>
#include <ctype.h>
typedef uint64_t u_int64_t;
typedef uint32_t u_int32_t;
typedef uint16_t u_int16_t;
typedef uint8_t u_int8_t;
#else
#include <bfc/platform/types.h>
typedef unsigned __int64 u_int64_t;
typedef unsigned __int32 u_int32_t;
typedef unsigned __int16 u_int16_t;
typedef unsigned __int8 u_int8_t;
typedef unsigned short in_port_t;
typedef int socklen_t;
typedef unsigned int uint;
#define snprintf _snprintf
#define strncasecmp _strnicmp
#ifndef strcasecmp
#define strcasecmp _stricmp
#endif
#endif
#include <io.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
//#define write _write
#define close _close
#define open _open
#define access _access
#define vsnprintf _vsnprintf
#define stat _stati64
#define fstat _fstati64
#define F_OK 0
#define OPEN_RDWR (_O_RDWR | _O_BINARY)
#define OPEN_CREAT (_O_CREAT | _O_BINARY)
#define OPEN_RDONLY (_O_RDONLY | _O_BINARY)
#define srandom srand
#define random rand
#define IOSBINARY ios::binary
#ifdef __cplusplus
extern "C" {
#endif
int gettimeofday(struct timeval *t, void *);
#ifdef __cplusplus
}
#endif
#undef PATH_MAX
#define PATH_MAX MAX_PATH
#define MAX_UINT64 -1
#ifdef __GNUC__
#define D64F "lld"
#define U64F "llu"
#define X64F "llx"
#define TO_D64(a) (a##LL)
#define TO_U64(a) (a##LLU)
#else
#define D64F "I64d"
#define U64F "I64u"
#define X64F "I64x"
#define TO_D64(a) (a##I64)
#define TO_U64(a) (a##UI64)
#endif
#define LOG_EMERG 0
#define LOG_ALERT 1
#define LOG_CRIT 2
#define LOG_ERR 3
#define LOG_WARNING 4
#define LOG_NOTICE 5
#define LOG_INFO 6
#define LOG_DEBUG 7
#if defined(__GNUC__) || (!__STDC__ && _INTEGRAL_MAX_BITS >= 64)
#define VAR_TO_FPOS(fpos, var) (fpos) = (var)
#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)(fpos)
#else
#define VAR_TO_FPOS(fpos, var) (fpos).lopart = ((var) & UINT_MAX); (fpos).hipart = ((var) >> 32)
#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)((uint64_t)((fpos).hipart ) << 32 | (fpos).lopart)
#endif
#define __STRING(expr) #expr
#define FOPEN_READ_BINARY "rb"
#define FOPEN_WRITE_BINARY "wb"
#define UINT64_TO_DOUBLE(a) ((double)((int64_t)(a)))
#ifdef __cplusplus
extern "C" {
#endif
char *strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif
#define SIZEOF_BOOL 1
#endif