summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-02-16 15:14:55 +0100
committerwm4 <wm4@nowhere>2020-02-16 15:14:55 +0100
commit7d11eda72e90d7aa9df25127bd810aa7b191029c (patch)
tree5c474862236dc62d136fe44dfdf3737bc808b829 /audio
parenta4eb8f75c0644ce5cf7c0bcea6b3efd2a886027d (diff)
downloadmpv-7d11eda72e90d7aa9df25127bd810aa7b191029c.tar.bz2
mpv-7d11eda72e90d7aa9df25127bd810aa7b191029c.tar.xz
Remove remains of Libav compatibility
Libav seems rather dead: no release for 2 years, no new git commits in master for almost a year (with one exception ~6 months ago). From what I can tell, some developers resigned themselves to the horrifying idea to post patches to ffmpeg-devel instead, while the rest of the developers went on to greener pastures. Libav was a better project than FFmpeg. Unfortunately, FFmpeg won, because it managed to keep the name and website. Libav was pushed more and more into obscurity: while there was initially a big push for Libav, FFmpeg just remained "in place" and visible for most people. FFmpeg was slowly draining all manpower and energy from Libav. A big part of this was that FFmpeg stole code from Libav (regular merges of the entire Libav git tree), making it some sort of Frankenstein mirror of Libav, think decaying zombie with additional legs ("features") nailed to it. "Stealing" surely is the wrong word; I'm just aping the language that some of the FFmpeg members used to use. All that is in the past now, I'm probably the only person left who is annoyed by this, and with this commit I'm putting this decade long problem finally to an end. I just thought I'd express my annoyance about this fucking shitshow one last time. The most intrusive change in this commit is the resample filter, which originally used libavresample. Since the FFmpeg developer refused to enable libavresample by default for drama reasons, and the API was slightly different, so the filter used some big preprocessor mess to make it compatible to libswresample. All that falls away now. The simplification to the build system is also significant.
Diffstat (limited to 'audio')
-rw-r--r--audio/aframe.c6
-rw-r--r--audio/decode/ad_lavc.c9
-rw-r--r--audio/decode/ad_spdif.c4
3 files changed, 1 insertions, 18 deletions
diff --git a/audio/aframe.c b/audio/aframe.c
index 655a4a38c3..35259ba208 100644
--- a/audio/aframe.c
+++ b/audio/aframe.c
@@ -121,11 +121,9 @@ struct mp_aframe *mp_aframe_from_avframe(struct AVFrame *av_frame)
frame->format = format;
mp_chmap_from_lavc(&frame->chmap, frame->av_frame->channel_layout);
-#if LIBAVUTIL_VERSION_MICRO >= 100
// FFmpeg being a stupid POS again
if (frame->chmap.num != frame->av_frame->channels)
mp_chmap_from_channels(&frame->chmap, av_frame->channels);
-#endif
if (av_frame->opaque_ref) {
struct avframe_opaque *op = (void *)av_frame->opaque_ref->data;
@@ -194,10 +192,8 @@ void mp_aframe_config_copy(struct mp_aframe *dst, struct mp_aframe *src)
dst->av_frame->sample_rate = src->av_frame->sample_rate;
dst->av_frame->format = src->av_frame->format;
dst->av_frame->channel_layout = src->av_frame->channel_layout;
-#if LIBAVUTIL_VERSION_MICRO >= 100
// FFmpeg being a stupid POS again
dst->av_frame->channels = src->av_frame->channels;
-#endif
}
// Copy "soft" attributes from src to dst, excluding things which affect
@@ -311,10 +307,8 @@ bool mp_aframe_set_chmap(struct mp_aframe *frame, struct mp_chmap *in)
return false;
frame->chmap = *in;
frame->av_frame->channel_layout = lavc_layout;
-#if LIBAVUTIL_VERSION_MICRO >= 100
// FFmpeg being a stupid POS again
frame->av_frame->channels = frame->chmap.num;
-#endif
return true;
}
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index 8362e918f3..63f9aa0cbe 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -103,10 +103,7 @@ static bool init(struct mp_filter *da, struct mp_codec_params *codec,
ctx->avframe = av_frame_alloc();
lavc_context->codec_type = AVMEDIA_TYPE_AUDIO;
lavc_context->codec_id = lavc_codec->id;
-
-#if LIBAVCODEC_VERSION_MICRO >= 100
lavc_context->pkt_timebase = ctx->codec_timebase;
-#endif
if (opts->downmix && mpopts->audio_output_channels.num_chmaps == 1) {
lavc_context->request_channel_layout =
@@ -117,10 +114,8 @@ static bool init(struct mp_filter *da, struct mp_codec_params *codec,
av_opt_set_double(lavc_context, "drc_scale", opts->ac3drc,
AV_OPT_SEARCH_CHILDREN);
-#if LIBAVCODEC_VERSION_MICRO >= 100
// Let decoder add AV_FRAME_DATA_SKIP_SAMPLES.
av_opt_set(lavc_context, "flags2", "+skip_manual", AV_OPT_SEARCH_CHILDREN);
-#endif
mp_set_avopts(da->log, lavc_context, opts->avopts);
@@ -199,10 +194,8 @@ static int receive_frame(struct mp_filter *da, struct mp_frame *out)
MP_ERR(da, "Error decoding audio.\n");
}
-#if LIBAVCODEC_VERSION_MICRO >= 100
if (priv->avframe->flags & AV_FRAME_FLAG_DISCARD)
av_frame_unref(priv->avframe);
-#endif
if (!priv->avframe->buf[0])
return ret;
@@ -224,7 +217,6 @@ static int receive_frame(struct mp_filter *da, struct mp_frame *out)
priv->next_pts = mp_aframe_end_pts(mpframe);
-#if LIBAVCODEC_VERSION_MICRO >= 100
AVFrameSideData *sd =
av_frame_get_side_data(priv->avframe, AV_FRAME_DATA_SKIP_SAMPLES);
if (sd && sd->size >= 10) {
@@ -232,7 +224,6 @@ static int receive_frame(struct mp_filter *da, struct mp_frame *out)
priv->skip_samples += AV_RL32(d + 0);
priv->trim_samples += AV_RL32(d + 4);
}
-#endif
if (!priv->preroll_done) {
// Skip only if this isn't already handled by AV_FRAME_DATA_SKIP_SAMPLES.
diff --git a/audio/decode/ad_spdif.c b/audio/decode/ad_spdif.c
index ef34042990..0b1977769a 100644
--- a/audio/decode/ad_spdif.c
+++ b/audio/decode/ad_spdif.c
@@ -176,10 +176,8 @@ static int init_filter(struct mp_filter *da, AVPacket *pkt)
goto fail;
}
- // Request minimal buffering (not available on Libav)
-#if LIBAVFORMAT_VERSION_MICRO >= 100
+ // Request minimal buffering
lavf_ctx->pb->direct = 1;
-#endif
AVStream *stream = avformat_new_stream(lavf_ctx, 0);
if (!stream)