VLC 4.0.0-dev
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages

Functions to read replay gain tags. More...

Collaboration diagram for Replay Gain:

Data Structures

struct  audio_replay_gain_t
 Audio replay gain. More...
 

Macros

#define AUDIO_REPLAY_GAIN_TRACK   (0)
 Index for track values.
 
#define AUDIO_REPLAY_GAIN_ALBUM   (1)
 Index for album values.
 
#define AUDIO_REPLAY_GAIN_MAX   (2)
 Number of replay gain types.
 

Functions

int vlc_replay_gain_CopyFromMeta (audio_replay_gain_t *p_dst, const vlc_meta_t *p_meta)
 Extracts replay gain info from metadata and copies it into a replay gain structure.
 
float replay_gain_CalcMultiplier (vlc_object_t *obj, const audio_replay_gain_t *p_rg)
 Calculates the replay gain multiplier according to the Replay Gain 2.0 Specification.
 
static void replay_gain_Merge (audio_replay_gain_t *p_dst, const audio_replay_gain_t *p_src)
 Merges replay gain structures.
 
static bool replay_gain_Compare (const audio_replay_gain_t *p_a, const audio_replay_gain_t *p_b)
 Compares two replay gain structures.
 
static void replay_gain_Reset (audio_replay_gain_t *p_rg)
 Reset replay gain structure values.
 

Detailed Description

Functions to read replay gain tags.

Macro Definition Documentation

◆ AUDIO_REPLAY_GAIN_ALBUM

#define AUDIO_REPLAY_GAIN_ALBUM   (1)

Index for album values.

◆ AUDIO_REPLAY_GAIN_MAX

#define AUDIO_REPLAY_GAIN_MAX   (2)

Number of replay gain types.

◆ AUDIO_REPLAY_GAIN_TRACK

#define AUDIO_REPLAY_GAIN_TRACK   (0)

Index for track values.

Function Documentation

◆ replay_gain_CalcMultiplier()

float replay_gain_CalcMultiplier ( vlc_object_t obj,
const audio_replay_gain_t p_rg 
)

Calculates the replay gain multiplier according to the Replay Gain 2.0 Specification.

User preferences control mode, pre-amp, default gain, and peak protection.

Parameters
objcalling vlc object
p_rgreplay gain structure
Returns
linear gain multiplier

References AUDIO_REPLAY_GAIN_ALBUM, AUDIO_REPLAY_GAIN_MAX, AUDIO_REPLAY_GAIN_TRACK, likely, msg_Dbg, audio_replay_gain_t::pb_gain, audio_replay_gain_t::pb_peak, audio_replay_gain_t::pb_reference_loudness, audio_replay_gain_t::pf_gain, audio_replay_gain_t::pf_peak, audio_replay_gain_t::pf_reference_loudness, var_InheritBool(), var_InheritFloat(), and var_InheritString().

Referenced by ReplayGainCallback().

◆ replay_gain_Compare()

static bool replay_gain_Compare ( const audio_replay_gain_t p_a,
const audio_replay_gain_t p_b 
)
inlinestatic

Compares two replay gain structures.

Parameters
p_aFirst replay gain structure
p_bSecond replay gain structure
Returns
true if any gain/peak/reference loudness values or their validity flags differ

References AUDIO_REPLAY_GAIN_MAX, audio_replay_gain_t::pb_gain, audio_replay_gain_t::pb_peak, audio_replay_gain_t::pb_reference_loudness, audio_replay_gain_t::pf_gain, audio_replay_gain_t::pf_peak, and audio_replay_gain_t::pf_reference_loudness.

Referenced by ModuleThread_UpdateAudioFormat().

◆ replay_gain_Merge()

static void replay_gain_Merge ( audio_replay_gain_t p_dst,
const audio_replay_gain_t p_src 
)
inlinestatic

Merges replay gain structures.

Only copies gain/peak/reference loudness values that are:

  • Set in the source
  • Not set in the destination
Parameters
p_dstDestination replay gain structure
p_srcSource replay gain structure

References AUDIO_REPLAY_GAIN_MAX, audio_replay_gain_t::pb_gain, audio_replay_gain_t::pb_peak, audio_replay_gain_t::pb_reference_loudness, audio_replay_gain_t::pf_gain, audio_replay_gain_t::pf_peak, and audio_replay_gain_t::pf_reference_loudness.

Referenced by CreateDecoder(), and EsOutFillEsFmt().

◆ replay_gain_Reset()

static void replay_gain_Reset ( audio_replay_gain_t p_rg)
inlinestatic

◆ vlc_replay_gain_CopyFromMeta()

int vlc_replay_gain_CopyFromMeta ( audio_replay_gain_t p_dst,
const vlc_meta_t p_meta 
)

Extracts replay gain info from metadata and copies it into a replay gain structure.

Supports both capitalized and lowercase metadata tags.

Parameters
p_dstDestination replay gain structure to fill
p_metaMetadata structure to extract values from
Returns
VLC_SUCCESS if either an album or track gain was found, VLC_EGENERIC if no gain was found, VLC_EINVAL if either argument is null

References ARRAY_SIZE, AUDIO_REPLAY_GAIN_ALBUM, AUDIO_REPLAY_GAIN_TRACK, f_value, audio_replay_gain_t::pb_gain, audio_replay_gain_t::pb_peak, audio_replay_gain_t::pb_reference_loudness, audio_replay_gain_t::pf_gain, audio_replay_gain_t::pf_peak, audio_replay_gain_t::pf_reference_loudness, VLC_EGENERIC, VLC_EINVAL, vlc_meta_GetExtra(), vlc_strtof_c(), and VLC_SUCCESS.

Referenced by EsOutFillEsFmt().