From 9e40d7155c822a5a7041144f0236412a0fa41134 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 10 Nov 2013 00:52:55 +0100 Subject: ad_spdif: change API usage so that it works on Libav Apparently we were using FFmpeg-specific APIs. I have no idea whether this code is correct on both FFmpeg and Libav (no examples, bad doxygen... why do they even complaint aht people are using their APIs incorrectly?), but it appears to work on FFmpeg. That was also the case before commit ebc4ccb though, where it used internal libavformat symbols. Untested on Libav, Travis will tell us. --- audio/decode/ad_spdif.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'audio/decode') diff --git a/audio/decode/ad_spdif.c b/audio/decode/ad_spdif.c index bb7cd27e93..f03041d6a6 100644 --- a/audio/decode/ad_spdif.c +++ b/audio/decode/ad_spdif.c @@ -82,8 +82,12 @@ static int init(sh_audio_t *sh, const char *decoder) struct spdifContext *spdif_ctx = talloc_zero(NULL, struct spdifContext); sh->context = spdif_ctx; - AVFormatContext *lavf_ctx = NULL; - if (avformat_alloc_output_context2(&lavf_ctx, NULL, "spdif", NULL) < 0) + AVFormatContext *lavf_ctx = avformat_alloc_context(); + if (!lavf_ctx) + goto fail; + + lavf_ctx->oformat = av_guess_format("spdif", NULL, NULL); + if (!lavf_ctx->oformat) goto fail; spdif_ctx->lavf_ctx = lavf_ctx; @@ -98,8 +102,10 @@ static int init(sh_audio_t *sh, const char *decoder) goto fail; } - // Request minimal buffering + // Request minimal buffering (not available on Libav) +#if LIBAVFORMAT_VERSION_MICRO >= 100 lavf_ctx->pb->direct = 1; +#endif AVStream *stream = avformat_new_stream(lavf_ctx, 0); if (!stream) -- cgit v1.2.3