decoder/ffmpeg: pass AVSampleFormat to ffmpeg_sample_format()

API simplification.
This commit is contained in:
Max Kellermann 2012-10-05 15:14:57 +02:00
parent ddc0283339
commit 9d728b365d

View File

@ -352,10 +352,15 @@ ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is,
return cmd; return cmd;
} }
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 94, 1)
#define AVSampleFormat SampleFormat
#endif
G_GNUC_CONST
static enum sample_format static enum sample_format
ffmpeg_sample_format(G_GNUC_UNUSED const AVCodecContext *codec_context) ffmpeg_sample_format(enum AVSampleFormat sample_fmt)
{ {
switch (codec_context->sample_fmt) { switch (sample_fmt) {
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 94, 1) #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 94, 1)
case AV_SAMPLE_FMT_S16: case AV_SAMPLE_FMT_S16:
#else #else
@ -372,7 +377,7 @@ ffmpeg_sample_format(G_GNUC_UNUSED const AVCodecContext *codec_context)
default: default:
g_warning("Unsupported libavcodec SampleFormat value: %d", g_warning("Unsupported libavcodec SampleFormat value: %d",
codec_context->sample_fmt); sample_fmt);
return SAMPLE_FORMAT_UNDEFINED; return SAMPLE_FORMAT_UNDEFINED;
} }
} }
@ -486,7 +491,7 @@ ffmpeg_decode(struct decoder *decoder, struct input_stream *input)
} }
const enum sample_format sample_format = const enum sample_format sample_format =
ffmpeg_sample_format(codec_context); ffmpeg_sample_format(codec_context->sample_fmt);
if (sample_format == SAMPLE_FORMAT_UNDEFINED) if (sample_format == SAMPLE_FORMAT_UNDEFINED)
return; return;