#******************************************************************************
#
# Copyright:   2018-2020 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: Tcl module with query procedures related to
#              the FFMPEG module.
#
#******************************************************************************

namespace eval mawt {
    variable ns [namespace current]

    namespace ensemble create

    namespace export GetVersion
    namespace export GetFfmpegVersion

    namespace export GetErrorMessage

    namespace export SetDebugMode

    variable _MawtIntro {
        # MAWT - Movie Automation With Tcl

        `MAWT` offers parts of the video functionality of [FFmpeg](http://www.ffmpeg.org/)
        at the [Tcl](http://www.tcl-lang.org/) scripting level.
        This is accomplished by wrapping parts of the FFmpeg library with
        the help of [SWIG](http://www.swig.org/).

        Important links:
        * [MAWT homepage](http://www.mawt.tcl3d.org)
        * [BAWT homepage](http://www.bawt.tcl3d.org)
    }

    proc GetVersion {} {
        # Get MAWT library version string.
        #
        # Returns the version of the MAWT library as a string.
        # The version is returned as `Major.Minor.Patch`.
        #
        # See also: GetFfmpegVersion SetDebugMode GetErrorMessage

        return [mawtlib::MawtGetVersion]
    }

    proc GetFfmpegVersion {} {
        # Get FFMPEG library version string.
        #
        # Returns the version of the wrapped FFMPEG library as a string.
        # The version is returned as `Major.Minor.Patch`.
        #
        # See also: GetVersion SetDebugMode GetErrorMessage

        return [mawtlib::MawtGetFfmpegVersion]
    }

    proc GetErrorMessage {} {
        # Get the last error message issued by MAWT.
        #
        # See also: GetFfmpegVersion GetVersion SetDebugMode

        return [mawtlib::MawtGetErrorMessage]
    }

    proc SetDebugMode { onOff } {
         # Enable or disable the debug mode of the MAWT library.
         #
         # onOff - Boolean value to enable or disable the debug mode.
         #
         # See also: GetFfmpegVersion GetVersion GetErrorMessage

         mawtlib::MawtSetDebugMode [expr {bool($onOff)}]
    }
}
