diff --git a/CHANGELOG.md b/CHANGELOG.md index b6d04c16..59609870 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +VideoIO v1.1.0 Release Notes +====================== +## Removal + +- The GLMakie-based video player that was accessed through Requires by loading GLMakie separately has been removed + after being deprecated in v1.0.7. + + VideoIO v0.9 Release Notes ====================== ## New features diff --git a/Project.toml b/Project.toml index ad4d513b..84952d75 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "VideoIO" uuid = "d6d074c3-1acf-5d4c-9a43-ef38773959a2" -version = "1.0.8" +version = "1.1.0" [deps] ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" @@ -13,7 +13,6 @@ ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534" 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] @@ -25,6 +24,5 @@ Glob = "1.2" ImageCore = "0.8, 0.9, 0.10" PrecompileTools = "1" ProgressMeter = "1.2" -Requires = "1.0" Scratch = "1" julia = "1.6" diff --git a/docs/src/reading.md b/docs/src/reading.md index 7157772c..f9085fe7 100644 --- a/docs/src/reading.md +++ b/docs/src/reading.md @@ -103,49 +103,6 @@ while !eof(f) end close(f) ``` - -## Video Playback - -A trivial video player interface exists (no audio) through `GLMakie.jl`. -Note: `GLMakie` must be imported first to enable playback functionality. - -```julia -using GLMakie -using VideoIO - -f = VideoIO.testvideo("annie_oakley") # downloaded if not available -VideoIO.playvideo(f) # no sound -``` - -Customization of playback can be achieved by looking at the basic expanded version of this function: - -```julia -import GLMakie -import VideoIO - -#io = VideoIO.open(video_file) -io = VideoIO.testvideo("annie_oakley") # for testing purposes -f = VideoIO.openvideo(io) - -img = read(f) -obs_img = GLMakie.Observable(GLMakie.rotr90(img)) -scene = GLMakie.Scene(camera=GLMakie.campixel!, resolution=reverse(size(img))) -GLMakie.image!(scene, obs_img) - -display(scene) - -fps = VideoIO.framerate(f) -while !eof(f) && GLMakie.isopen(scene) - img = read(f) - obs_img[] = GLMakie.rotr90(img) - sleep(1 / fps) -end - -``` -This code is essentially the code in `playvideo`, and will read and -(without the `sleep`) play a movie file as fast as possible. - - ## Reading Camera Output Frames can be read iteratively ```julia @@ -174,7 +131,7 @@ julia> opts["video_size"] = "640x480" julia> opencamera(VideoIO.DEFAULT_CAMERA_DEVICE[], VideoIO.DEFAULT_CAMERA_FORMAT[], opts) VideoReader(...) ``` - + Or more simply, change the default. For example: ```julia julia> VideoIO.DEFAULT_CAMERA_OPTIONS["video_size"] = "640x480" @@ -184,37 +141,6 @@ julia> VideoIO.DEFAULT_CAMERA_OPTIONS["framerate"] = 30 julia> julia> opencamera() VideoReader(...) ``` -### Webcam playback -The default system webcam can be viewed directly -```julia -using GLMakie -using VideoIO -VideoIO.viewcam() -``` - -An expanded version of this approach: -```julia -import GLMakie, VideoIO - -cam = VideoIO.opencamera() -try - img = read(cam) - obs_img = GLMakie.Observable(GLMakie.rotr90(img)) - scene = GLMakie.Scene(camera=GLMakie.campixel!, resolution=reverse(size(img))) - GLMakie.image!(scene, obs_img) - - display(scene) - - fps = VideoIO.framerate(cam) - while GLMakie.isopen(scene) - img = read(cam) - obs_img[] = GLMakie.rotr90(img) - sleep(1 / fps) - end -finally - close(cam) -end -``` ## Video Properties & Metadata ```@docs diff --git a/src/VideoIO.jl b/src/VideoIO.jl index ebda3682..9fd4d364 100644 --- a/src/VideoIO.jl +++ b/src/VideoIO.jl @@ -1,9 +1,7 @@ module VideoIO -using Libdl -using Requires, Dates, ProgressMeter -using ImageCore: channelview, rawview using ColorTypes: RGB, Gray, N0f8, N6f10, YCbCr, Normed, red, green, blue +using Dates using FileIO: File using PrecompileTools @@ -98,23 +96,6 @@ elseif Sys.isbsd() end end -#Helper functions to explain about GLMakie load order requirement -function play(f; flipx = false, flipy = false) - return error( - "GLMakie must be loaded before VideoIO to provide video playback functionality. Try a new session with `using GLMakie, VideoIO`", - ) -end -function playvideo(video; flipx = false, flipy = false) - return error( - "GLMakie must be loaded before VideoIO to provide video playback functionality. Try a new session with `using GLMakie, VideoIO`", - ) -end -function viewcam(device = DEFAULT_CAMERA_DEVICE, format = DEFAULT_CAMERA_FORMAT) - return error( - "GLMakie must be loaded before VideoIO to provide camera playback functionality. Try a new session with `using GLMakie, VideoIO`", - ) -end - ## FileIO interface fileio_load(f::File; kwargs...) = load(f.filename; kwargs...) fileio_save(f::File, video; kwargs...) = save(f.filename, video; kwargs...) @@ -135,69 +116,6 @@ function __init__() av_register_all() libffmpeg.avdevice_register_all() - - @require GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a" begin - # Define read and retrieve for Images - function play(f; flipx = false, flipy = false, pixelaspectratio = nothing) - @warn "This GLMakie-based `play` function is deprecated and will be removed in a future release." maxlog = 1 - eof(f) && error("VideoReader at end of file. Use `seekstart(f)` to rewind") - # if user did not specify the aspect ratio we'll try to use the one stored in the video file - if pixelaspectratio === nothing - pixelaspectratio = aspect_ratio(f) - end - h = height(f) - w = round(typeof(h), width(f) * pixelaspectratio) # has to be an integer - flips_to_dims = Dict( - (true, true) => (1, 2), - (true, false) => 1, - (false, true) => 2, - (false, false) => nothing, - ) - flipping_dims = flips_to_dims[(flipx, flipy)] - flipping = i -> i - if flipping_dims !== nothing - flipping = i -> reverse(i, dims = flipping_dims) - end - flip_and_rotate = i -> begin - rotated = GLMakie.rotr90(i) - flipping(rotated) - end - img = read(f) - obs_img = GLMakie.Observable(flip_and_rotate(img)) - scene = - GLMakie.Scene(camera = GLMakie.campixel!, resolution = reverse(size(img))) - - GLMakie.image!(scene, obs_img) - display(scene) - # issue 343: camera can't run at full speed on MacOS - fps = Sys.isapple() ? min(framerate(f), 24) : framerate(f) - while isopen(scene) && !eof(f) - read!(f, img) - obs_img[] = flip_and_rotate(img) - sleep(1 / fps) - end - end - - function playvideo(video; flipx = false, flipy = false, pixelaspectratio = nothing) - @warn "This GLMakie-based `playvideo` function is deprecated and will be removed in a future release." maxlog = 1 - f = VideoIO.openvideo(video) - try - play(f, flipx=flipx, flipy=flipy, pixelaspectratio=pixelaspectratio) - finally - close(f) - end - end - - function viewcam(device=nothing, format=nothing, options=nothing, pixelaspectratio=nothing) - @warn "This GLMakie-based `viewcam` function is deprecated and will be removed in a future release." maxlog = 1 - camera = opencamera(device, format, options) - try - play(camera; flipx=true, pixelaspectratio) - finally - close(camera) - end - end - end end @setup_workload begin