oggpage.h
Go to the documentation of this file.
1 /***************************************************************************
2  copyright : (C) 2002 - 2008 by Scott Wheeler
3  email : wheeler@kde.org
4  ***************************************************************************/
5 
6 /***************************************************************************
7  * This library is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU Lesser General Public License version *
9  * 2.1 as published by the Free Software Foundation. *
10  * *
11  * This library is distributed in the hope that it will be useful, but *
12  * WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the Free Software *
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
19  * 02110-1301 USA *
20  * *
21  * Alternatively, this file is available under the Mozilla Public *
22  * License Version 1.1. You may obtain a copy of the License at *
23  * http://www.mozilla.org/MPL/ *
24  ***************************************************************************/
25 
26 #ifndef TAGLIB_OGGPAGE_H
27 #define TAGLIB_OGGPAGE_H
28 
29 #include "taglib_export.h"
30 #include "tbytevectorlist.h"
31 
32 namespace TagLib {
33 
34  namespace Ogg {
35 
36  class File;
37  class PageHeader;
38 
40 
53  {
54  public:
58  Page(File *file, long pageOffset);
59 
60  virtual ~Page();
61 
65  long fileOffset() const;
66 
71  const PageHeader *header() const;
72 
79  Page* getCopyWithNewPageSequenceNumber(int sequenceNumber);
80 
87  int firstPacketIndex() const;
88 
94  void setFirstPacketIndex(int index);
95 
104  DoesNotContainPacket = 0x0000,
106  CompletePacket = 0x0001,
108  BeginsWithPacket = 0x0002,
110  EndsWithPacket = 0x0004
111  };
112 
119  ContainsPacketFlags containsPacket(int index) const;
120 
124  uint packetCount() const;
125 
132  ByteVectorList packets() const;
133 
137  int size() const;
138 
139  ByteVector render() const;
140 
160  Repaginate
161  };
162 
182  static List<Page *> paginate(const ByteVectorList &packets,
183  PaginationStrategy strategy,
184  uint streamSerialNumber,
185  int firstPage,
186  bool firstPacketContinued = false,
187  bool lastPacketCompleted = true,
188  bool containsLastPacket = false);
189 
190  protected:
195  Page(const ByteVectorList &packets,
196  uint streamSerialNumber,
197  int pageNumber,
198  bool firstPacketContinued = false,
199  bool lastPacketCompleted = true,
200  bool containsLastPacket = false);
201 
202  private:
203  Page(const Page &);
204  Page &operator=(const Page &);
205 
206  class PagePrivate;
207  PagePrivate *d;
208  };
209  }
210 }
211 #endif