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.
This commit is contained in:
wm4 2013-11-10 00:52:55 +01:00
parent 1a5c863a32
commit 9e40d7155c
1 changed files with 9 additions and 3 deletions

View File

@ -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)