Skip to content

Commit 1bce3bd

Browse files
committed
Audio file format plugins: set channels information
1 parent aab07b5 commit 1bce3bd

File tree

15 files changed

+26
-0
lines changed

15 files changed

+26
-0
lines changed

src/aac/aac.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ bool AACDecoder::read_tag (const char * filename, VFSFile & file, Tuple & tuple,
269269
tuple.set_int (Tuple::Length, length);
270270
if (bitrate > 0)
271271
tuple.set_int (Tuple::Bitrate, bitrate);
272+
if (channels > 0)
273+
tuple.set_int (Tuple::Channels, channels);
272274

273275
tuple.fetch_stream_info (file);
274276

src/adplug/adplug-xmms.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ bool AdPlugXMMS::read_tag (const char * filename, VFSFile & file, Tuple & tuple,
166166
tuple.set_str (Tuple::Codec, p->gettype().c_str());
167167
tuple.set_str (Tuple::Quality, _("sequenced"));
168168
tuple.set_int (Tuple::Length, p->songlength (plr.subsong));
169+
tuple.set_int (Tuple::Channels, 2);
169170
delete p;
170171

171172
return true;

src/amidiplug/amidi-plug.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,15 @@ bool AMIDIPlug::read_tag (const char * filename, VFSFile & file, Tuple & tuple,
148148
if (! mf.parse_from_file (filename, file))
149149
return false;
150150

151+
int channels;
152+
int bitdepth;
153+
int samplerate;
154+
155+
backend_audio_info (& channels, & bitdepth, & samplerate);
156+
151157
tuple.set_str (Tuple::Codec, "MIDI");
152158
tuple.set_int (Tuple::Length, mf.length / 1000);
159+
tuple.set_int (Tuple::Channels, channels);
153160

154161
return true;
155162
}

src/cdaudio/cdaudio-ng.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ bool CDAudio::read_tag (const char * filename, VFSFile & file, Tuple & tuple,
399399
tuple.set_int (Tuple::Track, trackno);
400400
tuple.set_int (Tuple::Length, calculate_track_length
401401
(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn));
402+
tuple.set_int (Tuple::Channels, 2);
402403

403404
if (trackinfo[trackno].name)
404405
tuple.set_str (Tuple::Title, trackinfo[trackno].name);

src/console/Audacious_Driver.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ bool ConsolePlugin::read_tag(const char *filename, VFSFile &file, Tuple &tuple,
192192
tuple.set_subtunes(info.track_count, nullptr);
193193

194194
tuple.set_int (Tuple::Length, get_track_length (info));
195+
tuple.set_int (Tuple::Channels, 2);
195196

196197
return true;
197198
}

src/flac/metadata.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ bool FLACng::read_tag (const char * filename, VFSFile & file, Tuple & tuple, Ind
337337

338338
tuple.set_int (Tuple::Bitrate, (bitrate + 500) / 1000);
339339
}
340+
341+
if (metadata->data.stream_info.channels > 0)
342+
tuple.set_int(Tuple::Channels, metadata->data.stream_info.channels);
340343
break;
341344
}
342345

src/metronom/metronom.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ bool Metronome::read_tag(const char *filename, VFSFile &file, Tuple &tuple, Inde
227227
return false;
228228

229229
tuple.set_str(Tuple::Title, desc);
230+
tuple.set_int(Tuple::Channels, 1);
230231
return true;
231232
}
232233

src/modplug/modplugbmp.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ bool ModplugXMMS::read_tag (const char * filename, VFSFile & file, Tuple & tuple
320320
tuple.set_str (Tuple::Codec, tmps);
321321
tuple.set_str (Tuple::Quality, _("sequenced"));
322322
tuple.set_int (Tuple::Length, lSoundFile->GetSongTime() * 1000);
323+
tuple.set_int (Tuple::Channels, lSoundFile->GetNumChannels());
323324

324325
const char *tmps2 = lSoundFile->GetTitle();
325326
// Chop any leading spaces off. They are annoying in the playlist.

src/mpg123/mpg123.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ static bool read_mpg123_info(const char * filename, VFSFile & file,
249249

250250
tuple.set_int(Tuple::Bitrate, s.info.bitrate);
251251
tuple.set_str(Tuple::Codec, make_format_string(&s.info));
252+
tuple.set_int(Tuple::Channels, s.channels);
252253

253254
const char * chan_str = (s.channels == 2)
254255
? _("Stereo")

src/openmpt/mpt.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class MPTPlugin : public InputPlugin
9191

9292
tuple.set_int(Tuple::Length, mpt.duration());
9393
tuple.set_str(Tuple::Title, mpt.title());
94+
tuple.set_int(Tuple::Channels, mpt.channels());
9495

9596
return true;
9697
}

0 commit comments

Comments
 (0)