FreeBSD Bugzilla – Attachment 242839 Details for
Bug 272046
multimedia/kodi: fix ac3 encoding for ffmpeg6
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
fix ac3 encoding
kodi-ac3.patch (text/plain), 3.51 KB, created by
yzrh
on 2023-06-17 17:13:06 UTC
(
hide
)
Description:
fix ac3 encoding
Filename:
MIME Type:
Creator:
yzrh
Created:
2023-06-17 17:13:06 UTC
Size:
3.51 KB
patch
obsolete
>diff -urN kodi.orig/Makefile kodi/Makefile >--- kodi.orig/Makefile 2023-06-03 12:26:20.705542000 +0000 >+++ kodi/Makefile 2023-06-17 16:55:02.714303000 +0000 >@@ -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 -urN kodi.orig/files/patch-ffmpeg6-support kodi/files/patch-ffmpeg6-support >--- kodi.orig/files/patch-ffmpeg6-support 2023-06-03 12:26:20.706048000 +0000 >+++ kodi/files/patch-ffmpeg6-support 2023-06-17 12:11:15.004262000 +0000 >@@ -536,7 +536,7 @@ > 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 @@ > - /* 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); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 272046
: 242839 |
242840