From nobody Mon Mar 20 15:31:56 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgJcr4LRFz3ys4w; Mon, 20 Mar 2023 15:31:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PgJcr3Nn7z3v0R; Mon, 20 Mar 2023 15:31:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679326316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RmbDRSM+CLMcKANj5YPDrk0y6SPQTFl6b7MR/nTAmXs=; b=VYjzESaWApFVZohZKzoN7fF3bi0Q3KMg6zw3b0LMOu8Q0bli3iQ8lej3ZcQop9ikjXvzbS kAMaUTLYVwCPIXyCq3FffX3OoAMM8Z6dS0aKKCbLGth9XuUOyQekWTK4oXbA3ji+P3P5Mj 1+KdbIwz3RMx6l2JVVjncF2jnXCm/1bNsJ+f4IbC5KKj18ogo50bW5XNN3gmzWMS3V9Vcn UOXGZ6l0OQW5pt6v0ylCxvPrCl1so2MFY10MHf27B7FA8zHmr93v0cd4Dhg8J6ezY4e/U7 ZX95O4WItUboprDuzkognft5mBXFGLKK0biQvliZEA0BFC5jQGuFnZboY+n6dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679326316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RmbDRSM+CLMcKANj5YPDrk0y6SPQTFl6b7MR/nTAmXs=; b=rxTWyQsZ7X21gp3Xw1VrzzLqOMk91ggOusyJy2izohgo9A5LvVGZpVMhKuvnm0aBHatQ+K 90S7Ggnl6aKASn/uQbwkMIgDhlmRVOGxEYWyR90MpIVr9WaFBwpSxOBsBkydBO6SURs36V s5yPGryz3Z+bikAefy4pfMhKPuNVJcLZSkz0cKgzagSqNv/mYSuEs9jthAlGm1UXamYckx +PU27ODXdZYMfdT8fsBPYTUEZr2rEojo8MN4qixMrZoqNYL5sspDd1T7X434rnhPHEDfaL HUNpDusLHwnU6m70mRKvs1OoIPEeTI+ZgrkK4OOJ35x0z/NOOhhqRUlofvi+qA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679326316; a=rsa-sha256; cv=none; b=yQaitQczobr2e1NqNJ6ABBiG+QL+1vUHRehfetdDlnfp67S33/pNrG17xig0/w+srJuSeP vnY73rb0IyJjQg7yzSvd4fYK1//A+GmtzxFsZOux9FCIzJcY9alJG0O1HkIthKNUpw/ZzO +v5au46aw8UEMGwV2wsWXPiyQe9J2AUaqFajns08RNtvNBahHtacQy9brwVL9yFfri1GVc HGMX5cgiRuASPapdvGDZWgQjmK70JilT2JKA8n33kzFnLYbgo9FWx/CJ7IM/2XUPQSCEoP l18QlzhQlit3rrzb18tabjwDdj3ugIHpQAsrfqZ1ap0Sk4nVu7bNX9/Bjh+EjA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgJcr2RcqzbLF; Mon, 20 Mar 2023 15:31:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32KFVuxj071100; Mon, 20 Mar 2023 15:31:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KFVuWM071099; Mon, 20 Mar 2023 15:31:56 GMT (envelope-from git) Date: Mon, 20 Mar 2023 15:31:56 GMT Message-Id: <202303201531.32KFVuWM071099@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Felix Palmen Subject: git: cfdbf52043a2 - main - emulators/emu64: Fix build with ffmpeg 6 List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zirias X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cfdbf52043a2305d000bd30799b098b1b30afe28 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by zirias: URL: https://cgit.FreeBSD.org/ports/commit/?id=cfdbf52043a2305d000bd30799b098b1b30afe28 commit cfdbf52043a2305d000bd30799b098b1b30afe28 Author: Felix Palmen AuthorDate: 2023-03-20 09:28:55 +0000 Commit: Felix Palmen CommitDate: 2023-03-20 15:31:28 +0000 emulators/emu64: Fix build with ffmpeg 6 While here, also add missing dependency on Qt5Network and switch from PORTVERSION to preferred DISTVERSION. PR: 270200 Approved by: tcberner (mentor) Differential Revision: https://reviews.freebsd.org/D39175 --- emulators/emu64/Makefile | 8 +-- emulators/emu64/files/patch-ffmpeg6 | 120 ++++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+), 4 deletions(-) diff --git a/emulators/emu64/Makefile b/emulators/emu64/Makefile index 320aa792b7d7..0a8e610bbf3c 100644 --- a/emulators/emu64/Makefile +++ b/emulators/emu64/Makefile @@ -1,6 +1,6 @@ PORTNAME= emu64 -PORTVERSION= 5.0.19 -PORTREVISION= 2 +DISTVERSION= 5.0.19 +PORTREVISION= 3 CATEGORIES= emulators MAINTAINER= zirias@FreeBSD.org @@ -17,9 +17,9 @@ LIB_DEPENDS= libquazip1-qt5.so:archivers/quazip@qt5 \ USES= compiler:c++11-lang desktop-file-utils dos2unix gl pkgconfig \ qmake:outsource qt:5 sdl USE_GL= gl glu -USE_QT= core gui widgets buildtools:build linguisttools:build +USE_QT= core gui network widgets buildtools:build linguisttools:build -DOS2UNIX_FILES= src/widget_file_browse.h +DOS2UNIX_GLOB= *.cpp *.h USE_SDL= sdl2 image2 USE_GITHUB= yes diff --git a/emulators/emu64/files/patch-ffmpeg6 b/emulators/emu64/files/patch-ffmpeg6 new file mode 100644 index 000000000000..80f143f39389 --- /dev/null +++ b/emulators/emu64/files/patch-ffmpeg6 @@ -0,0 +1,120 @@ +From e09e645a88f37fa2a81d754cb9c86c4a584941a1 Mon Sep 17 00:00:00 2001 +From: Felix Palmen +Date: Mon, 20 Mar 2023 09:42:43 +0100 +Subject: [PATCH] Fix build with ffmpeg 6 + +This doesn't attempt to replace deprecated functions, it only replaces +functions that are gone (avcodec_encode_[audio|video]2) with +straight-forward replacement code. + +It fixes the build with the latest 6.0 release and still builds fine +with ffmpeg 4.4 +--- src/video_capture_class.cpp.orig 2021-07-08 16:55:15 UTC ++++ src/video_capture_class.cpp +@@ -87,7 +87,9 @@ bool VideoCaptureClass::StartCapture(const char *filen + + int ret; + ++#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) + av_register_all(); ++#endif + + // + avformat_alloc_output_context2(&format_ctx, nullptr, nullptr, filename); +@@ -267,7 +269,7 @@ int VideoCaptureClass::GetRecordedFrameCount() + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +-void VideoCaptureClass::AddStream(OutputStream *ost, AVFormatContext *oc, AVCodec **codec, enum AVCodecID codec_id) ++void VideoCaptureClass::AddStream(OutputStream *ost, AVFormatContext *oc, const AVCodec **codec, enum AVCodecID codec_id) + { + AVCodecContext *c; + int i; +@@ -363,7 +365,7 @@ void VideoCaptureClass::CloseStream(OutputStream *ost) + swr_free(&ost->swr_ctx); + } + +-bool VideoCaptureClass::OpenVideo(AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg) ++bool VideoCaptureClass::OpenVideo(const AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg) + { + int ret; + AVCodecContext *c = ost->enc; +@@ -431,7 +433,7 @@ AVFrame* VideoCaptureClass::AllocPicture(enum AVPixelF + return picture; + } + +-bool VideoCaptureClass::OpenAudio(AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg) ++bool VideoCaptureClass::OpenAudio(const AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg) + { + AVCodecContext *c; + int nb_samples; +@@ -532,7 +534,10 @@ int VideoCaptureClass::WriteVideoFrame(AVFormatContext + av_init_packet(&pkt); + + /* encode the image */ +- ret = avcodec_encode_video2(c, &pkt, frame, &got_packet); ++ ret = avcodec_receive_packet(c, &pkt); ++ if (ret == 0) got_packet = 1; ++ if (ret == AVERROR(EAGAIN)) ret = 0; ++ if (ret == 0) ret = avcodec_send_frame(c, frame); + if (ret < 0) + { + char err_msg[AV_ERROR_MAX_STRING_SIZE]; +@@ -562,7 +567,7 @@ int VideoCaptureClass::WriteAudioFrame(AVFormatContext + AVPacket pkt = {}; // data and size must be 0; + AVFrame *frame; + int64_t ret; +- int got_packet; ++ int got_packet = 0; + int64_t dst_nb_samples; + av_init_packet(&pkt); + c = ost->enc; +@@ -595,7 +600,10 @@ int VideoCaptureClass::WriteAudioFrame(AVFormatContext + frame->pts = av_rescale_q(ost->samples_count, AVRational{1, c->sample_rate}, c->time_base); + ost->samples_count += dst_nb_samples; + } +- ret = avcodec_encode_audio2(c, &pkt, frame, &got_packet); ++ ret = avcodec_receive_packet(c, &pkt); ++ if (ret == 0) got_packet = 1; ++ if (ret == AVERROR(EAGAIN)) ret = 0; ++ if (ret == 0) ret = avcodec_send_frame(c, frame); + + if (ret < 0) + { +--- src/video_capture_class.h.orig 2021-07-08 16:55:15 UTC ++++ src/video_capture_class.h +@@ -31,6 +31,7 @@ using namespace std; + + extern "C" + { ++ #include + #include + #include + #include +@@ -84,11 +85,11 @@ class VideoCaptureClass (public) + bool mutex_01; + + private: +- void AddStream(OutputStream *ost, AVFormatContext *oc, AVCodec **codec, enum AVCodecID codec_id); ++ void AddStream(OutputStream *ost, AVFormatContext *oc, const AVCodec **codec, enum AVCodecID codec_id); + void CloseStream(OutputStream *ost); +- bool OpenVideo(AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg); ++ bool OpenVideo(const AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg); + AVFrame* AllocPicture(enum AVPixelFormat pix_fmt, int width, int height); +- bool OpenAudio(AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg); ++ bool OpenAudio(const AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg); + AVFrame* AllocAudioFrame(enum AVSampleFormat sample_fmt, uint64_t channel_layout, int sample_rate, int nb_samples); + int WriteFrame(AVFormatContext *fmt_ctx, const AVRational *time_base, AVStream *st, AVPacket *pkt); + +@@ -110,9 +111,9 @@ class VideoCaptureClass (public) + int video_bitrate, audio_bitrate; + + +- AVOutputFormat *output_format; ++ const AVOutputFormat *output_format; + OutputStream audio_stream; +- AVCodec *video_codec, *audio_codec; ++ const AVCodec *video_codec, *audio_codec; + AVDictionary *options; + + uint8_t* source_video_data;