/usr/include/taglib/oggpage.h is in libtag1-dev 1.7-1ubuntu5.
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 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | /***************************************************************************
copyright : (C) 2002 - 2008 by Scott Wheeler
email : wheeler@kde.org
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_OGGPAGE_H
#define TAGLIB_OGGPAGE_H
#include "taglib_export.h"
#include "tbytevectorlist.h"
namespace TagLib {
namespace Ogg {
class File;
class PageHeader;
//! An implementation of Ogg pages
/*!
* This is an implementation of the pages that make up an Ogg stream.
* This handles parsing pages and breaking them down into packets and handles
* the details of packets spanning multiple pages and pages that contiain
* multiple packets.
*
* In most Xiph.org formats the comments are found in the first few packets,
* this however is a reasonably complete implementation of Ogg pages that
* could potentially be useful for non-meta data purposes.
*/
class TAGLIB_EXPORT Page
{
public:
/*!
* Read an Ogg page from the \a file at the position \a pageOffset.
*/
Page(File *file, long pageOffset);
virtual ~Page();
/*!
* Returns the page's position within the file (in bytes).
*/
long fileOffset() const;
/*!
* Returns a pointer to the header for this page. This pointer will become
* invalid when the page is deleted.
*/
const PageHeader *header() const;
/*!
* Returns a copy of the page with \a sequenceNumber set as sequence number.
*
* \see header()
* \see PageHeader::setPageSequenceNumber()
*/
Page* getCopyWithNewPageSequenceNumber(int sequenceNumber);
/*!
* Returns the index of the first packet wholly or partially contained in
* this page.
*
* \see setFirstPacketIndex()
*/
int firstPacketIndex() const;
/*!
* Sets the index of the first packet in the page.
*
* \see firstPacketIndex()
*/
void setFirstPacketIndex(int index);
/*!
* When checking to see if a page contains a given packet this set of flags
* represents the possible values for that packets status in the page.
*
* \see containsPacket()
*/
enum ContainsPacketFlags {
//! No part of the packet is contained in the page
DoesNotContainPacket = 0x0000,
//! The packet is wholly contained in the page
CompletePacket = 0x0001,
//! The page starts with the given packet
BeginsWithPacket = 0x0002,
//! The page ends with the given packet
EndsWithPacket = 0x0004
};
/*!
* Checks to see if the specified \a packet is contained in the current
* page.
*
* \see ContainsPacketFlags
*/
ContainsPacketFlags containsPacket(int index) const;
/*!
* Returns the number of packets (whole or partial) in this page.
*/
uint packetCount() const;
/*!
* Returns a list of the packets in this page.
*
* \note Either or both the first and last packets may be only partial.
* \see PageHeader::firstPacketContinued()
*/
ByteVectorList packets() const;
/*!
* Returns the size of the page in bytes.
*/
int size() const;
ByteVector render() const;
/*!
* Defines a strategy for pagination, or grouping pages into Ogg packets,
* for use with pagination methods.
*
* \note Yes, I'm aware that this is not a canonical "Strategy Pattern",
* the term was simply convenient.
*/
enum PaginationStrategy {
/*!
* Attempt to put the specified set of packets into a single Ogg packet.
* If the sum of the packet data is greater than will fit into a single
* Ogg page -- 65280 bytes -- this will fall back to repagination using
* the recommended page sizes.
*/
SinglePagePerGroup,
/*!
* Split the packet or group of packets into pages that conform to the
* sizes recommended in the Ogg standard.
*/
Repaginate
};
/*!
* Pack \a packets into Ogg pages using the \a strategy for pagination.
* The page number indicater inside of the rendered packets will start
* with \a firstPage and be incremented for each page rendered.
* \a containsLastPacket should be set to true if \a packets contains the
* last page in the stream and will set the appropriate flag in the last
* rendered Ogg page's header. \a streamSerialNumber should be set to
* the serial number for this stream.
*
* \note The "absolute granule position" is currently always zeroed using
* this method as this suffices for the comment headers.
*
* \warning The pages returned by this method must be deleted by the user.
* You can use List<T>::setAutoDelete(true) to set these pages to be
* automatically deleted when this list passes out of scope.
*
* \see PaginationStrategy
* \see List::setAutoDelete()
*/
static List<Page *> paginate(const ByteVectorList &packets,
PaginationStrategy strategy,
uint streamSerialNumber,
int firstPage,
bool firstPacketContinued = false,
bool lastPacketCompleted = true,
bool containsLastPacket = false);
protected:
/*!
* Creates an Ogg packet based on the data in \a packets. The page number
* for each page will be set to \a pageNumber.
*/
Page(const ByteVectorList &packets,
uint streamSerialNumber,
int pageNumber,
bool firstPacketContinued = false,
bool lastPacketCompleted = true,
bool containsLastPacket = false);
private:
Page(const Page &);
Page &operator=(const Page &);
class PagePrivate;
PagePrivate *d;
};
}
}
#endif
|