Skip to content

Commit 4ce6854

Browse files
whitespace
1 parent 63cc954 commit 4ce6854

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/avio.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ function framerate(f::VideoReader)
445445
return fps
446446
end
447447
end
448-
448+
449449
# Fallback to stream r_frame_rate if codec_context time_base is invalid
450450
stream = f.avin.format_context.streams[f.stream_index0 + 1]
451451
rfr = stream.r_frame_rate
@@ -455,7 +455,7 @@ function framerate(f::VideoReader)
455455
return fps
456456
end
457457
end
458-
458+
459459
# Last resort: try avg_frame_rate
460460
afr = stream.avg_frame_rate
461461
if afr.den != 0
@@ -464,7 +464,7 @@ function framerate(f::VideoReader)
464464
return fps
465465
end
466466
end
467-
467+
468468
# If all else fails, throw an error
469469
error("Unable to determine valid framerate from codec_context.time_base, stream.r_frame_rate, or stream.avg_frame_rate")
470470
end

test/interlaced.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
@testset "Interlaced video codec properties" begin
22
# Test with an interlaced H.264 video
33
interlaced_path = joinpath(testdir, "references", "interlaced_h264.mp4")
4-
4+
55
if !isfile(interlaced_path)
66
@test_skip "Interlaced test video not found at $interlaced_path"
77
return
88
end
9-
9+
1010
VideoIO.openvideo(interlaced_path) do reader
1111
# Verify codec_descriptor is not null
1212
@test reader.codec_context.codec_descriptor != C_NULL
13-
13+
1414
# Check if it's a field-based codec (should be for interlaced H.264)
1515
is_field_based = (reader.codec_context.codec_descriptor.props & VideoIO.AV_CODEC_PROP_FIELDS) != 0
1616
@test is_field_based
17-
17+
1818
# For interlaced video, framerate calculation should account for fields
1919
# The video was created at 30fps but with interlacing, so the field rate is 60
2020
fps = VideoIO.framerate(reader)
2121
@test fps > 0
2222
@test isfinite(fps)
23-
23+
2424
# The framerate should be 60 (field rate) for interlaced content
2525
@test fps == 60 // 1
26-
26+
2727
# Verify we can read frames without error
2828
frame = read(reader)
2929
@test !isnothing(frame)
@@ -34,20 +34,20 @@ end
3434
@testset "Codec descriptor null safety" begin
3535
# Test that the null check works properly for various codecs
3636
testvid_path = joinpath(VideoIO.TestVideos.videodir, "ladybird.mp4")
37-
37+
3838
VideoIO.openvideo(testvid_path) do reader
3939
# Verify codec_descriptor is not null
4040
@test reader.codec_context.codec_descriptor != C_NULL
41-
41+
4242
# The AV_CODEC_PROP_FIELDS flag indicates the codec SUPPORTS fields,
4343
# not that this specific video is interlaced. H.264 always has this flag.
4444
# What matters is that our code handles both cases without crashing.
45-
45+
4646
# Get framerate - should work regardless of field flag
4747
fps = VideoIO.framerate(reader)
4848
@test fps > 0
4949
@test isfinite(fps)
50-
50+
5151
# For ladybird.mp4, we expect a reasonable framerate
5252
@test 20 <= fps <= 60
5353
end

0 commit comments

Comments
 (0)