mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
libvorbis: use planar sample format
This commit is contained in:
parent
473b297f26
commit
cfc0a80a1d
@ -264,18 +264,16 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
|||||||
|
|
||||||
/* send samples to libvorbis */
|
/* send samples to libvorbis */
|
||||||
if (frame) {
|
if (frame) {
|
||||||
const float *audio = (const float *)frame->data[0];
|
|
||||||
const int samples = frame->nb_samples;
|
const int samples = frame->nb_samples;
|
||||||
float **buffer;
|
float **buffer;
|
||||||
int c, channels = s->vi.channels;
|
int c, channels = s->vi.channels;
|
||||||
|
|
||||||
buffer = vorbis_analysis_buffer(&s->vd, samples);
|
buffer = vorbis_analysis_buffer(&s->vd, samples);
|
||||||
for (c = 0; c < channels; c++) {
|
for (c = 0; c < channels; c++) {
|
||||||
int i;
|
|
||||||
int co = (channels > 8) ? c :
|
int co = (channels > 8) ? c :
|
||||||
ff_vorbis_encoding_channel_layout_offsets[channels - 1][c];
|
ff_vorbis_encoding_channel_layout_offsets[channels - 1][c];
|
||||||
for (i = 0; i < samples; i++)
|
memcpy(buffer[c], frame->extended_data[co],
|
||||||
buffer[c][i] = audio[i * channels + co];
|
samples * sizeof(*buffer[c]));
|
||||||
}
|
}
|
||||||
if ((ret = vorbis_analysis_wrote(&s->vd, samples)) < 0) {
|
if ((ret = vorbis_analysis_wrote(&s->vd, samples)) < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "error in vorbis_analysis_wrote()\n");
|
av_log(avctx, AV_LOG_ERROR, "error in vorbis_analysis_wrote()\n");
|
||||||
@ -357,7 +355,7 @@ AVCodec ff_libvorbis_encoder = {
|
|||||||
.encode2 = oggvorbis_encode_frame,
|
.encode2 = oggvorbis_encode_frame,
|
||||||
.close = oggvorbis_encode_close,
|
.close = oggvorbis_encode_close,
|
||||||
.capabilities = CODEC_CAP_DELAY,
|
.capabilities = CODEC_CAP_DELAY,
|
||||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT,
|
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
|
||||||
AV_SAMPLE_FMT_NONE },
|
AV_SAMPLE_FMT_NONE },
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),
|
.long_name = NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),
|
||||||
.priv_class = &class,
|
.priv_class = &class,
|
||||||
|
Loading…
Reference in New Issue
Block a user