% @version 0.0.1 % % @doc % Generic encoder behavior % %
% vice_utils:find_tools([ffmpeg, ffprobe], video).
% % => {state, [{ffmpeg, "/usr/bin/ffmpeg"}, {ffprobe, "/usr/bin/ffprobe"}]}
%
%
% The second parameter for vice_utils:find_tools/2 allow you to add
% an alternative configurtion. In the above example, if VICE can't find
% ffprobe for example, using this second parameter, it will this to find an
% alternative path in the configuration. For example, if you put something like that
% in your .config file :
%
%
% {video, [
% {ffprobe, "/opt/ffmpeg/bin/ffprobe"}
% ]}
%
%
% So, vice_utils:find_tools([ffmpeg, ffprobe], video) will return
% {state, [{ffmpeg, "/usr/bin/ffmpeg"}, {ffprobe, "/opt/ffmpeg/bin/ffprobe"}]}.
%
% If vice_utils:find_tools/2 can't find (at least) one executable, it will return
% an error : {error, {App :: atom(), not_found}}.
%
% % For now, VICE only support encoder using command line tools. %% %
% {vice, [
% ...
% {encoders, [
% {video, [vice_prv_ffmpeg]},
% {image, [vice_prv_imagemagick]},
% {audio, [vice_prv_sox]}
% ]},
% ...
% }
%
%
% So if you create a new audio encoder, you must add it to the
% audio list :
%
%
% {vice, [
% ...
% {encoders, [
% {audio, [my_custom_audio_encoder, vice_prv_sox]}
% ]},
% ...
% }
%
%
% In such case, VICE will try to load my_custom_audio_encoder.
% If my_custom_audio_encoder:init/0 return {ok, State :: term()}
% it will not try to load vice_prv_sox. So my_custom_audio_encoder
% will be used for all audio encoding. If my_custom_audio_encoder:init/0
% return {error, Reason :: term()} VICE will try to load
% vice_prv_sox and if it succed, vice_prv_sox will be used for
% all audio encoding ; if not, VICE will not allow you to encode audio files.
%
% % When you change the configuration, if you do not specified a list of encoders for % a type, VICE will use its default list for this type. %% @end -module(vice_encoder). -type sofar() :: {Duration :: float(), Time :: float(), Percent :: float()}. -callback init() -> {ok, State :: term()} | {stop, Reason :: term()}. -callback infos(State :: term(), File :: file:filename_all(), Options :: list()) -> {ok, Result :: map()} | {error, Reason :: term()}. -callback info(State :: term(), File :: file:filename_all(), Info :: atom(), Options :: list()) -> {ok, Result :: term()} | {error, Reason :: term()}. -callback command(State :: term(), In :: file:filename_all(), Out :: file:filename_all(), Options :: list(), Multi :: true | false) -> {ok, Command :: string()} | {error, Reason :: term()}. -callback progress(Bytes :: string(), Sofar :: sofar()) -> Sofar0 :: sofar().