X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Flibvorbisenc.c;h=d0f4c65aacc58b274f25da408d1cd8c31dfbd310;hb=1c7f252783aec37e4ff8049476386f63afe91756;hp=f78f872fe2ead128b7b2f1eb08d5f713eb38fd6a;hpb=0c126431f9b290f5651ec62f45627632d94c51ea;p=ffmpeg diff --git a/libavcodec/libvorbisenc.c b/libavcodec/libvorbisenc.c index f78f872fe2e..d0f4c65aacc 100644 --- a/libavcodec/libvorbisenc.c +++ b/libavcodec/libvorbisenc.c @@ -70,6 +70,17 @@ static const AVClass vorbis_class = { .version = LIBAVUTIL_VERSION_INT, }; +static const uint8_t vorbis_encoding_channel_layout_offsets[8][8] = { + { 0 }, + { 0, 1 }, + { 0, 2, 1 }, + { 0, 1, 2, 3 }, + { 0, 2, 1, 3, 4 }, + { 0, 2, 1, 4, 5, 3 }, + { 0, 2, 1, 5, 6, 4, 3 }, + { 0, 2, 1, 6, 7, 4, 5, 3 }, +}; + static int vorbis_error_to_averror(int ov_err) { switch (ov_err) { @@ -185,7 +196,6 @@ static av_cold int libvorbis_encode_close(AVCodecContext *avctx) av_fifo_freep(&s->pkt_fifo); ff_af_queue_close(&s->afq); - av_freep(&avctx->extradata); av_vorbis_parse_free(&s->vp); @@ -287,7 +297,7 @@ static int libvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, buffer = vorbis_analysis_buffer(&s->vd, samples); for (c = 0; c < channels; c++) { int co = (channels > 8) ? c : - ff_vorbis_encoding_channel_layout_offsets[channels - 1][c]; + vorbis_encoding_channel_layout_offsets[channels - 1][c]; memcpy(buffer[c], frame->extended_data[co], samples * sizeof(*buffer[c])); } @@ -363,7 +373,7 @@ static int libvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, return 0; } -AVCodec ff_libvorbis_encoder = { +const AVCodec ff_libvorbis_encoder = { .name = "libvorbis", .long_name = NULL_IF_CONFIG_SMALL("libvorbis"), .type = AVMEDIA_TYPE_AUDIO,