2015-10-28, 12:45
Hello,
I've been fiddling around ironic_monkey code for dsf tags. So far I wasn't able to apply replaygain even though it seems kodi reads the tag.
This code read the replaygain info from my dsf tags, but yet replaygain isn't applied. Could I have some guidance on how replaygain works in Kodi? I thought once the replaygain info was passed to the song instance of CmusicInfoTag, that info was picked up by the audioencoder and applied to the stream?
Any help would be welcome since I'm no developper and stuck with this problem.
I've been fiddling around ironic_monkey code for dsf tags. So far I wasn't able to apply replaygain even though it seems kodi reads the tag.
Code:
AVDictionaryEntry* avtag=NULL;
while ((avtag = av_dict_get(fctx->metadata, "", avtag, AV_DICT_IGNORE_SUFFIX)))
{
if (StringUtils::EqualsNoCase(URIUtils::GetExtension(strFileName), ".mka") ||
StringUtils::EqualsNoCase(URIUtils::GetExtension(strFileName), ".dsf"))
{
if (strcasecmp(avtag->key, "title") == 0)
tag.SetTitle(avtag->value);
else if (strcasecmp(avtag->key, "artist") == 0)
tag.SetArtist(avtag->value);
else if (strcasecmp(avtag->key, "album") == 0)
tag.SetAlbum(avtag->value);
else if (strcasecmp(avtag->key, "part_number") == 0 ||
strcasecmp(avtag->key, "track") == 0)
tag.SetTrackNumber(strtol(avtag->value, NULL, 10));
else if (strcasecmp(avtag->key, "album_artist") == 0)
tag.SetAlbumArtist(avtag->value);
else if (strcasecmp(avtag->key, "genre") == 0)
tag.SetGenre(avtag->value);
else if (strcasecmp(avtag->key, "date") == 0)
tag.SetYear(strtol(avtag->value, NULL, 10));
else if (strcasecmp(avtag->key, "replaygain_track_gain") == 0)
replayGainInfo.ParseGain(ReplayGain::TRACK, avtag->value);
else if (strcasecmp(avtag->key, "replaygain_album_gain") == 0)
replayGainInfo.ParseGain(ReplayGain::ALBUM, avtag->value);
else if (strcasecmp(avtag->key, "replaygain_track_peak") == 0)
replayGainInfo.ParsePeak(ReplayGain::TRACK, avtag->value);
else if (strcasecmp(avtag->key, "replaygain_album_peak") == 0)
replayGainInfo.ParsePeak(ReplayGain::ALBUM, avtag->value);
}
}
if (replayGainInfo.Get(ReplayGain::TRACK).Valid() && replayGainInfo.Get(ReplayGain::ALBUM).Valid())
{
tag.SetReplayGain(replayGainInfo);
myfile << "success";
}
else myfile << "failed";
This code read the replaygain info from my dsf tags, but yet replaygain isn't applied. Could I have some guidance on how replaygain works in Kodi? I thought once the replaygain info was passed to the song instance of CmusicInfoTag, that info was picked up by the audioencoder and applied to the stream?
Any help would be welcome since I'm no developper and stuck with this problem.