diff options
author | wm4 <wm4@nowhere> | 2013-11-10 00:52:55 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-10 00:52:55 +0100 |
commit | 9e40d7155c822a5a7041144f0236412a0fa41134 (patch) | |
tree | a2a709e2c3ebd47dc039858f86f83298ef34719d /audio | |
parent | 1a5c863a326f775d94dd995155d1d78448aef6d1 (diff) | |
download | mpv-9e40d7155c822a5a7041144f0236412a0fa41134.tar.bz2 mpv-9e40d7155c822a5a7041144f0236412a0fa41134.tar.xz |
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.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/decode/ad_spdif.c | 12 |
1 files changed, 9 insertions, 3 deletions
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) |