dankamongmen / notcurses

blingful character graphics/TUI library. definitely not curses.
https://nick-black.com/dankwiki/index.php/Notcurses
Other
3.43k stars 113 forks source link

pkt_duration has been deprecated in ffmpeg #2688

Closed dankamongmen closed 4 months ago

dankamongmen commented 1 year ago

Attempting to build against recent (git checkout) ffmpeg hits:

[ 20%] Building C object CMakeFiles/notcurses.dir/src/media/ffmpeg.c.o
/home/dank/src/dankamongmen/notcurses/src/media/ffmpeg.c: In function ‘ffmpeg_stream’:
/home/dank/src/dankamongmen/notcurses/src/media/ffmpeg.c:523:5: warning: ‘pkt_duration’ is deprecated [-Wdeprecated-declarations]
  523 |     uint64_t duration = ncv->details->frame->pkt_duration * tbase * NANOSECS_IN_SEC;
      |     ^~~~~~~~
In file included from /home/dank/src/dankamongmen/notcurses/src/media/ffmpeg.c:4:
/usr/local/include/libavutil/frame.h:617:13: note: declared here
  617 |     int64_t pkt_duration;
      |             ^~~~~~~~~~~~
dankamongmen commented 4 months ago

taking a look at this now. it appears that we ought be using duration rather than pkt_duration. the latter is in units of time_base. duration is in the same units as pts, which also appears to just be time_base. so it looks like we can just replace pkt_duration with duration, and we're done? surely it's not that easy.

dankamongmen commented 4 months ago

seems to work.

dankamongmen commented 4 months ago

hrmm ffmpeg as recent as the one on our ubuntu builder only offers pkt_duration argh

dankamongmen commented 4 months ago

we now check for FF_API_PKT_DURATION, and use pkt_duration when it's defined. this still triggers a deprecation warning for some versions of ffmpeg, but it works on all versions (including new ones without pkt_duration).