X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Flibcodec2.c;h=562a616f59c23175101b8f0edf196f2eac91b371;hb=a247ac640df3da573cd661065bf53f37863e2b46;hp=1d6bed03833ea71eb23fd97e3bb01de68d41629a;hpb=79025da3f2e7ab047c8f3c0c817952a98480b26b;p=ffmpeg diff --git a/libavcodec/libcodec2.c b/libavcodec/libcodec2.c index 1d6bed03833..562a616f59c 100644 --- a/libavcodec/libcodec2.c +++ b/libavcodec/libcodec2.c @@ -34,7 +34,7 @@ typedef struct { static const AVOption options[] = { //not AV_OPT_FLAG_DECODING_PARAM since mode should come from the demuxer //1300 (aka FreeDV 1600) is the most common mode on-the-air, default to it here as well - AVPRIV_CODEC2_AVOPTIONS("codec2 mode", LibCodec2Context, 0, 4 /*CODEC2_MODE_1300*/, AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_ENCODING_PARAM), + CODEC2_AVOPTIONS("codec2 mode", LibCodec2Context, 0, 4 /*CODEC2_MODE_1300*/, AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_ENCODING_PARAM), { NULL }, }; @@ -55,7 +55,7 @@ static av_cold int libcodec2_init_common(AVCodecContext *avctx, int mode) { LibCodec2Context *c2 = avctx->priv_data; //Grab mode name from options, unless it's some weird number. - const char *modename = mode >= 0 && mode <= AVPRIV_CODEC2_MODE_MAX ? options[mode+1].name : "?"; + const char *modename = mode >= 0 && mode <= CODEC2_MODE_MAX ? options[mode+1].name : "?"; c2->codec = codec2_create(mode); if (!c2->codec) { @@ -93,13 +93,13 @@ static av_cold int libcodec2_init_decoder(AVCodecContext *avctx) avctx->sample_fmt = AV_SAMPLE_FMT_S16; avctx->channel_layout = AV_CH_LAYOUT_MONO; - if (avctx->extradata_size != AVPRIV_CODEC2_EXTRADATA_SIZE) { + if (avctx->extradata_size != CODEC2_EXTRADATA_SIZE) { av_log(avctx, AV_LOG_ERROR, "must have exactly %i bytes of extradata (got %i)\n", - AVPRIV_CODEC2_EXTRADATA_SIZE, avctx->extradata_size); + CODEC2_EXTRADATA_SIZE, avctx->extradata_size); return AVERROR_INVALIDDATA; } - return libcodec2_init_common(avctx, avpriv_codec2_mode_from_extradata(avctx->extradata)); + return libcodec2_init_common(avctx, codec2_mode_from_extradata(avctx->extradata)); } static av_cold int libcodec2_init_encoder(AVCodecContext *avctx) @@ -114,13 +114,13 @@ static av_cold int libcodec2_init_encoder(AVCodecContext *avctx) return AVERROR(EINVAL); } - avctx->extradata = av_mallocz(AVPRIV_CODEC2_EXTRADATA_SIZE + AV_INPUT_BUFFER_PADDING_SIZE); + avctx->extradata = av_mallocz(CODEC2_EXTRADATA_SIZE + AV_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) { return AVERROR(ENOMEM); } - avctx->extradata_size = AVPRIV_CODEC2_EXTRADATA_SIZE; - avpriv_codec2_make_extradata(avctx->extradata, c2->mode); + avctx->extradata_size = CODEC2_EXTRADATA_SIZE; + codec2_make_extradata(avctx->extradata, c2->mode); return libcodec2_init_common(avctx, c2->mode); } @@ -180,7 +180,7 @@ static int libcodec2_encode(AVCodecContext *avctx, AVPacket *avpkt, return 0; } -AVCodec ff_libcodec2_decoder = { +const AVCodec ff_libcodec2_decoder = { .name = "libcodec2", .long_name = NULL_IF_CONFIG_SMALL("codec2 decoder using libcodec2"), .type = AVMEDIA_TYPE_AUDIO, @@ -189,14 +189,14 @@ AVCodec ff_libcodec2_decoder = { .init = libcodec2_init_decoder, .close = libcodec2_close, .decode = libcodec2_decode, - .capabilities = 0, + .capabilities = AV_CODEC_CAP_CHANNEL_CONF, .supported_samplerates = (const int[]){ 8000, 0 }, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, .channel_layouts = (const uint64_t[]) { AV_CH_LAYOUT_MONO, 0 }, .priv_class = &libcodec2_dec_class, }; -AVCodec ff_libcodec2_encoder = { +const AVCodec ff_libcodec2_encoder = { .name = "libcodec2", .long_name = NULL_IF_CONFIG_SMALL("codec2 encoder using libcodec2"), .type = AVMEDIA_TYPE_AUDIO,