Browse Source

lavc: stop using deprecated av_codec_next()

Signed-off-by: Josh de Kock <josh@itanimul.li>
tags/n4.3
Josh de Kock 5 years ago
parent
commit
bd2e7b74e1
2 changed files with 7 additions and 5 deletions
  1. +4
    -3
      libavcodec/options.c
  2. +3
    -2
      libavcodec/tests/utils.c

+ 4
- 3
libavcodec/options.c View File

@@ -55,15 +55,16 @@ static void *codec_child_next(void *obj, void *prev)


static const AVClass *codec_child_class_next(const AVClass *prev) static const AVClass *codec_child_class_next(const AVClass *prev)
{ {
AVCodec *c = NULL;
void *iter = NULL;
const AVCodec *c = NULL;


/* find the codec that corresponds to prev */ /* find the codec that corresponds to prev */
while (prev && (c = av_codec_next(c)))
while (prev && (c = av_codec_iterate(&iter)))
if (c->priv_class == prev) if (c->priv_class == prev)
break; break;


/* find next codec with priv options */ /* find next codec with priv options */
while (c = av_codec_next(c))
while (c = av_codec_iterate(&iter))
if (c->priv_class) if (c->priv_class)
return c->priv_class; return c->priv_class;
return NULL; return NULL;


+ 3
- 2
libavcodec/tests/utils.c View File

@@ -19,10 +19,11 @@
#include "libavcodec/avcodec.h" #include "libavcodec/avcodec.h"


int main(void){ int main(void){
AVCodec *codec = NULL;
void *iter = NULL;
const AVCodec *codec = NULL;
int ret = 0; int ret = 0;


while (codec = av_codec_next(codec)) {
while (codec = av_codec_iterate(&iter)) {
if (av_codec_is_encoder(codec)) { if (av_codec_is_encoder(codec)) {
if (codec->type == AVMEDIA_TYPE_AUDIO) { if (codec->type == AVMEDIA_TYPE_AUDIO) {
if (!codec->sample_fmts) { if (!codec->sample_fmts) {


Loading…
Cancel
Save