mpv-player/mpv — pull request #637 by ghedo (2014-03-12 11:38:49+00:00)
Title: Metadata in filters and replaygain for af_volume

#632 follow-up

The track metadata is exported to filters by adding a new field "metadata" to af_instance (this also required to add the same field to af_stream to propagate the pointer). Not sure if there's any better way to do this.

As for the af_volume changes, I simply added the new flags "replaygain_track" and "reaplaygain_album", and the filter will read the REPLAYGAIN_TRACK_GAIN or REPLAYGAIN_ALBUM_GAIN tags accordingly and adjust the gain.

It doesn't attempt anything fancy to support the n-thousand other ways other encoders (e.g. LAME) use to store replaygain information (this may require help from libav). AFAICT the REPLAYGAIN_* format should cover most audio format (mp3, aac, flac, vorbis, ...) and encoders.

It seems to work nicely on my music, but additional testing is probably required.

Also, I haven't tried to figure out how to write tags (or if it's actually possible) yet.