#Test description:
#	The scripted test application allows plain-text scripts to be written that will invoke movie::Player member functions.

#Build instruction:
#	time nact platforms=NXFP2-a32,NXFP2-a64 specs=NX BUILD=Develop,Release -d Tests/Multimedia/Sources/Tests/MediaPlayerScripted

#Run instruction:
#	Can be run via Visual Studio using the accompanying VS project.
#	or,
#	Tools/CommandLineTools/RunOnTarget Tests/Outputs/NX-NXFP2-a64/Tests/testMultimedia_MediaPlayerScripted/Develop/testMultimedia_MediaPlayerScripted.nca <sdk>Tests/Multimedia/Sources/Tests/MediaPlayerScripted/README <sdk>/Externals/multimedia/data
#	or run from the NintendoTargetManager directly.
#	The first command-line parameter is the absolute path to a script.
#	The optional second command-line parameter is the absolute path to the base directory for relative paths used in the script.

#Pass condition:
#	The APIs for the movie::Player class that return movie::Status are all checked and any that don't succeed trigger a test failure.
#	A malformed script is also a failure.

#Remarks:
#The format of a script is as follows:

#	directive := "CREATE" | "DESTROY" | "EXIT" | "OPEN" | "PLAY" | "SEEK" | "WAIT" | "ECHO" | "CAPTURE" | "VOLUME" | "SPEED" | "RESET" | "STOP" | "PAUSE" | "LOOP" | "TRACK"
#	graphical-character := ? std::isgraph ?
#	whitespace := ? std::isblank ?
#	eol := "\n"
#	parameter := graphical-character, { graphical-character }
#	action := directive, { whitespace }, { whitespace, parameter }
#	comment := '#', { graphical-character | whitespace }
#	line := { whitespace }, [ action | comment ]
#	program := { line, eol }, [ line, [ eol ] ]


#The actions are implemented as follows:

#	Create: takes no parameters; required before most commands, as it allocates and initializes the instance of the player that will be used; if a player instance already exists, it will be destroyed before another is created
#	Destroy: takes no parameters; destroys and deallocates the player instance; not required, as the player will be destroyed if it hasn't already been when the application exits
#	Exit: takes no parameters; ends script execution (useful for skipping the part of the script that follows it)
#	Open: takes one parameter: an absolute path to a media file on the development PC, or a URI; this parameter cannot contain whitespace; a relative path can be used in conjunction with the optional second command-line argument, which will be interpreted as a path prefix, or base directory; internally calls movie::Player::SetDataSource with the parameter, followed immediately by movie::Player::Prepare
#	Play: takes no parameters; internally calls movie::Player::Start
#	Seek: takes one parameter: a relative or absolute playback position; a "+" or "-" prefix indicates a playback position relative to the current; an optional suffix indicates the time units: "f" means frames, "ms" means milliseconds, "s" means seconds; internally calls movie::Player::GetCurrentPosition and movie::Player::SeekTo
#	Wait: takes one optional parameter: a strictly positive time to wait; uses the same time unit suffix as Seek; with no parameter, it will wait for a state change
#	Echo: prints its parameters separated by one space; with no parameters, it prints available state information
#	Capture: takes two parameters: a capture type (video, audio, both), and an absolute path to save the capture to
#	Volume: takes one optional parameter: the absolute or relative volume to set, expressed as a whole number between 0 and 100, an optional sign prefix is interpreted as for Seek; with no parameter, prints the current volume; internally calls movie::Player::GetVolume and movie::Player::SetVolume
#	Speed: takes one optional parameter: the playback rate, expressed as a real number between 0.25 and 2.0, an optional sign prefix is interpreted as for Seek; with no parameter, prints the current playback rate; internally calls movie::Player::GetPlaybackRate and movie::Player::SetPlaybackRate. Note that the available rates are limited and the specified rate will be rounded down and capped
#	Reset: takes no parameters; internally calls movie::Player::Reset
#	Stop: takes no parameters; internally calls movie::Player::Stop
#	Pause: takes one optional parameter: "on" or "off"; with no parameter, toggles the pause state; internally calls movie::Player::Pause and movie::Player::GetState
#	Loop: takes one optional parameter: "on or "off"; with no parameter, turns looping on; internally calls movie::Player::SetLooping
# Track: takes two parameters: a zero-based track number, and "on or "off"; internally calls movie::Player::SelectTrack​ and ​movie::Player::DeselectTrack


#Example (2nd command-line parameter is "<sdk>/Externals/multimedia/data"):

CREATE
OPEN mp4/5s_h264_1080x1920_5_1_aac_2ch.mp4
ECHO
PLAY
WAIT

ECHO done
EXIT
