Skip to content

Port to modern FFmpeg, GCC 15, and updated liblo#10

Open
dnewcome wants to merge 1 commit into
dyne:masterfrom
dnewcome:ffmpeg6
Open

Port to modern FFmpeg, GCC 15, and updated liblo#10
dnewcome wants to merge 1 commit into
dyne:masterfrom
dnewcome:ffmpeg6

Conversation

@dnewcome
Copy link
Copy Markdown

@dnewcome dnewcome commented Mar 24, 2026

Summary

I'm not sure if FreeJ dependencies can be satisfied on a modern Linux distro, at least not without a lot of wrangling. This PR fixes all compilation errors against modern toolchains and library versions, tested on Ubuntu with GCC 15, FFmpeg 7.1, and liblo from current package repositories.

Mostly Claude wrangling but some inspection and manual cajoling. I did a smoke test just by running some javascript files but it does compile cleanly and runs on Ubuntu 25.10. I ran the test script that was there but I don't think it tested much but maybe I just didn't look hard enough.

BTW this is a cool project, I can't believe I didn't know of it until now. I was using veejay on RPi4 and wasn't aware that there was something that predated even that. I started work on fast-vj with the goal of doing something similar to this but with modern shader architectures that can work on limited hardware like the RPi. I ended up using LuaJIT instead of JS with the hopes that it could drive significant interactivity logic without becoming a bottleneck.


FFmpeg 7.x API migration

The largest body of work. FFmpeg has removed or deprecated many APIs over its 4.x–7.x releases that FreeJ relied on. Changes across src/video_layer.cpp, src/include/video_layer.h, src/ffdec.c, and src/context.cpp:

Struct changes

  • AVPicture was removed in FFmpeg 5.0. All uses replaced with AVFrame, which carries the same data[] and linesize[] fields. rgba_picture and the frame FIFO now hold AVFrame * allocated with av_frame_alloc().

Allocation / buffer management

  • avpicture_alloc()av_frame_get_buffer()
  • avpicture_free()av_frame_unref() + av_free()
  • avpicture_fill()av_image_fill_arrays()
  • avpicture_get_size()av_image_get_buffer_size()
  • avpicture_deinterlace() was removed with no direct replacement; the deinterlace path is stubbed out (it was off by default anyway)

Format / codec open sequence

  • av_open_input_file()avformat_open_input()
  • av_find_stream_info()avformat_find_stream_info()
  • AVFormatParameters and url_set_interrupt_cb() removed; format options now passed via AVDictionary
  • Codec contexts are no longer borrowed from AVStream::codec (deprecated). Each stream now gets its own context via avcodec_alloc_context3() + avcodec_parameters_to_context(), owned and freed by the layer
  • avcodec_open()avcodec_open2()
  • avcodec_close()avcodec_free_context() (closes and frees in one call)

Decode API

  • avcodec_decode_video2() and avcodec_decode_audio3() replaced with the send/receive API: avcodec_send_packet() / avcodec_receive_frame()
  • avcodec_get_frame_defaults() removed; replaced by av_frame_unref() semantics

Misc FFmpeg removals

  • av_register_all() / avcodec_register_all() / avcodec_init() removed (codecs auto-register since FFmpeg 4.0)
  • av_free_packet()av_packet_unref()
  • av_close_input_file()avformat_close_input()
  • avcodec_alloc_frame()av_frame_alloc()
  • dump_format()av_dump_format()
  • PIX_FMT_*AV_PIX_FMT_*
  • AVCodecContext::channelsAVCodecContext::ch_layout.nb_channels
  • CODEC_TYPE_VIDEOAVMEDIA_TYPE_VIDEO
  • FF_B_TYPE / FF_I_TYPEAV_PICTURE_TYPE_B / AV_PICTURE_TYPE_I

GCC 15 / SpiderMonkey configure fixes

GCC 14+ promotes two previously-warning conditions to hard errors, breaking the bundled SpiderMonkey (lib/javascript) configure script:

  • -Wimplicit-int is now an error. The configure script contained K&R-style main(){return(0);} in compiler probe programs. Fixed to int main(){return(0);}.
  • -Wreturn-mismatch is now an error. Eight int main() test functions used bare return; with no value. Fixed to return 0;.
  • Missing execute permissions on build/hcc, build/hcpp, and a dozen other helper scripts caused the SpiderMonkey configure to fail mid-run with "Permission denied". Execute bit restored on all affected files.

liblo API update

osc_ctrl.cpp used the old lo_method_handler signature where the incoming-message argument was void *. Current liblo types this as lo_message. Additionally, lo_send_message_from() requires a lo_server (not a lo_server_thread); fixed by calling lo_server_thread_get_server().


Housekeeping

  • Added compile and test-driver to .gitignore — these are automake-generated helper scripts that get dropped into the project root by ./configure and don't belong in version control.

Test environment

  • OS: Ubuntu (Linux 6.17, x86_64)
  • GCC 15.2
  • FFmpeg 7.1.1
  • liblo (current Ubuntu package)
  • libSDL 1.2, libsdl-image 1.2
  • SpiderMonkey (bundled, built statically)

./configure && make completes cleanly and the freej binary runs.

Fixes build on current Linux distros. Major changes:

FFmpeg 7.x API migration (video_layer.cpp/h, ffdec.c, context.cpp):
- Replace AVPicture with AVFrame throughout
- avpicture_alloc/free/fill/get_size -> av_frame_get_buffer,
  av_frame_unref, av_image_fill_arrays, av_image_get_buffer_size
- av_open_input_file/av_find_stream_info -> avformat_open_input/
  avformat_find_stream_info
- Codec contexts now allocated with avcodec_alloc_context3 +
  avcodec_parameters_to_context instead of borrowing from AVStream
- avcodec_open -> avcodec_open2; avcodec_close -> avcodec_free_context
- avcodec_decode_video2/audio3 -> avcodec_send_packet/avcodec_receive_frame
- av_free_packet -> av_packet_unref
- av_close_input_file -> avformat_close_input
- PIX_FMT_* -> AV_PIX_FMT_*
- channels -> ch_layout.nb_channels
- Remove av_register_all (removed in FFmpeg 4.x)
- avpicture_deinterlace stubbed out (removed in FFmpeg 4.x)
- Remove AVFormatParameters, url_set_interrupt_cb (removed APIs)

GCC 15 / SpiderMonkey configure fixes (lib/javascript/configure):
- K&R-style main(){} -> int main(){} (implicit int removed as error)
- bare return; -> return 0; in int main() test programs
- Fix missing execute permissions on build helper scripts

liblo API update (osc_ctrl.cpp):
- Handler data argument void* -> lo_message
- lo_send_message_from: use lo_server_thread_get_server() to convert
  lo_server_thread to lo_server

Misc:
- Add compile and test-driver to .gitignore (automake-generated)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant