diff --git a/README.md b/README.md index ca39a73..3b746d2 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ FFMPEG.exe("-version") ffmpeg_exe("-version") ffmpeg_exe(`-version`) ffprobe_exe("-version") # we wrap FFPROBE too! +ffmpeg`-version` # Cmd string macros too +ffprobe`-version` # the AV libraries: FFMPEG.libavcodec FFMPEG.libavformat diff --git a/src/FFMPEG.jl b/src/FFMPEG.jl index ee75ca7..396974f 100644 --- a/src/FFMPEG.jl +++ b/src/FFMPEG.jl @@ -5,7 +5,7 @@ using BinaryProvider const libpath = joinpath(@__DIR__, "..", "deps", "usr", "lib") if Sys.iswindows() - const execenv = ("PATH" => string(libpath,";", Sys.BINDIR)) + const execenv = ("PATH" => string(libpath, ";", Sys.BINDIR)) elseif Sys.isapple() const execenv = ("DYLD_LIBRARY_PATH" => libpath) else @@ -23,7 +23,7 @@ end include(depsjl_path) -av_version(v) = VersionNumber(v>>16,(v>>8)&0xff,v&0xff) +av_version(v) = VersionNumber(v >> 16, (v >> 8) & 0xff, v & 0xff) have_avcodec() = Libdl.dlopen_e(libavcodec) != C_NULL have_avformat() = Libdl.dlopen_e(libavformat) != C_NULL @@ -139,6 +139,24 @@ Execute the given arguments as arguments to the `ffprobe` executable. """ ffprobe_exe(args...) = exe(args...; command = ffprobe) -export ffmpeg_exe, @ffmpeg_env, ffprobe_exe, ffmpeg, ffprobe +""" + ffmpeg\`\` + +Execute the given arguments as arguments to the `ffmpeg` executable. +""" +macro ffmpeg_cmd(arg) + esc(:(ffmpeg_exe($arg))) +end + +""" + ffprobe\`\` + +Execute the given arguments as arguments to the `ffprobe` executable. +""" +macro ffprobe_cmd(arg) + esc(:(ffprobe_exe($arg))) +end + +export ffmpeg_exe, @ffmpeg_env, ffprobe_exe, ffmpeg, ffprobe, @ffmpeg_cmd, @ffprobe_cmd end # module diff --git a/test/runtests.jl b/test/runtests.jl index 93dec7f..fddbd83 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -11,9 +11,11 @@ end @testset "FFMPEG.jl" begin @show FFMPEG.versioninfo() - @test text_execute(()-> FFMPEG.exe("-version")) + @test text_execute(() -> FFMPEG.exe("-version")) @test text_execute(() -> FFMPEG.exe(`-version`)) @test text_execute(() -> FFMPEG.ffmpeg_exe(`-version`)) @test text_execute(() -> FFMPEG.ffprobe_exe(`-version`)) + @test text_execute(() -> ffmpeg`-version`) + @test text_execute(() -> ffprobe`-version`) @test text_execute(() -> @ffmpeg_env run(`$ffmpeg -version`)) end