Volunteer for testing welcome
Fixes: Qc9DRRq5X1KU
Fixes: signed integer overflow
Signed integer overflow Replicated through Modified FFmpeg with UBSAN
Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24589
The styles of a layout go into one ASS track as its header, and the
script of a strip holds only its events, so a strip render parses the
events alone, the cache keys shrink to them, and the frame is the whole
canvas, which lets the metadata popup be one strip instead of a strip
per line that also draws the line above it.
Assisted-by: Claude
The search line and the search are dropped once the list is hidden
instead of when it is unpinned, so neither the layout nor the rows
change under the fade.
Assisted-by: Claude
The o key lists the directory of the input, local or remote, in the
list. Enter or a click lists the chosen directory or plays the chosen
file instead of the input once it opened, so a file that is no media
leaves the input playing. Directories come first, hidden entries are
left out, and the popup of a file shows its size.
Assisted-by: Claude
The audio device is opened once the audio decoder is set up, and a
failure to start the audio output closes the audio stream again.
Assisted-by: Claude
avformat_open_input() replaces the dictionary it is given with the
options it did not use, which left the global format options without
the recognized ones after the first input. Each input is opened with a
copy now.
Assisted-by: Claude
stream_open() replaced the -volume percentage with the SDL volume it
computed from it, so a second stream would compute its volume from the
first stream's.
Assisted-by: Claude
The window title taken from the input's metadata, seeking by bytes and
the unlimited buffering of realtime inputs were decided once into
globals; they are kept per VideoState now, so that another input
decides them anew. The title string is freed with the stream.
Assisted-by: Claude
The strips were rendered by the ass filter over a color source in a
filter graph, whose generic blending took most of the time. libass now
renders each strip and its glyphs are composited over the strip
background where they cover it; a row strip at 1080p takes 0.47 instead
of 1.29 ms. ffplay suggests libass instead of the ass filter and no
longer selects the color filter.
Assisted-by: Claude
Each strip is rendered once into a cache keyed by its script, background
and place, and the bitmap is composed from the cached strips: what
differs from the strips shown before is cleared and composed again from
the strips covering it. Rows scrolling back into view, a highlight
returning to a row and repeated sorting or searching reuse rendered
strips, and the scroll shift and the rules for what lies under the
popup are gone. The cache holds up to twice the bitmap size, dropping
the least recently shown strips first.
Assisted-by: Claude
The list becomes a ListView in ffplay_list.c, which shows entries with
title, artist, length and metadata and reports the entry the user
chooses; ffplay builds the entries from the chapters and seeks to the
chosen one. The sort order moves from globals into the ListView.
Assisted-by: Claude
Fixes: signed integer overflow
Fixes: YK9ibCaczocG
Fixes: C041.heic
Signed integer overflow Replicated through UnModified FFmpeg with UBSAN
Found during triage of the security report GL61hVKFlOuU
When the list scrolls, the pixels of the rows that stay visible are
moved together with their strips, so only the rows scrolling in and
those whose content changed are rendered. Rows the popup covered are
rendered anew, as their pixels moved with the popup's.
Assisted-by: Claude
The event loop slept up to REFRESH_RATE between refreshes while input
waited in the queue; waiting for an event with the same timeout handles
input as soon as it arrives.
Assisted-by: Claude
The rows are rebuilt and sorted whenever the list is shown; moving the
selection by key or wheel within the visible list only needs the new
selection, not another rebuild over all chapters.
Assisted-by: Claude
Input handlers only ask for a render, which happens once the pending
events are handled, so a burst of wheel clicks or key presses renders
the list once instead of once per event.
Assisted-by: Claude
The list is kept in one bitmap made of horizontal strips: the header,
each row, the bottom padding and each line of the metadata popup. A
strip is rendered through libass on a strip sized canvas, over its
background filled by the color source, only when its script, place or
background changed or when it lies on something cleared or redrawn
before it. Only the changed part of the bitmap is uploaded, on the next
refresh. Moving the mouse across the list thus renders and uploads the
two rows whose highlight changed instead of the whole list on a window
wide canvas.
The popup over the rows of a narrow window now covers them instead of
letting their text show through.
Assisted-by: Claude
A chapter length near INT64_MAX overflowed the rounding, the hour count
was also truncated to int.
Fixes: signed integer overflow
Fixes: 7JHyBJsQ7bNE
Regression since: 80a55704b7
Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24589
Signed integer overflow Replicated through UnModified FFmpeg with UBSAN
Collect the fields of a row and the lines of the rows nested in it,
write them when the row ends, and write the separator before each field.
This fixes rows fused with the previous one after a typed element had
printed at the same level, the blank line after the timecode rows of a
frame, fields printed on a separator-led line after nested rows, and the
doubled or trailing separators of empty rows and empty inline arrays,
which the tmcd refs encoded.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>