ARSA Language  2.8
(Encryption, GPU and Web 3.0)
av.h File Reference

Go to the source code of this file.

Functions

void audio (const char *filename)
 just play audio More...
 
void audio (const char *filename, const char *command, const char *option=0)
 play audio with command More...
 
void audio (const char *filename, const char *command, void *function)
 query audio isplaying or not More...
 
void video (const char *filename)
 just play video More...
 
void video (const char *filename, const char *command)
 play video, gif or animated png with command More...
 
void video (const char *filename, const char *command, void *function)
 query video isplaying or not More...
 
void video (const char *filename, const char *command=resize, int width, int height)
 resize video only More...
 
void video (const char *filename, const char *command=playat, const char *layername)
 force video play at psd layer, !!!MUST clearplayat with layer name after you done or exit!!! More...
 

Detailed Description

ARSA Language, audio/video path using ffmpeg,
the function audio/video are a very simple and portable media player using the FFmpeg libraries and the SDL library.It is mostly used as a testbed for the various FFmpeg APIs.
Support file format:
https://ffmpeg.org/general.html#File-Formats
Download ffmpeg sourcecode:
https://ffmpeg.org/download.html#get-sources
ffmpeg license:
https://ffmpeg.org/legal.html

Definition in file av.h.

Function Documentation

◆ audio() [1/3]

void audio ( const char *  filename)

just play audio

Parameters
filenamename of media file want to operator

Example:
audio(win.mp3)

◆ audio() [2/3]

void audio ( const char *  filename,
const char *  command,
const char *  option = 0 
)

play audio with command

Parameters
filenamename of media file want to operator
commandoperator command
play
playonce // stop and go sound just once time, for sound fx that want repeating
pause
stop
clear
load
loop
once
seek // seek offset by percent 0..100, 0 is start, 100 is end

Example:
audio(win.mp3, load) // load audio to memory
audio(win.mp3, play) // play audio
audio(win.mp3, pause) // pause audio
audio(win.mp3, stop) // stop audio
audio(win.mp3, clear) // clear audio memory
audio(win.mp3, playonce) // stop and go audio, once time
audio(win.mp3, loop) // set loop audio playback
audio(win.mp3, once) // set once audio playback
optionmay be boolean that depend on command

◆ audio() [3/3]

void audio ( const char *  filename,
const char *  command,
void *  function 
)

query audio isplaying or not

Parameters
filenamename of media file want to operator
commandoperator command
isplaying
!isplaying

Example:
audio(win.mp3, isplaying, function(foo)) // is playing audio call foo
audio(win.mp3, !isplaying, function(foo)) // is not playing audio call foo
functioncall the function

◆ video() [1/5]

void video ( const char *  filename)

just play video

Function audio is a very simple and portable media player using the FFmpeg libraries and the SDL library. It is mostly used as a testbed for the various FFmpeg APIs. User can watch support file format from https://ffmpeg.org/general.html#File-Formats

Parameters
filenamename of media file want to operator

Example:
video(combo.mp4)

◆ video() [2/5]

void video ( const char *  filename,
const char *  command 
)

play video, gif or animated png with command

Parameters
filenamename of media file want to operator
commandoperator command
play
pause
stop
show
hide
clear
load
loop
once
playat // !!!MUST call clearplayat with layer name after you done or exit!!!
playatresize // macro -> resize texture same psd layer size and call playat.
clearplayat // !!!MUST call when not playing on layer or exit.!!!
resize // specify width, height after. !!!MUST call before playat cmd!!!
seek // seek offset by percent 0..100, 0 is start, 100 is end

Example:
video(combo.mp4, load)
video(combo.mp4, pause)
video(combo.mp4, clear) // remove video from memory, !!!MUST call clearplayat if you call playat before.!!!
video(null, clear) // remove all audio/video from memory, !!!MUST call clearplayat if you call playat before.!!!
video(combo.mp4, seek, 50) // seek as percent 0..100, 0 is start, 100 is end
video(combo.mp4, loop) // loop enable
video(combo.mp4, once) // play one time, loop disable
video(combo.mp4, show, true) // auto show video on screen, true is show, false is hide
video(combo.mp4, hide) // hide video on screen
video(combo.mp4, playat, canvas) // play video on layer in psd
video(combo.mp4, playatresize, canvas) // play video and resize original video to layer in psd
video(combo.mp4, resize, 512, 512) // dimension in pixel to resize original video
{
video(combo.mp4, "clearplayat", canvas) // !!!MUST call clearplayat when exit, if call playat before!!!
}function(deinit)

◆ video() [3/5]

void video ( const char *  filename,
const char *  command,
void *  function 
)

query video isplaying or not

Parameters
filenamename of media file want to operator
commandoperator command
isplaying
!isplaying
functioncall the function
Example:
video(combo.mp4, isplaying, text(10,10,Video is playing!))
video(combo.mp4, !isplaying, text(10,40,Video was stoped!))

◆ video() [4/5]

void video ( const char *  filename,
const char *  command = resize,
int  width,
int  height 
)

resize video only

-1,-1 : full screen (very slow)
0,0 : original size

Parameters
filenamename of media file want to operator
commandresize only
widthnew size of video
heightnew size of video

Example:
video(combo.mp4, resize, -1, -1)

◆ video() [5/5]

void video ( const char *  filename,
const char *  command = playat,
const char *  layername 
)

force video play at psd layer, !!!MUST clearplayat with layer name after you done or exit!!!

Parameters
filenamename of media file want to operator
commandplayat only
layernamename of psd layer that you want to playing video at there.

Example:
video(combo.mp4, playat, vlayer) // !!!MUST clearplayat with layer name after you done or exit!!!
// video(combo.mp4, playatresize, vlayer) // [optional] resize original video size fit to layer size, !!!MUST clearplayat with layer name after you done or exit!!!
{
video(combo.mp4, clearplayat, vlayer)
}deinit()