#include "library_base.h"
#include "compiler.h"

#define AQuote(string) #string								/* Put quotes around the whole thing */
#define AVersion(major,minor) AQuote(major ## . ## minor)	/* Concatenate the two version-numbers */
#define AmVersion(major,minor) AVersion(major,minor)		/* We need to do it this way to elimate the blank spaces */

#define LIB_NAME	"mpega.library"
#define LIB_VERSION	2
#define LIB_REVISION	4
#define LIB_DATE	"(23.06.02)"

#ifndef LIBCPU
	#if defined(BUILD_POWERUP)
		#define LIBCPU " [PowerUP]"
	#elif defined(BUILD_WARPUP)
		#define LIBCPU " [WarpOS]"
	#elif defined(BUILD_MORPHOS)
		#define LIBCPU " [MorphOS]"
	#else
		#if defined(_M68060) || defined(mc68060)
			#if defined(_M68881) || defined(__HAVE_68881__)
				#define LIBCPU " [060/FPU]"
			#else
				#define LIBCPU " [060]"
			#endif
		#elif defined(_M68040) || defined(mc68040)
			#if defined(_M68881) || defined(__HAVE_68881__)
				#define LIBCPU " [040/FPU]"
			#else
				#define LIBCPU " [040]"
			#endif
		#elif defined(_M68030) || defined(mc68030)
			#if defined(_M68881) || defined(__HAVE_68881__)
				#define LIBCPU " [030/FPU]"
			#else
				#define LIBCPU " [030]"
			#endif
		#elif defined(_M68020) || defined(mc68020)
			#if defined(_M68881) || defined(__HAVE_68881__)
				#define LIBCPU " [020/FPU]"
			#else
				#define LIBCPU " [020]"
			#endif
		#else
			#define LIBCPU
		#endif
	#endif
#endif

#define LIB_ID LIB_NAME " " AmVersion(LIB_VERSION,LIB_REVISION) " " LIB_DATE LIBCPU " mpega.library clone by Sigbjørn (CISC) Skjæret, using libmad - Copyright (C) 2000-2001 Robert Leslie"


#include <libraries/mpega.h>

#ifdef __MORPHOS__
struct Library *LibInit(struct PrivateBase *PrivateBase, BPTR SegList, struct ExecBase *sysbase);
struct Library *LIB_Open(void);
BPTR LIB_Close(void);
BPTR LIB_Expunge(void);

MPEGA_STREAM *LIB_MPEGA_open(void);
void LIB_MPEGA_close(void);
LONG LIB_MPEGA_decode_frame(void);
LONG LIB_MPEGA_seek(void);
LONG LIB_MPEGA_time(void);
LONG LIB_MPEGA_find_sync(void);
LONG LIB_MPEGA_scale(void);
#else
struct Library * ASM LibInit(REG(d0, struct PrivateBase *PrivateBase), REG(a0, BPTR SegList), REG(a6, struct ExecBase *sysbase));
struct Library * ASM LIB_Open(REG(a6, struct PrivateBase *PrivateBase));
BPTR ASM LIB_Close(REG(a6, struct PrivateBase *PrivateBase));
BPTR ASM LIB_Expunge(REG(a6, struct PrivateBase *PrivateBase));

MPEGA_STREAM * LIB LIB_MPEGA_open(REG(a0, char *stream_name), REG(a1, MPEGA_CTRL *ctrl), REG(a6, struct PrivateBase *PrivateBase));
void LIB LIB_MPEGA_close(REG(a0, MPEGA_STREAM *mpega_stream), REG(a6, struct PrivateBase *PrivateBase));
LONG LIB LIB_MPEGA_decode_frame(REG(a0, MPEGA_STREAM *mpega_stream), REG(a1, WORD **pcm), REG(a6, struct PrivateBase *PrivateBase));
LONG LIB LIB_MPEGA_seek(REG(a0, MPEGA_STREAM *mpega_stream), REG(d0, ULONG ms_time_position), REG(a6, struct PrivateBase *PrivateBase));
LONG LIB LIB_MPEGA_time(REG(a0, MPEGA_STREAM *mpega_stream), REG(a1, ULONG *ms_time_position), REG(a6, struct PrivateBase *PrivateBase));
LONG LIB LIB_MPEGA_find_sync(REG(a0, UBYTE *buffer), REG(d0, LONG buffer_size), REG(a6, struct PrivateBase *PrivateBase));
LONG LIB LIB_MPEGA_scale(REG(a0, MPEGA_STREAM *mpega_stream), REG(d0, LONG scale_percent), REG(a6, struct PrivateBase *PrivateBase));
#endif
