QTAtomReader.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 :miv */
3 /*
4 //=BEGIN SONGBIRD GPL
5 //
6 // This file is part of the Songbird web player.
7 //
8 // Copyright(c) 2005-2009 POTI, Inc.
9 // http://www.songbirdnest.com
10 //
11 // This file may be licensed under the terms of of the
12 // GNU General Public License Version 2 (the GPL).
13 //
14 // Software distributed under the License is distributed
15 // on an AS IS basis, WITHOUT WARRANTY OF ANY KIND, either
16 // express or implied. See the GPL for the specific language
17 // governing rights and limitations.
18 //
19 // You should have received a copy of the GPL along with this
20 // program. If not, go to http://www.gnu.org/licenses/gpl.html
21 // or write to the Free Software Foundation, Inc.,
22 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 //
24 //=END SONGBIRD GPL
25 */
26 
27 #ifndef __QT_ATOM_READER_H__
28 #define __QT_ATOM_READER_H__
29 
30 //------------------------------------------------------------------------------
31 //------------------------------------------------------------------------------
32 //
33 // QuickTime atom reader services.
34 //
35 //------------------------------------------------------------------------------
36 //------------------------------------------------------------------------------
37 
43 //------------------------------------------------------------------------------
44 //
45 // QuickTime atom reader imported services.
46 //
47 //------------------------------------------------------------------------------
48 
49 // Local imports.
50 #include "sbIPDUtils.h"
51 
52 // Mozilla imports.
53 #include <nsCOMPtr.h>
54 #include <nsIInputStream.h>
55 #include <nsIFile.h>
56 #include <nsIFileStreams.h>
57 #include <nsISeekableStream.h>
58 #include <nsStringGlue.h>
59 #include <nsTArray.h>
60 
61 
62 //------------------------------------------------------------------------------
63 //
64 // QuickTime atom reader classes.
65 //
66 //------------------------------------------------------------------------------
67 
73 {
74  //----------------------------------------------------------------------------
75  //
76  // Public interface.
77  //
78  //----------------------------------------------------------------------------
79 
80 public:
81 
82  QTAtomReader();
83 
84  virtual ~QTAtomReader();
85 
86  nsresult Open(nsIFile* aFile);
87 
88  void Close(void);
89 
90  nsresult GetFairPlayUserID(PRUint32* aUserID);
91 
92  nsresult GetFairPlayAccountName(nsAString& aAccountName);
93 
94  nsresult GetFairPlayUserName(nsAString& aUserName);
95 
96  nsresult GetIEKInfoUserIDs(nsTArray<PRUint32>& aUserIDList);
97 
98  nsresult AtomPathGet(const char* aAtomPath,
99  void* aAtom,
100  PRUint64* aStartOffset,
101  PRUint64* aEndOffset);
102 
103 
104  //----------------------------------------------------------------------------
105  //
106  // Private interface.
107  //
108  //----------------------------------------------------------------------------
109 
110 private:
111 
112  //
113  // mFile File from which to read atoms.
114  // mFileInputStream Streams used for reading file.
115  // mSeekableStream
116  // mInputStream
117  // mAtomHdrSize Size of atom header.
118  //
119 
120  nsCOMPtr<nsIFile> mFile;
121  nsCOMPtr<nsIFileInputStream> mFileInputStream;
122  nsCOMPtr<nsISeekableStream> mSeekableStream;
123  nsCOMPtr<nsIInputStream> mInputStream;
124  PRUint32 mAtomHdrSize;
125 
126  nsresult AtomGet(PRUint32 aAtomType,
127  void* aAtom,
128  PRUint64* aStartOffset,
129  PRUint64* aEndOffset);
130 };
131 
132 
140 SB_AUTO_CLASS(sbAutoQTAtomReader,
141  QTAtomReader*,
142  mValue,
143  { mValue->Close(); delete mValue; },
144  mValue = nsnull);
145 
146 
147 #endif /* __QT_ATOM_READER_H__ */
148 
Songbird iPod Device Utility Definitions.
void Close(void)
nsresult GetFairPlayAccountName(nsAString &aAccountName)
SB_AUTO_CLASS(sbAutoQTAtomReader, QTAtomReader *, mValue,{mValue->Close();delete mValue;}, mValue=nsnull)
virtual ~QTAtomReader()
nsresult GetFairPlayUserName(nsAString &aUserName)
nsresult Open(nsIFile *aFile)
nsresult GetIEKInfoUserIDs(nsTArray< PRUint32 > &aUserIDList)
nsresult AtomPathGet(const char *aAtomPath, void *aAtom, PRUint64 *aStartOffset, PRUint64 *aEndOffset)
nsresult GetFairPlayUserID(PRUint32 *aUserID)