/******************************************************************************
 *{@C
 * Copyright:   2018-2022 Paul Obermeier (obermeier@poSoft.de)
 *
 *              See the file "Mawt_License.txt" for information on
 *              usage and redistribution of this file, and for a
 *              DISCLAIMER OF ALL WARRANTIES.
 *
 * Description: Declarations for video related functions.
 *              The structures and functions in this file are
 *              wrapped by SWIG.
 *
 *****************************************************************************/

#ifndef __MAWTLIB_H__
#define __MAWTLIB_H__

#ifndef Bool
    typedef unsigned int Bool;
#endif

typedef unsigned int VideoSeekEnum;
#define VIDEO_SEEK_ABS      0
#define VIDEO_SEEK_FORWARD  1
#define VIDEO_SEEK_BACKWARD 2
#define VIDEO_SEEK_END      3

typedef struct videoStruct *VideoId;

#ifdef __cplusplus
   extern "C" {
#endif

    VideoId MawtVideoOpen  (const char *fileName);
    void    MawtVideoClose (VideoId videoId);

    int     MawtVideoStart (VideoId videoId, int width, int height);
    void    MawtVideoStop  (VideoId videoId);

    Bool MawtVideoGetNextImage (VideoId videoId, void *img, Bool flip);
    Bool MawtVideoGetImage     (VideoId videoId, void *img, Bool flip, unsigned int num);

    int     MawtVideoGetNumFrames  (VideoId videoId);
    double  MawtVideoGetFramerate  (VideoId videoId);
    unsigned int MawtVideoGetPts   (VideoId videoId);
    int     MawtVideoGetWidth      (VideoId videoId);
    int     MawtVideoGetHeight     (VideoId videoId);

    void    MawtVideoLock         (VideoId videoId);
    void    MawtVideoUnlock       (VideoId videoId);

    int     MawtGetDebugMode  (void);
    void    MawtSetDebugMode  (int debugMode);

    const char *MawtGetErrorMessage (void);
    const char *MawtGetVersion (void);
    const char *MawtGetFfmpegVersion (void);

    VideoId MawtVideoCreate(const char * fileName, int width, int height, int fps, float bitrate);
    Bool    MawtVideoFinish(VideoId videoId);
    Bool    MawtVideoWriteNextImage(VideoId videoId, void *img, int width, int height, Bool flip);

#ifdef __cplusplus
   }
#endif

#endif /* __MAWTLIB_H__ */
