In that scenario, it's better than not choosing anything at all.
This is needed for the following changes.
Signed-off-by: James Almer <jamrial@gmail.com>
This allows callers to (optionally) set a specific limit for audio and
video frames, separately.
Since these are not really stream options, I had to add a new parsing logic
to handle the :a and :v suffixes, but I don't think it's too ugly.
As an aside, also fixes a memleak if setting the option somehow fails.
Signed-off-by: Niklas Haas <git@haasn.dev>
A filtergraph can close one of its inputs itself, e.g. when a filter
such as trim returns EOF on a looped input whose upstream never sends
EOF. Such inputs are marked with ifp->eof by close_input(), but
choose_input() only skipped inputs that had received an EOF from
upstream (fgt->eof_in). It could therefore pick a closed input, whose
frames can never arrive, while choking every other input's decoder
queue, deadlocking the CLI at 0% CPU.
Skip graph-closed inputs in choose_input(); close inputs that no
longer accept data before choosing the next input instead of only
after read_frames() returns, so a just-closed input cannot be picked;
restart input selection when sending a frame closes the selected
input, so a stale fgt->next_in pointing at it is not reused; and
re-send EOF for graph-closed inputs when reconfiguring the graph, so
they are not resurrected.
Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/25548
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
The phase mode is the RDFT display with the blue component raised and
the red and green components lowered by phase(L) - phase(R), wrapped to
(-pi, pi], times the smaller of the red and green components. This shows
channels in antiphase, which look the same as channels in phase in the
RDFT display.
Basically it looks pretty
Show AVCodecParameters.seek_preroll next to initial_padding in the
stream section, and add the attribute to the XSD. Demuxers that know
a pre-roll, such as Opus, report it there; everything else prints 0.
If an internal filtergraph that's removed references another internal
filtergraph, we need to do another dry run to ensure said internal filtegraphs
it referenced are still needed.
Signed-off-by: James Almer <jamrial@gmail.com>
configure_input_video_filter() does not apply autorotation to hardware
pixel formats. Match that condition when deciding whether to remove the
global display matrix in ifilter_parameters_from_frame(), so transcoding
hardware frames does not discard their unapplied orientation.
The matrix was preserved before 7b18beb477.
631ac6d055 restored propagation with
-noautorotate, but left hardware inputs using the default setting affected.
Related to issue #25089. This preserves orientation metadata; automatic
insertion of hardware rotation filters remains unimplemented.
Tested with CUDA decoding and HEVC NVENC encoding at 0, 90, 180 and 270
degrees, with software decoding and with -noautorotate. fate-autorotate
also passes.
Assisted-by: Fairy
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