Commit graph

8 commits

Author SHA1 Message Date
Andreas Rheinhardt
ca5504fb5c avcodec/liblc3dec: Simplify sample fmt selection
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-29 14:08:15 +01:00
Andreas Rheinhardt
ba1aea762b avcodec/liblc3{dec,enc}: Simplify sample_size, is_planar check
Sample size is always sizeof(float), is planar is a simple if
given that these codecs only support float and planar float.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-29 14:08:15 +01:00
cenzhanquan1
0eb572f080 avcodec/liblc3dec: support sample format negotiation and planar layout.
1. Adds support for respecting the requested sample format. Previously,
   the decoder always used AV_SAMPLE_FMT_FLTP. Now it checks if the
   caller requested a specific format via avctx->request_sample_fmt and
   honors that request when supported.

2. Improves planar/interleaved audio buffer handling. The decoding
   logic now properly handles both planar and interleaved sample
   formats by calculating the correct stride and buffer pointers based
   on the actual sample format.

The changes include:
- Added format mapping between AVSampleFormat and lc3_pcm_format
- Implemented format selection logic in initialization.
- Updated buffer pointer calculation for planar/interleaved data.
- Maintained backward compatibility with existing behavior.

Signed-off-by: cenzhanquan1 <cenzhanquan1@xiaomi.com>
2025-10-23 22:06:04 +08:00
Antoine SOULIER
4865ea48cc avcodec/liblc3dec: retrieve duration of the last packet from the demuxer
Use the packet duration field to invalid last samples of the last frame.
2024-04-06 09:55:57 +02:00
Antoine SOULIER
6de00dc5f1 avcodec/liblc3dec: fix extradata size 2024-04-06 09:40:37 +02:00
Antoine SOULIER
ad3fcfd0f2 avcodec/liblc3dec: fix typo in macro name, fix compilation 2024-04-06 09:40:32 +02:00
James Almer
45d2110fc7 avcodec/liblc3dec: sanitize channel count in avctx
Should prevent out of array accesses.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-04-04 13:55:16 -03:00
Antoine Soulier via ffmpeg-devel
240fd04db2 avcodec/liblc3: add encoding/decoding support of LC3 audio codec
The LC3 audio codec is the default codec of Bluetooth LE audio.
This is a wrapper over the liblc3 library (https://github.com/google/liblc3).

Signed-off-by: Antoine Soulier <asoulier@google.com>
2024-04-04 17:47:31 +02:00