1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
/*
*
* $Id: k3btrack.cpp 619556 2007-01-03 17:38:12Z trueg $
* Copyright (C) 2003-2007 Sebastian Trueg <trueg@k3b.org>
*
* This file is part of the K3b project.
* Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* See the file "COPYING" for the exact licensing terms.
*/
#include "k3btrack.h"
K3bDevice::Track::Track()
: m_type(-1),
m_mode(-1),
m_copyPermitted(true),
m_preEmphasis(false),
m_session(0)
{
}
K3bDevice::Track::Track( const Track& track )
: m_firstSector( track.firstSector() ),
m_lastSector( track.lastSector() ),
m_index0( track.index0() ),
m_type( track.type() ),
m_mode( track.mode() ),
m_copyPermitted( track.copyPermitted() ),
m_preEmphasis( track.preEmphasis() ),
m_session( track.session() ),
m_indices( track.indices() )
{
}
K3bDevice::Track::Track( const K3b::Msf& firstSector,
const K3b::Msf& lastSector,
int type,
int mode )
: m_firstSector( firstSector ),
m_lastSector( lastSector ),
m_type( type ),
m_mode( mode ),
m_copyPermitted(true),
m_preEmphasis(false),
m_session(0)
{
}
K3bDevice::Track& K3bDevice::Track::operator=( const K3bTrack& track )
{
if( this != &track ) {
m_firstSector = track.firstSector();
m_lastSector = track.lastSector();
m_index0 = track.index0();
m_type = track.type();
m_mode = track.mode();
m_indices = track.indices();
}
return *this;
}
K3b::Msf K3bDevice::Track::length() const
{
// +1 since the last sector is included
return m_lastSector - m_firstSector + 1;
}
K3b::Msf K3bDevice::Track::realAudioLength() const
{
if( index0() > 0 )
return index0();
else
return length();
}
void K3bDevice::Track::setIndex0( const K3b::Msf& msf )
{
if( msf <= m_lastSector-m_firstSector )
m_index0 = msf;
}
int K3bDevice::Track::indexCount() const
{
return m_indices.count()-1;
}
bool K3bDevice::Track::operator==( const Track& other ) const
{
return( m_firstSector == other.m_firstSector &&
m_lastSector == other.m_lastSector &&
m_index0 == other.m_index0 &&
m_nextWritableAddress == other.m_nextWritableAddress &&
m_freeBlocks == other.m_freeBlocks &&
m_type == other.m_type &&
m_mode == other.m_mode &&
m_copyPermitted == other.m_copyPermitted &&
m_preEmphasis == other.m_preEmphasis &&
m_session == other.m_session &&
m_indices == other.m_indices &&
m_isrc == other.m_isrc );
}
bool K3bDevice::Track::operator!=( const Track& other ) const
{
return !operator==( other );
}
|