From nobody Wed Jun 21 05:50:44 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 4QmCKJ5q8hz4g3L7; Wed, 21 Jun 2023 05:50:44 +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 4QmCKJ5Lgmz3n9X; Wed, 21 Jun 2023 05:50:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687326644; 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=sNbzLYAeM60kNsi3mycEiCe5D+DYpTqRAnYG6TSaBBM=; b=o2dsxJXnc24WLVuWqyPeeiEqcz4ZzlWWcgG4p0lCrEfPe7ZpqkSKpiWOj/bDRwBS/u5MPx StVQOyPwUUIyA4IQ2dLEOvygzjfMd20eiGDkfDPpqv9vTZtVPtyOKWdG+0PQiTpEByshFi yGjLkcOkCvAtxCwpmDWo9v+7rGigNmbfVqyVs11XbSPGHQ5OM3SPGAS7LfxmHf7e0cNsWM Y10kcmu0OjUD0ETepsLqb6rmgPRwDWJ56WSu3EwvpCyDnAYsLA66COe4dgT3MM0mZAnSzV 2rThCOS1ze1a5WnxSd1N+HjRR3sQzjveH9Gy7flgeSgAlXUz0rf0WykdAVWDzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687326644; 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=sNbzLYAeM60kNsi3mycEiCe5D+DYpTqRAnYG6TSaBBM=; b=J/4BUK/agiAVuibQ69Mob+9r0HiigkeHCntNV80FqwXgcPOpmGNoTvU4J80XKJxoEGWf30 jioSQPjrbESx0ZG51SWgS2I0x2dtVChJ7NMPZbB4y+2F08590VsBA+PW83b+Zp/rX/yxh1 KOOFK1Rl2eBK8xdtvw0l2MRquKJE4E44TM1YuFhuNegnZbtAAwGN/CFwAwwWczE9qhw+N/ 5QUpFnp3Rrh+ykfs9j10BjjTBPLMBukI1djNXawcHOoNTJirsQrHlQ64ZyEDQWj4Co6otO 5k7vVjD7uy43L2HToPJ+wJcfrRjzxVKypupVlCiBRT2ZQvMM/xufoEecSCOqvw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687326644; a=rsa-sha256; cv=none; b=v7BJad6E1icrfgdQoRcaKFnhd+EvHvCnvCEM4QromBvozKCqeQcUBVsukL8HdDa1tCJ9ub N3kXDqFGlDxAp3F+HlzKeWTuaI21/qejKc5XXk9SBFd77sCsySIJqBOLz8cdBn9mUIrM4u 5ejozoGXwAiyDfyS92uWv8dxPEBqRykbKwOw5xVQjCXFjIif7AXfbBNuoEM3tbtqs18q6N bKDgB6yQzoj5rvy1iPLh/ze5ScYZH1cJhMZY5XTDPn4yf5kQyu+FR4iJTZCnb/OflR4JdI SEGFq+pC/5DJE+9hcZKgKu1/vu5BjxQxhNfvKnXjd8oCcQDC0ap0KRcme/A9Ow== 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 4QmCKJ4SVCzVlR; Wed, 21 Jun 2023 05:50:44 +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 35L5oiRW076695; Wed, 21 Jun 2023 05:50:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35L5oiG7076694; Wed, 21 Jun 2023 05:50:44 GMT (envelope-from git) Date: Wed, 21 Jun 2023 05:50:44 GMT Message-Id: <202306210550.35L5oiG7076694@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: =?utf-8?Q?Fernando=20Apestegu=C3=ADa?= Subject: git: cf95c7f7bf4c - main - multimedia/kodi: fix ac3 encoding for ffmpeg6 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: fernape X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf95c7f7bf4c3b465f77629f3da2532f24c4034f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by fernape: URL: https://cgit.FreeBSD.org/ports/commit/?id=cf95c7f7bf4c3b465f77629f3da2532f24c4034f commit cf95c7f7bf4c3b465f77629f3da2532f24c4034f Author: yzrh AuthorDate: 2023-06-20 13:07:32 +0000 Commit: Fernando ApesteguĂ­a CommitDate: 2023-06-21 05:45:27 +0000 multimedia/kodi: fix ac3 encoding for ffmpeg6 Add patch to fix the reported issue. PR: 272046 Reported by: yzrh@noema.org (maintainer) --- multimedia/kodi/Makefile | 2 +- multimedia/kodi/files/patch-ffmpeg6-support | 67 ++++++++++++++++------------- 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/multimedia/kodi/Makefile b/multimedia/kodi/Makefile index e1bddf9a55d6..83753da338ac 100644 --- a/multimedia/kodi/Makefile +++ b/multimedia/kodi/Makefile @@ -1,6 +1,6 @@ PORTNAME= kodi DISTVERSION= 20.1 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= multimedia java # do not forget to fix devel/kodi-platform when updating kodi diff --git a/multimedia/kodi/files/patch-ffmpeg6-support b/multimedia/kodi/files/patch-ffmpeg6-support index 2ab9cbc27a3d..f337f73931b2 100644 --- a/multimedia/kodi/files/patch-ffmpeg6-support +++ b/multimedia/kodi/files/patch-ffmpeg6-support @@ -536,7 +536,7 @@ diff -urN xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp.orig xbmc/cores/Au avcodec_free_context(&m_CodecCtx); return false; } -@@ -242,62 +261,78 @@ +@@ -242,62 +261,83 @@ int CAEEncoderFFmpeg::Encode(uint8_t *in, int in_size, uint8_t *out, int out_size) { @@ -588,51 +588,56 @@ diff -urN xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp.orig xbmc/cores/Au - /* initialize the output packet */ - AVPacket* pkt = av_packet_alloc(); - if (!pkt) -- { -- CLog::Log(LOGERROR, "CAEEncoderFFmpeg::{} - av_packet_alloc failed: {}", __FUNCTION__, -- strerror(errno)); -- av_frame_free(&frame); -- return 0; -- } -+ pkt->size = out_size; -+ pkt->data = out; - -- pkt->size = out_size; -- pkt->data = out; + /* encode it */ + err = avcodec_send_frame(m_CodecCtx, frame); + if (err < 0) + throw FFMpegException("Error sending a frame for encoding (error '{}')", + FFMpegErrorToString(err)); - -- /* encode it */ -- int ret = avcodec_encode_audio2(m_CodecCtx, pkt, frame, &got_output); -+ while (err >= 0) ++ ++ err = avcodec_receive_packet(m_CodecCtx, pkt); ++ //! @TODO: This is a workaround for our current design. The caller should be made ++ // aware of the potential error values to use the ffmpeg API in a proper way, which means ++ // copying with EAGAIN and multiple packet output. ++ // For the current situation there is a relationship implicitely assumed of: ++ // 1 frame in - 1 packet out. This holds true in practice but the API does not guarantee it. ++ if (err >= 0) + { -+ err = avcodec_receive_packet(m_CodecCtx, pkt); -+ if (err == AVERROR(EAGAIN) || err == AVERROR_EOF) ++ if (pkt->size <= out_size) + { -+ av_channel_layout_uninit(&frame->ch_layout); -+ av_frame_free(&frame); -+ av_packet_free(&pkt); -+ return (err == AVERROR(EAGAIN)) ? -1 : 0; ++ memset(out, 0, out_size); ++ memcpy(out, pkt->data, pkt->size); ++ size = pkt->size; + } -+ else if (err < 0) ++ else + { -+ throw FFMpegException("Error during encoding (error '{}')", FFMpegErrorToString(err)); ++ CLog::LogF(LOGERROR, "Encoded pkt size ({}) is bigger than buffer ({})", pkt->size, ++ out_size); + } - -- int size = pkt->size; + av_packet_unref(pkt); + } - -+ size = pkt->size; ++ else ++ { ++ CLog::LogF(LOGERROR, "Error receiving encoded paket ({})", err); ++ } + } + catch (const FFMpegException& caught) -+ { + { +- CLog::Log(LOGERROR, "CAEEncoderFFmpeg::{} - av_packet_alloc failed: {}", __FUNCTION__, +- strerror(errno)); +- av_frame_free(&frame); +- return 0; + CLog::Log(LOGERROR, "CAEEncoderFFmpeg::{} - {}", __func__, caught.what()); -+ } -+ + } + +- pkt->size = out_size; +- pkt->data = out; ++ av_channel_layout_uninit(&frame->ch_layout); + +- /* encode it */ +- int ret = avcodec_encode_audio2(m_CodecCtx, pkt, frame, &got_output); +- +- int size = pkt->size; +- /* free temporary data */ av_frame_free(&frame);