Before dictionaries there was a loop, so if-else way was ok, but not now. Also, locale-dependent atof().
Remove unnecessary replaygain stuff from flac demuxer.
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
#include <string.h>
-/*****************************************************************************
- * Meta data helpers
- *****************************************************************************/
-static inline void vlc_audio_replay_gain_MergeFromMeta( audio_replay_gain_t *p_dst,
- const vlc_meta_t *p_meta )
-{
- const char * psz_value;
-
- if( !p_meta )
- return;
-
- if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_TRACK_GAIN")) ||
- (psz_value = vlc_meta_GetExtra(p_meta, "RG_RADIO")) )
- {
- p_dst->pb_gain[AUDIO_REPLAY_GAIN_TRACK] = true;
- p_dst->pf_gain[AUDIO_REPLAY_GAIN_TRACK] = atof( psz_value );
- }
- else if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_TRACK_PEAK" )) ||
- (psz_value = vlc_meta_GetExtra(p_meta, "RG_PEAK" )) )
- {
- p_dst->pb_peak[AUDIO_REPLAY_GAIN_TRACK] = true;
- p_dst->pf_peak[AUDIO_REPLAY_GAIN_TRACK] = atof( psz_value );
- }
- else if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_ALBUM_GAIN" )) ||
- (psz_value = vlc_meta_GetExtra(p_meta, "RG_AUDIOPHILE" )) )
- {
- p_dst->pb_gain[AUDIO_REPLAY_GAIN_ALBUM] = true;
- p_dst->pf_gain[AUDIO_REPLAY_GAIN_ALBUM] = atof( psz_value );
- }
- else if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_ALBUM_PEAK" )) )
- {
- p_dst->pb_peak[AUDIO_REPLAY_GAIN_ALBUM] = true;
- p_dst->pf_peak[AUDIO_REPLAY_GAIN_ALBUM] = atof( psz_value );
- }
-}
-
/*****************************************************************************
* Seek point: (generalisation of chapters)
*****************************************************************************/
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
+#include <vlc_charset.h>
#include <vlc_aout.h>
#include <vlc_input.h>
#include <vlc_sout.h>
audio_replay_gain_t *r = &p_dec->fmt_out.audio_replay_gain;
r->pb_gain[AUDIO_REPLAY_GAIN_TRACK] = true;
- r->pf_gain[AUDIO_REPLAY_GAIN_TRACK] = atof( psz_value );
+ r->pf_gain[AUDIO_REPLAY_GAIN_TRACK] = us_atof( psz_value );
}
else if( !strcasecmp( psz_name, "REPLAYGAIN_TRACK_PEAK" ) ||
!strcasecmp( psz_name, "RG_PEAK" ) )
audio_replay_gain_t *r = &p_dec->fmt_out.audio_replay_gain;
r->pb_peak[AUDIO_REPLAY_GAIN_TRACK] = true;
- r->pf_peak[AUDIO_REPLAY_GAIN_TRACK] = atof( psz_value );
+ r->pf_peak[AUDIO_REPLAY_GAIN_TRACK] = us_atof( psz_value );
}
else if( !strcasecmp( psz_name, "REPLAYGAIN_ALBUM_GAIN" ) ||
!strcasecmp( psz_name, "RG_AUDIOPHILE" ) )
audio_replay_gain_t *r = &p_dec->fmt_out.audio_replay_gain;
r->pb_gain[AUDIO_REPLAY_GAIN_ALBUM] = true;
- r->pf_gain[AUDIO_REPLAY_GAIN_ALBUM] = atof( psz_value );
+ r->pf_gain[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( psz_value );
}
else if( !strcasecmp( psz_name, "REPLAYGAIN_ALBUM_PEAK" ) )
{
audio_replay_gain_t *r = &p_dec->fmt_out.audio_replay_gain;
r->pb_peak[AUDIO_REPLAY_GAIN_ALBUM] = true;
- r->pf_peak[AUDIO_REPLAY_GAIN_ALBUM] = atof( psz_value );
+ r->pf_peak[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( psz_value );
}
else if( !strcasecmp( psz_name, "METADATA_BLOCK_PICTURE" ) )
{ /* Do nothing, for now */ }
decoder_t *p_packetizer;
vlc_meta_t *p_meta;
- audio_replay_gain_t replay_gain;
int64_t i_time_offset;
int64_t i_pts;
p_demux->p_sys = p_sys;
p_sys->b_start = true;
p_sys->p_meta = NULL;
- memset( &p_sys->replay_gain, 0, sizeof(p_sys->replay_gain) );
p_sys->i_length = 0;
p_sys->i_time_offset = 0;
p_sys->i_pts = 0;
p_sys->attachments[p_sys->i_cover_idx]->psz_name );
vlc_meta_Set( p_sys->p_meta, vlc_meta_ArtworkURL, psz_url );
}
- vlc_audio_replay_gain_MergeFromMeta( &p_sys->replay_gain, p_sys->p_meta );
return VLC_SUCCESS;
}
if( p_sys->p_es == NULL )
{
p_sys->p_packetizer->fmt_out.b_packetized = true;
- p_sys->p_packetizer->fmt_out.audio_replay_gain = p_sys->replay_gain;
p_sys->p_es = es_out_Add( p_demux->out, &p_sys->p_packetizer->fmt_out);
}
void input_SplitMRL( const char **, const char **, const char **,
const char **, char * );
+/* meta.c */
+void vlc_audio_replay_gain_MergeFromMeta( audio_replay_gain_t *p_dst,
+ const vlc_meta_t *p_meta );
+
#endif
#include <vlc_url.h>
#include <vlc_arrays.h>
#include <vlc_modules.h>
+#include <vlc_charset.h>
#include "input_internal.h"
#include "../playlist/art.h"
vlc_object_release( p_export );
return VLC_EGENERIC;
}
+
+void vlc_audio_replay_gain_MergeFromMeta( audio_replay_gain_t *p_dst,
+ const vlc_meta_t *p_meta )
+{
+ const char * psz_value;
+
+ if( !p_meta )
+ return;
+
+ if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_TRACK_GAIN")) ||
+ (psz_value = vlc_meta_GetExtra(p_meta, "RG_RADIO")) )
+ {
+ p_dst->pb_gain[AUDIO_REPLAY_GAIN_TRACK] = true;
+ p_dst->pf_gain[AUDIO_REPLAY_GAIN_TRACK] = us_atof( psz_value );
+ }
+
+ if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_TRACK_PEAK" )) ||
+ (psz_value = vlc_meta_GetExtra(p_meta, "RG_PEAK" )) )
+ {
+ p_dst->pb_peak[AUDIO_REPLAY_GAIN_TRACK] = true;
+ p_dst->pf_peak[AUDIO_REPLAY_GAIN_TRACK] = us_atof( psz_value );
+ }
+
+ if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_ALBUM_GAIN" )) ||
+ (psz_value = vlc_meta_GetExtra(p_meta, "RG_AUDIOPHILE" )) )
+ {
+ p_dst->pb_gain[AUDIO_REPLAY_GAIN_ALBUM] = true;
+ p_dst->pf_gain[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( psz_value );
+ }
+
+ if( (psz_value = vlc_meta_GetExtra(p_meta, "REPLAYGAIN_ALBUM_PEAK" )) )
+ {
+ p_dst->pb_peak[AUDIO_REPLAY_GAIN_ALBUM] = true;
+ p_dst->pf_peak[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( psz_value );
+ }
+}