00001 /* 00002 * Copyright (c) 2004 MUSIC TECHNOLOGY GROUP (MTG) 00003 * UNIVERSITAT POMPEU FABRA 00004 * 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 * 00020 */ 00021 00022 #ifndef __SDIFHeader__ 00023 #define __SDIFHeader__ 00024 00025 #include "SDIFType.hxx" 00026 00027 namespace SDIF 00028 { 00029 00038 class FrameHeader 00039 { 00040 public: 00041 //* Identifier indicating the kind of frame */ 00042 TypeId mType; 00043 //* Size in bytes, of the frame, not including the type or size 00044 CLAM::TInt32 mSize; 00045 public: 00049 FrameHeader(const TypeId& type, CLAM::TInt32 size); 00050 00051 static CLAM::TInt32 SizeInFile(void) 00052 { 00053 return 00054 sizeof(TypeId)+ // mType 00055 sizeof(CLAM::TInt32); // mSize 00056 } 00057 }; 00058 00063 class DataFrameHeader:public FrameHeader 00064 { 00065 public: 00066 //* Timestamp 00067 CLAM::TFloat64 mTime; 00068 //* Stream ID @see Stream 00069 CLAM::TInt32 mStreamId; 00070 //* Number of data matrixes in the frame. @see Matrix 00071 CLAM::TInt32 mnMatrices; 00072 public: 00078 DataFrameHeader(const TypeId& type,CLAM::TFloat64 time=0.,CLAM::TInt32 id=0); 00079 00080 static CLAM::TInt32 SizeInFile(void) 00081 { 00082 return 00083 sizeof(CLAM::TFloat64)+ // mTime 00084 sizeof(CLAM::TInt32)+ // mStreamId 00085 sizeof(CLAM::TInt32); // mnMatrices 00086 } 00087 }; 00088 00091 class MatrixHeader 00092 { 00093 public: 00094 00095 //* Identifier indicating the matrix type 00096 TypeId mType; 00097 //* Identifier indicating the type of data in the matrix 00098 DataType mDataType; 00099 //* Number of rows in the matrix 00100 CLAM::TInt32 mnRows; 00101 //* Number of columns in the matrix 00102 CLAM::TInt32 mnColumns; 00103 00104 public: 00112 static CLAM::TInt32 SizeInFile(void) 00113 { 00114 return 00115 sizeof(TypeId)+ 00116 sizeof(CLAM::TInt32)+ // mDataType 00117 sizeof(CLAM::TInt32)+ // mnRows 00118 sizeof(CLAM::TInt32); // mnColumns 00119 } 00120 00121 MatrixHeader() 00122 { 00123 } 00124 00125 MatrixHeader( 00126 const TypeId& type, 00127 DataType dataType, 00128 CLAM::TInt32 nRows, CLAM::TInt32 nColumns); 00129 }; 00130 00131 } 00132 00133 #endif 00134