diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d8fde888..383abe31 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,13 +9,17 @@ on: jobs: test: + # needed to allow julia-actions/cache to delete old caches that it has created + permissions: + actions: write + contents: read runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macOS-latest] julia-arch: [x64, x86] - julia-version: ['1.6','1','1.9-nightly','nightly'] + julia-version: ['1.6','1','1.10-nightly','nightly'] exclude: - os: macOS-latest julia-arch: x86 @@ -25,6 +29,7 @@ jobs: - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.julia-version }} + - uses: julia-actions/cache@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v3 diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml index e2ac5d45..56e67822 100644 --- a/.github/workflows/Documentation.yml +++ b/.github/workflows/Documentation.yml @@ -10,12 +10,17 @@ on: jobs: build: + # needed to allow julia-actions/cache to delete old caches that it has created + permissions: + actions: write + contents: read runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@latest + - uses: julia-actions/setup-julia@v1 with: version: 1 + - uses: julia-actions/cache@v1 - name: Install dependencies run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' - name: Build and deploy diff --git a/.gitignore b/.gitignore index 77aa18db..686b804b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,7 @@ deps/deps.jl deps/deps_codec.jl deps/build.log .DS_Store -videos/* Manifest.toml -deps/build_* test/precisiontest_gray_test.mp4 test/ordertest_gray_test.mp4 docs/build/ diff --git a/Project.toml b/Project.toml index 9d506a41..4682845c 100644 --- a/Project.toml +++ b/Project.toml @@ -14,6 +14,7 @@ Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca" Requires = "ae029012-a4dd-5104-9daa-d747884805df" +Scratch = "6c6a2e73-6563-6170-7368-637461726353" [compat] ColorTypes = "0.9, 0.10, 0.11" @@ -25,4 +26,5 @@ ImageCore = "0.8, 0.9, 0.10" PrecompileTools = "1" ProgressMeter = "1.2" Requires = "1.0" +Scratch = "1" julia = "1.6" diff --git a/docs/Project.toml b/docs/Project.toml index dfa65cd1..1814eb33 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,2 +1,5 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" + +[compat] +Documenter = "1" diff --git a/docs/make.jl b/docs/make.jl index 8f1ec84f..7be90aba 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -16,5 +16,6 @@ makedocs( "Low Level Functionality"=>"lowlevel.md", "Index"=>"functionindex.md", ], + warnonly = :missing_docs, ) deploydocs(repo = "github.com/JuliaIO/VideoIO.jl.git", push_preview = true) diff --git a/docs/src/writing.md b/docs/src/writing.md index ea51c9f2..2812cd75 100644 --- a/docs/src/writing.md +++ b/docs/src/writing.md @@ -61,7 +61,7 @@ VideoIO.open_video_out ``` ```@docs -VideoIO.write +Base.write(writer::VideoIO.VideoWriter, img, index::Int) ``` ```@docs diff --git a/src/encoding.jl b/src/encoding.jl index 5bac1bc5..e3222511 100644 --- a/src/encoding.jl +++ b/src/encoding.jl @@ -396,7 +396,7 @@ key of `VideoIO.VIO_DEF_ELTYPE_PIX_FMT_LU`, or instead the `Normed` or `Unsigned` type for a corresponding `Gray` element type. The container type will be inferred from `filename`. -Frames are encoded with[ `write`](@ref), which must use frames with +Frames are encoded with [`write`](@ref), which must use frames with the same size, element type, and obey the same value of `scanline_major`. The video must be closed once all frames are encoded with [`close_video_out!`](@ref). diff --git a/src/testvideos.jl b/src/testvideos.jl index 0cae5217..dd7140bd 100644 --- a/src/testvideos.jl +++ b/src/testvideos.jl @@ -1,13 +1,27 @@ -# Tools for downloading test videos +""" + VideoIO.TestVideos + +Tools for downloading test videos +* `VideoIO.TestVideos.available()` prints a list of all available test videos. +* `VideoIO.testvideo("annie_oakley")` returns an AVInput object for the + "annie_oakley" video. The video will be downloaded if it isn't available. +* `VideoIO.TestVideos.download_all()` downloads all test videos +* `VideoIO.TestVideos.remove_all()` removes all test videos +""" module TestVideos using VideoIO: VideoIO import Base: show import Downloads: download +using Scratch export testvideo -videodir = joinpath(dirname(@__FILE__), "..", "videos") +videodir = "" + +function __init__() + global videodir = @get_scratch!("videos") +end mutable struct VideoFile{compression} name::AbstractString @@ -117,19 +131,20 @@ const videofiles = Dict( 1, 4816, ), - "Big_Buck_Bunny_360_10s_1MB.mp4" => VideoFile( - "Big_Buck_Bunny_360_10s_1MB.mp4", - "Big Buck Bunny", - "Creative Commons: By Attribution 3.0 Unported (http://creativecommons.org/licenses/by/3.0/deed)", - "Credit: Blender Foundation | www.blender.org", - "https://peach.blender.org/", - "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4", - 300, - 2, - 207376840, - # Can be also 30000/1001 - 30 // 1, - ), + # # This has started HTTP 526 erroring + # "Big_Buck_Bunny_360_10s_1MB.mp4" => VideoFile( + # "Big_Buck_Bunny_360_10s_1MB.mp4", + # "Big Buck Bunny", + # "Creative Commons: By Attribution 3.0 Unported (http://creativecommons.org/licenses/by/3.0/deed)", + # "Credit: Blender Foundation | www.blender.org", + # "https://peach.blender.org/", + # "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4", + # 300, + # 2, + # 207376840, + # # Can be also 30000/1001 + # 30 // 1, + # ), ) """ diff --git a/test/reading.jl b/test/reading.jl index cd84cc5f..672d4a0c 100644 --- a/test/reading.jl +++ b/test/reading.jl @@ -4,7 +4,7 @@ name = testvid.name test_frameno = testvid.testframe @testset "Reading $(testvid.name)" begin - testvid_path = joinpath(@__DIR__, "../videos", name) + testvid_path = joinpath(VideoIO.TestVideos.videodir, name) comparison_frame = make_comparison_frame_png(load, testvid_path, test_frameno) f = VideoIO.testvideo(testvid_path) v = VideoIO.openvideo(f; swscale_options=swscale_options) @@ -157,7 +157,7 @@ end @memory_profile @testset "Reading monochrome videos" begin - testvid_path = joinpath(@__DIR__, "../videos", "annie_oakley.ogg") + testvid_path = joinpath(VideoIO.TestVideos.videodir, "annie_oakley.ogg") # Test that limited range YCbCr values are translated to "full range" minp, maxp = VideoIO.openvideo(get_video_extrema, testvid_path, target_format=VideoIO.AV_PIX_FMT_GRAY8) @test typeof(minp) == Gray{N0f8} @@ -188,7 +188,7 @@ end end end @testset "Full load" begin - testvid_path = joinpath(@__DIR__, "../videos", "ladybird.mp4") + testvid_path = joinpath(VideoIO.TestVideos.videodir, "ladybird.mp4") vid = VideoIO.load(testvid_path, target_format=VideoIO.AV_PIX_FMT_GRAY8) @test eltype(first(vid)) == Gray{N0f8} end @@ -204,7 +204,7 @@ end # TODO: fix me? (startswith(name, "ladybird") || startswith(name, "NPS")) && continue @testset "Testing $name" begin - testvid_path = joinpath(@__DIR__, "../videos", name) + testvid_path = joinpath(VideoIO.TestVideos.videodir, name) comparison_frame = make_comparison_frame_png(load, testvid_path, test_frameno) filename = joinpath(videodir, name) VideoIO.openvideo(filename; swscale_options=swscale_options) do v diff --git a/test/runtests.jl b/test/runtests.jl index 54bdf29f..c44abcfd 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -9,7 +9,7 @@ using FFMPEG: FFMPEG using VideoIO: VideoIO const testdir = dirname(@__FILE__) -const videodir = joinpath(testdir, "..", "videos") +const videodir = VideoIO.TestVideos.videodir const tempvidname = "testvideo.mp4" const tempvidpath = joinpath(tempdir(), tempvidname) const required_accuracy = 0.07 diff --git a/videos/README-videos.md b/videos/README-videos.md deleted file mode 100644 index c552e719..00000000 --- a/videos/README-videos.md +++ /dev/null @@ -1,7 +0,0 @@ -The files in this directory are available through VideoIO.TestVideos. - -* VideoIO.TestVideos.available() prints a list of all available test videos. -* VideoIO.testvideo("annie_oakley") returns an AVInput object for the - "annie_oakley" video. The video will be downloaded if it isn't available. -* VideoIO.TestVideos.download_all() downloads all test videos -* VideoIO.TestVideos.remove_all() removes all test videos