/usr/include/k3baudiodatasource.h is in libk3b-dev 2.0.3-0ubuntu5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | /*
*
* Copyright (C) 2004-2008 Sebastian Trueg <trueg@k3b.org>
*
* This file is part of the K3b project.
* Copyright (C) 1998-2008 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.
*/
#ifndef _K3B_AUDIO_DATA_SOURCE_H_
#define _K3B_AUDIO_DATA_SOURCE_H_
#include <QtCore/QObject>
#include "k3bmsf.h"
#include "k3b_export.h"
namespace K3b {
class AudioTrack;
class AudioDoc;
/**
* An AudioDataSource has an original length which represents the maximum amount of audio
* sectors this source can provide (in special cases this is not true, see AudioZeroData).
*
* It is possible to just use a portion of that data by changing the startOffset and endOffset.
* This will change the actual length of the data provided by this source through the read method.
*
* Sources are part of a list which can be traversed via the prev() and next() methods. This list
* is part of a AudioTrack which in turn is part of a list which is owned by a AudioDoc.
*
* The list may be modified with the take(), moveAfter(), and moveAhead() methods. The source takes
* care of fixing the list and notifying the track about the change (It is also possible to move sources
* from one track to the other).
*
* When a source is deleted it automatically removes itself from it's list.
*/
class LIBK3B_EXPORT AudioDataSource : public QObject
{
Q_OBJECT
friend class AudioTrack;
public:
AudioDataSource();
/**
* Create en identical copy except that the copy will not be in any list.
*/
AudioDataSource( const AudioDataSource& );
virtual ~AudioDataSource();
/**
* The original length of the source is the maximum data which is available
* when startOffset is 0 this is the max for endOffset
*
* Be aware that this may change (see AudioZeroData)
*/
virtual Msf originalLength() const = 0;
/**
* The default implementation returns the originalLength modified by startOffset and endOffset
*/
virtual Msf length() const;
/**
* @return The index of this track (counting from 0)
*/
int sourceIndex() const;
/**
* @return The raw size in pcm samples (16bit, 44800 kHz, stereo)
*/
KIO::filesize_t size() const { return length().audioBytes(); }
virtual bool seek( const Msf& ) = 0;
/**
* Read data from the source.
*/
virtual int read( char* data, unsigned int max ) = 0;
/**
* Type of the data in readable form.
*/
virtual QString type() const = 0;
/**
* The source in readable form (this is the filename for files)
*/
virtual QString sourceComment() const = 0;
/**
* Used in case an error occurred. For now this is used if the
* decoder was not able to decode an audiofile
*/
virtual bool isValid() const { return true; }
/**
* The doc the source is currently a part of or null.
*/
AudioDoc* doc() const;
AudioTrack* track() const { return m_track; }
AudioDataSource* prev() const { return m_prev; }
AudioDataSource* next() const { return m_next; }
AudioDataSource* take();
void moveAfter( AudioDataSource* track );
void moveAhead( AudioDataSource* track );
/**
* Set the start offset from the beginning of the source's originalLength.
*/
virtual void setStartOffset( const Msf& );
/**
* Set the end offset from the beginning of the file. The endOffset sector
* is not included in the data.
* The maximum value is originalLength() which means to use all data.
* 0 means the same as originalLength().
* This has to be bigger than the start offset.
*/
virtual void setEndOffset( const Msf& );
virtual const Msf& startOffset() const { return m_startOffset; }
/**
* The end offset. It is the first sector not included in the data.
* If 0 the last sector is determined by the originalLength
*/
virtual const Msf& endOffset() const { return m_endOffset; }
/**
* Get the last used sector in the source.
* The default implementation uses originalLength() and endOffset()
*/
virtual Msf lastSector() const;
/**
* Create a copy of this source which is not part of a list
*/
virtual AudioDataSource* copy() const = 0;
/**
* Split the source at position pos and return the splitted source
* on success.
* The new source will be moved after this source.
*
* The default implementation uses copy() to create a new source instance
*/
virtual AudioDataSource* split( const Msf& pos );
protected:
/**
* Informs the parent track about changes.
*/
void emitChange();
private:
void fixupOffsets();
AudioTrack* m_track;
AudioDataSource* m_prev;
AudioDataSource* m_next;
Msf m_startOffset;
Msf m_endOffset;
};
}
#endif
|