Eyeball.jl
Eyeball.jl copied to clipboard
eye fails on VideoReader objects from the VideoIO.jl package
Hi,
I stumbled upon a case where eye fails. Consider this
julia> using Eyeball
julia> using VideoIO
julia> sample_avi_fn = download("https://www.engr.colostate.edu/me/facil/dynamics/files/drop.avi")
julia> handle = VideoIO.openvideo(sample_avi_fn)
julia> eye(handle)
ERROR: type Ptr has no field data
Stacktrace:
[1] getproperty(x::Ptr{VideoIO.libffmpeg.AVFormatContext}, f::Symbol)
@ VideoIO.libffmpeg ~/.julia/packages/VideoIO/EsW3Z/lib/libffmpeg.jl:6701
[2] field_ptr
@ ~/.julia/packages/VideoIO/EsW3Z/src/util.jl:67 [inlined]
[3] getproperty
@ ~/.julia/packages/VideoIO/EsW3Z/src/avptr.jl:44 [inlined]
[4] (::Eyeball.var"#21#23"{VideoIO.NestedCStruct{VideoIO.libffmpeg.AVFormatContext}})(pn::Symbol)
@ Eyeball ./none:0
[5] iterate
@ ./generator.jl:47 [inlined]
....
The following makes me suspect that something's broken with getproperty or with propertynames for a VideoIO.NestedCStruct{VideoIO.libffmpeg.AVCodecContext}.
julia> dump(handle.codec_context, maxdepth=2)
VideoIO.NestedCStruct{VideoIO.libffmpeg.AVCodecContext}
data: Base.RefValue{Ptr{VideoIO.libffmpeg.AVCodecContext}}
x: Ptr{VideoIO.libffmpeg.AVCodecContext} @0x0000000003e90cc0
julia> handle.codec_context.data
ERROR: type Ptr has no field data
Stacktrace:
[1] getproperty(x::Ptr{VideoIO.libffmpeg.AVCodecContext}, f::Symbol)
@ VideoIO.libffmpeg ~/.julia/packages/VideoIO/3LUls/lib/libffmpeg.jl:2908
[2] field_ptr
@ ~/.julia/packages/VideoIO/3LUls/src/util.jl:67 [inlined]
[3] getproperty(ap::VideoIO.NestedCStruct{VideoIO.libffmpeg.AVCodecContext}, s::Symbol)
@ VideoIO ~/.julia/packages/VideoIO/3LUls/src/avptr.jl:44
[4] top-level scope
@ REPL[21]:1
julia> propertynames(handle.codec_context)
(:data, :data)
julia> getfield(handle.codec_context, :data)
Base.RefValue{Ptr{VideoIO.libffmpeg.AVCodecContext}}(Ptr{VideoIO.libffmpeg.AVCodecContext} @0x0000000003e90cc0)
julia> getproperty(handle.codec_context, :data)
ERROR: type Ptr has no field data
Stacktrace:
[1] getproperty(x::Ptr{VideoIO.libffmpeg.AVCodecContext}, f::Symbol)
@ VideoIO.libffmpeg ~/.julia/packages/VideoIO/3LUls/lib/libffmpeg.jl:2908
[2] field_ptr
@ ~/.julia/packages/VideoIO/3LUls/src/util.jl:67 [inlined]
[3] getproperty(ap::VideoIO.NestedCStruct{VideoIO.libffmpeg.AVCodecContext}, s::Symbol)
@ VideoIO ~/.julia/packages/VideoIO/3LUls/src/avptr.jl:44
[4] top-level scope
@ REPL[24]:1
Maybe I should include a try in there somewhere to catch objects that are broken like this.
Or maybe fallback to getfield.