00001 00010 /* 00011 * Copyright (c) 2003, Matt Beard 00012 * 00013 * This software is provided 'as-is', without any express or implied warranty. 00014 * In no event will the authors be held liable for any damages arising from 00015 * the use of this software. 00016 * 00017 * Permission is granted to anyone to use this software for any purpose, 00018 * including commercial applications, and to alter it and redistribute it 00019 * freely, subject to the following restrictions: 00020 * 00021 * 1. The origin of this software must not be misrepresented; you must 00022 * not claim that you wrote the original software. If you use this 00023 * software in a product, an acknowledgment in the product 00024 * documentation would be appreciated but is not required. 00025 * 00026 * 2. Altered source versions must be plainly marked as such, and must 00027 * not be misrepresented as being the original software. 00028 * 00029 * 3. This notice may not be removed or altered from any source 00030 * distribution. 00031 */ 00032 #ifndef MXFLIB__RIP_H 00033 #define MXFLIB__RIP_H 00034 00035 #include <mxflib/partition.h> 00036 00037 00038 #include <list> 00039 00040 namespace mxflib 00041 { 00043 class PartitionInfo : public RefCount<PartitionInfo> 00044 { 00045 public: 00046 PartitionPtr ThePartition; 00047 00050 Position ByteOffset; 00051 00063 UInt32 BodySID; 00064 00070 protected: 00071 UInt32 IndexSID; 00072 00073 bool KnownSIDs; 00074 00080 Position StreamOffset; 00081 00083 Length StreamByteCount; 00084 00087 Position EstStreamOffset; 00088 00090 Length EstStreamByteCount; 00091 00094 Position EssenceStart; 00095 00096 public: 00097 PartitionInfo(PartitionPtr Part = NULL, Position Offset = -1, UInt32 SID = 0); 00098 00100 bool operator< (PartitionInfo &Other) { return (ByteOffset < Other.ByteOffset); } 00101 00103 PartitionPtr &GetPartition(void) { return ThePartition; } 00104 00106 void SetPartition(PartitionPtr Val) { ThePartition = Val; } 00107 00109 UInt32 GetBodySID(void) const { return BodySID; } 00110 00112 void SetBodySID(UInt32 Val) { BodySID = Val; } 00113 00115 UInt32 GetIndexSID(void) const { return IndexSID; } 00116 00118 void SetIndexSID(UInt32 Val) { IndexSID = Val; } 00119 00121 bool SIDsKnown(void) const { return KnownSIDs; } 00122 00124 void SetKnownSIDs(bool Val) { KnownSIDs = Val; } 00125 00127 void SetSIDs(UInt32 NewBodySID, UInt32 NewIndexSID) 00128 { 00129 BodySID = NewBodySID; 00130 IndexSID = NewIndexSID; 00131 KnownSIDs = true; 00132 } 00133 00135 Position GetByteOffset(void) const { return ByteOffset; } 00136 00138 void SetByteOffset(Position Val) { ByteOffset = Val; } 00139 00141 Position GetStreamOffset(void) const { return StreamOffset; } 00142 00144 void SetStreamOffset(Position Val) { StreamOffset = Val; } 00145 00147 Position GetEstimatedStreamOffset(void) const { return EstStreamOffset; } 00148 00150 void SetEstimatedStreamOffset(Position Val) { EstStreamOffset = Val; } 00151 00153 Position GetEssenceStart(void) const { return EssenceStart; } 00154 00156 void SetEssenceStart(Position Val) { EssenceStart = Val; } 00157 }; 00158 00160 typedef SmartPtr<PartitionInfo> PartitionInfoPtr; 00161 00163 typedef std::map<Position, PartitionInfoPtr> PartitionInfoMap; 00164 } 00165 00166 00167 namespace mxflib 00168 { 00170 00173 class RIP : public PartitionInfoMap 00174 { 00175 public: 00176 // DRAGONS: This should probably mutate into a "MatchedPysical" property 00177 bool isGenerated; 00178 00179 public: 00180 RIP(); 00181 ~RIP(); 00182 00184 00186 PartitionInfoPtr AddPartition(PartitionPtr Part, Position Offset = -1, UInt32 SID = 0); 00187 00189 00191 PartitionInfoPtr FindPreviousPartition(Position Pos); 00192 00194 00196 PartitionInfoPtr FindNextPartition(Position Pos); 00197 00199 00203 PartitionInfoPtr FindPartition(UInt32 SID, Position StreamOffset); 00204 }; 00205 } 00206 00207 #endif // MXFLIB__RIP_H