/* TheorafileGMS - YUV decoder for Game Maker
 *
 * Copyright (c) 2021 Evan Hemsley
 *
 * This software is provided 'as-is', without any express or implied warranty.
 * In no event will the authors be held liable for any damages arising from
 * the use of this software.
 *
 * Permission is granted to anyone to use this software for any purpose,
 * including commercial applications, and to alter it and redistribute it
 * freely, subject to the following restrictions:
 *
 * 1. The origin of this software must not be misrepresented; you must not
 * claim that you wrote the original software. If you use this software in a
 * product, an acknowledgment in the product documentation would be
 * appreciated but is not required.
 *
 * 2. Altered source versions must be plainly marked as such, and must not be
 * misrepresented as being the original software.
 *
 * 3. This notice may not be removed or altered from any source distribution.
 *
 * Evan "cosmonaut" Hemsley <evan@moonside.games>
 *
 */

#ifndef THEORAFILEGMS_H
#define THEORAFILEGMS_H

#ifdef _WIN32
#define THEORAFILEGMSAPI __declspec(dllexport)
#define THEORAFILEGMSCALL __cdecl
#else
#define THEORAFILEGMSAPI
#define THEORAFILEGMSCALL
#endif

#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */

	/* return a file ID pointer. must use ptr() on GML side! */
	THEORAFILEGMSAPI char* TheorafileGMS_Open(char* filename);
	THEORAFILEGMSAPI void TheorafileGMS_Close(char* filePointer);
	THEORAFILEGMSAPI void TheorafileGMS_Reset(char* filePointer);

	THEORAFILEGMSAPI double TheorafileGMS_HasVideo(char* filePointer);
	THEORAFILEGMSAPI double TheorafileGMS_Width(char* filePointer);
	THEORAFILEGMSAPI double TheorafileGMS_Height(char* filePointer);
	THEORAFILEGMSAPI double TheorafileGMS_UVWidth(char* filePointer);
	THEORAFILEGMSAPI double TheorafileGMS_UVHeight(char* filePointer);
	THEORAFILEGMSAPI double TheorafileGMS_FPS(char* filePointer);
	THEORAFILEGMSAPI double TheorafileGMS_RequiredBufferSizeInBytes(char* filePointer);
	THEORAFILEGMSAPI double TheorafileGMS_EndOfStream(char* filePointer);

	/* returns whether a texture update is needed or not */
	THEORAFILEGMSAPI double TheorafileGMS_ReadVideo(char* filePointer, char* buffer, double numFrames); 

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* THEORAFILEGMS_H */
