Data tracks are now filtered out. This should fix bug #1345 - but I did not yet test it.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22023 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b78583734c
commit
ed432e8ec6
@ -444,6 +444,27 @@ fill_stat_buffer(Volume *volume, Inode *inode, Attribute *attribute,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
is_data_track(const scsi_toc_track& track)
|
||||||
|
{
|
||||||
|
return (track.control & 4) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint32
|
||||||
|
count_audio_tracks(scsi_toc_toc* toc)
|
||||||
|
{
|
||||||
|
uint32 lastTrack = toc->last_track + 1 - toc->first_track;
|
||||||
|
uint32 count = 0;
|
||||||
|
for (uint32 i = 0; i < lastTrack; i++) {
|
||||||
|
if (!is_data_track(toc->tracks[i]))
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - Volume class
|
// #pragma mark - Volume class
|
||||||
|
|
||||||
|
|
||||||
@ -520,6 +541,11 @@ Volume::Mount(const char* device)
|
|||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
status_t status = read_table_of_contents(fDevice, toc, 1024);
|
status_t status = read_table_of_contents(fDevice, toc, 1024);
|
||||||
|
|
||||||
|
// there has to be at least one audio track
|
||||||
|
if (status == B_OK && count_audio_tracks(toc) == 0)
|
||||||
|
status = B_BAD_TYPE;
|
||||||
|
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
free(toc);
|
free(toc);
|
||||||
return status;
|
return status;
|
||||||
@ -558,6 +584,11 @@ Volume::Mount(const char* device)
|
|||||||
+ next.second * kFramesPerSecond + next.frame
|
+ next.second * kFramesPerSecond + next.frame
|
||||||
- startFrame;
|
- startFrame;
|
||||||
|
|
||||||
|
totalFrames += frames;
|
||||||
|
|
||||||
|
if (is_data_track(toc->tracks[i]))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (text.titles[i] != NULL) {
|
if (text.titles[i] != NULL) {
|
||||||
if (text.artists[i] != NULL) {
|
if (text.artists[i] != NULL) {
|
||||||
snprintf(title, sizeof(title), "%02ld. %s - %s.wav", track,
|
snprintf(title, sizeof(title), "%02ld. %s - %s.wav", track,
|
||||||
@ -577,8 +608,6 @@ Volume::Mount(const char* device)
|
|||||||
title[j] = ' ';
|
title[j] = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
totalFrames += frames;
|
|
||||||
|
|
||||||
Inode *inode = _CreateNode(fRootNode, title, startFrame, frames,
|
Inode *inode = _CreateNode(fRootNode, title, startFrame, frames,
|
||||||
S_IFREG | 0444);
|
S_IFREG | 0444);
|
||||||
if (inode == NULL)
|
if (inode == NULL)
|
||||||
@ -1218,6 +1247,11 @@ cdda_identify_partition(int fd, partition_data *partition, void **_cookie)
|
|||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
status_t status = read_table_of_contents(fd, toc, 1024);
|
status_t status = read_table_of_contents(fd, toc, 1024);
|
||||||
|
|
||||||
|
// there has to be at least a single audio track
|
||||||
|
if (status == B_OK && count_audio_tracks(toc) == 0)
|
||||||
|
status = B_BAD_TYPE;
|
||||||
|
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
free(toc);
|
free(toc);
|
||||||
return status;
|
return status;
|
||||||
|
Loading…
Reference in New Issue
Block a user