mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user