From: Jamaika1 via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Jamaika1 <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] Added new celt with opus 1.5.2 (PR #20716)
Date: Sat, 18 Oct 2025 17:26:58 -0000
Message-ID: <176080841895.62.830144648391342506@bf907ddaa564> (raw)
PR #20716 opened by Jamaika1
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20716
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20716.patch
>From f1276fe5217d07fda6d7dba77d0740a32d4fdc15 Mon Sep 17 00:00:00 2001
From: Jamaika1 <lukaszcz18@wp.pl>
Date: Sat, 18 Oct 2025 17:26:10 +0000
Subject: [PATCH] Added new celt with opus 1.5.2
---
libavcodec/libcelt_dec.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/libavcodec/libcelt_dec.c b/libavcodec/libcelt_dec.c
index fcd4fc7736..bdaf89e3de 100644
--- a/libavcodec/libcelt_dec.c
+++ b/libavcodec/libcelt_dec.c
@@ -1,6 +1,6 @@
/*
- * Xiph CELT decoder using libcelt
- * Copyright (c) 2011 Nicolas George
+ * Xiph OPUS decoder using libcelt
+ * Copyright (c) 2023 Nicolas George
*
* This file is part of FFmpeg.
*
@@ -21,6 +21,7 @@
#include <celt/celt.h>
#include <celt/celt_header.h>
+#include <opus_custom.h>
#include "avcodec.h"
#include "codec_internal.h"
#include "decode.h"
@@ -35,17 +36,17 @@ struct libcelt_context {
static int ff_celt_error_to_averror(int err)
{
switch (err) {
- case CELT_BAD_ARG: return AVERROR(EINVAL);
+ case OPUS_BAD_ARG: return AVERROR(EINVAL);
#ifdef CELT_BUFFER_TOO_SMALL
- case CELT_BUFFER_TOO_SMALL: return AVERROR(ENOBUFS);
+ case OPUS_BUFFER_TOO_SMALL: return AVERROR(ENOBUFS);
#endif
- case CELT_INTERNAL_ERROR: return AVERROR(EFAULT);
- case CELT_CORRUPTED_DATA: return AVERROR_INVALIDDATA;
- case CELT_UNIMPLEMENTED: return AVERROR(ENOSYS);
+ case OPUS_INTERNAL_ERROR: return AVERROR(EFAULT);
+ //case OPUS_CORRUPTED_DATA: return AVERROR_INVALIDDATA;
+ case OPUS_UNIMPLEMENTED: return AVERROR(ENOSYS);
#ifdef ENOTRECOVERABLE
- case CELT_INVALID_STATE: return AVERROR(ENOTRECOVERABLE);
+ case OPUS_INVALID_STATE: return AVERROR(ENOTRECOVERABLE);
#endif
- case CELT_ALLOC_FAIL: return AVERROR(ENOMEM);
+ case OPUS_ALLOC_FAIL: return AVERROR(ENOMEM);
default: return AVERROR(EINVAL);
}
}
@@ -65,12 +66,12 @@ static av_cold int libcelt_dec_init(AVCodecContext *c)
if (!c->ch_layout.nb_channels || !c->frame_size ||
c->frame_size > INT_MAX / sizeof(int16_t) / c->ch_layout.nb_channels)
return AVERROR(EINVAL);
- celt->mode = celt_mode_create(c->sample_rate, c->frame_size, &err);
+ celt->mode = opus_custom_mode_create(c->sample_rate, c->frame_size, &err);
if (!celt->mode)
return ff_celt_error_to_averror(err);
- celt->dec = celt_decoder_create_custom(celt->mode, c->ch_layout.nb_channels, &err);
+ celt->dec = opus_custom_decoder_create(celt->mode, c->ch_layout.nb_channels, &err);
if (!celt->dec) {
- celt_mode_destroy(celt->mode);
+ opus_custom_mode_destroy(celt->mode);
return ff_celt_error_to_averror(err);
}
if (c->extradata_size >= 4) {
@@ -98,8 +99,8 @@ static av_cold int libcelt_dec_close(AVCodecContext *c)
{
struct libcelt_context *celt = c->priv_data;
- celt_decoder_destroy(celt->dec);
- celt_mode_destroy(celt->mode);
+ opus_custom_decoder_destroy(celt->dec);
+ opus_custom_mode_destroy(celt->mode);
return 0;
}
@@ -114,7 +115,7 @@ static int libcelt_dec_decode(AVCodecContext *c, AVFrame *frame,
if ((err = ff_get_buffer(c, frame, 0)) < 0)
return err;
pcm = (int16_t *)frame->data[0];
- err = celt_decode(celt->dec, pkt->data, pkt->size, pcm, c->frame_size);
+ err = opus_custom_decode(celt->dec, pkt->data, pkt->size, pcm, c->frame_size);
if (err < 0)
return ff_celt_error_to_averror(err);
if (celt->discard) {
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
next reply other threads:[~2025-10-18 17:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-18 17:26 Jamaika1 via ffmpeg-devel [this message]
2025-10-19 13:26 ` [FFmpeg-devel] " Nicolas George via ffmpeg-devel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=176080841895.62.830144648391342506@bf907ddaa564 \
--to=ffmpeg-devel@ffmpeg.org \
--cc=code@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git