summaryrefslogtreecommitdiffstats
path: root/libk3bdevice/k3btrack.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-03 02:15:56 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-03 02:15:56 +0000
commit50b48aec6ddd451a6d1709c0942477b503457663 (patch)
treea9ece53ec06fd0a2819de7a2a6de997193566626 /libk3bdevice/k3btrack.cpp
downloadk3b-50b48aec6ddd451a6d1709c0942477b503457663.tar.gz
k3b-50b48aec6ddd451a6d1709c0942477b503457663.zip
Added abandoned KDE3 version of K3B
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/k3b@1084400 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libk3bdevice/k3btrack.cpp')
-rw-r--r--libk3bdevice/k3btrack.cpp123
1 files changed, 123 insertions, 0 deletions
diff --git a/libk3bdevice/k3btrack.cpp b/libk3bdevice/k3btrack.cpp
new file mode 100644
index 0000000..6efcdcb
--- /dev/null
+++ b/libk3bdevice/k3btrack.cpp
@@ -0,0 +1,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 );
+}