Skip to content

Commit b26ca14

Browse files
committed
lavc get supported prop fix
There are some calls using just the codec_ctx parameter, which fail (with the compat with legacy FFmpeg). eg. `uv -A Opus -s testcard` (using the old FFmpeg)
1 parent dc26084 commit b26ca14

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/audio/capture/sdl_mixer.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ static void audio_cap_sdl_mixer_probe(struct device_info **available_devices, in
8080

8181
static void sdl_mixer_audio_callback(int chan, void *stream, int len, void *udata)
8282
{
83+
// printf("%d\n", len);
8384
UNUSED(chan);
8485
struct state_sdl_mixer_capture *s = udata;
8586

@@ -209,7 +210,7 @@ static void * audio_cap_sdl_mixer_init(struct module *parent, const char *cfg)
209210
}
210211

211212
if( Mix_OpenAudio(SDL_MIXER_SAMPLE_RATE, audio_format,
212-
s->audio.ch_count, 4096 ) == -1 ) {
213+
s->audio.ch_count, 1024 ) == -1 ) {
213214
log_msg(LOG_LEVEL_ERROR, MOD_NAME "error initalizing sound: %s\n", Mix_GetError());
214215
goto error;
215216
}

src/libavcodec/lavc_common.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,9 @@ avc_get_supported_pix_fmts(const AVCodecContext *ctx, const AVCodec *codec)
380380
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(61, 13, 100)
381381
return avc_get_supported_config(ctx, codec, AV_CODEC_CONFIG_PIX_FORMAT);
382382
#else
383-
(void) ctx;
383+
if (ctx != NULL) {
384+
return ctx->codec->pix_fmts;
385+
}
384386
return codec->pix_fmts;
385387
#endif
386388
}
@@ -391,7 +393,9 @@ avc_get_supported_sample_fmts(const AVCodecContext *ctx, const AVCodec *codec)
391393
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(61, 13, 100)
392394
return avc_get_supported_config(ctx, codec, AV_CODEC_CONFIG_SAMPLE_FORMAT);
393395
#else
394-
(void) ctx;
396+
if (ctx != NULL) {
397+
return ctx->codec->sample_fmts;
398+
}
395399
return codec->sample_fmts;
396400
#endif
397401
}
@@ -401,7 +405,9 @@ const int *avc_get_supported_sample_rates(const AVCodecContext *ctx, const AVCod
401405
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(61, 13, 100)
402406
return avc_get_supported_config(ctx, codec, AV_CODEC_CONFIG_SAMPLE_RATE);
403407
#else
404-
(void) ctx;
408+
if (ctx != NULL) {
409+
return ctx->codec->supported_samplerates;
410+
}
405411
return codec->supported_samplerates;
406412
#endif
407413
}

0 commit comments

Comments
 (0)