1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 /////////////////////////////////////////////////////////////////////////////// 19 // 20 // sequence_gen.h 21 // 22 // 23 // 24 // 25 /////////////////////////////////////////////////////////////////////////////// 26 27 #ifndef SEQUENCE_GEN_H 28 #define SEQUENCE_GEN_H 29 30 #include "oscl_mem.h" 31 #include "oscl_vector.h" 32 33 34 #define SEQUENCEGEN_TIMESTAMP_REPOS_DELTA 10 // ms 35 36 class SequenceGenerator 37 { 38 public: 39 SequenceGenerator(int initialSeqNum = 0, 40 uint32 timestampReposDelta = SEQUENCEGEN_TIMESTAMP_REPOS_DELTA); 41 virtual ~SequenceGenerator(); 42 43 bool registerNextObjectFrag(uint stream, 44 uint objNum, 45 uint objOffset, 46 uint objLen, 47 uint fragLen, 48 bool* inCompleteFlag, 49 bool ibRepositionFlag); 50 51 uint32 generateSequenceNum(uint stream); 52 uint32 generateTimestamp(uint stream, uint32 timestamp, bool reposition = false); 53 54 uint32 getMinTimestamp(); 55 56 void setSeqnum(const uint stream, const uint32 seqnum) ;// set next seqnum for stream 57 private: 58 59 struct StreamSequenceInfo 60 { 61 StreamSequenceInfo() : streamId(-1), 62 currObjectNum(0), 63 currObjectLen(0), 64 currObjectOffset(0), 65 objComplete(false), 66 currSeq(0), 67 timestampBase(0), 68 currTimestamp(0) { } 69 70 int streamId; 71 72 uint currObjectNum; 73 uint currObjectLen; 74 uint currObjectOffset; 75 bool objComplete; 76 77 uint32 currSeq; 78 79 int32 timestampBase; 80 uint32 currTimestamp; 81 }; 82 83 StreamSequenceInfo* getStream(uint stream); 84 85 int initialSeqNum; 86 uint32 timestampReposDelta; 87 88 Oscl_Vector<StreamSequenceInfo, OsclMemAllocator> vStreamInfo; 89 }; 90 91 #endif // SEQUENCE_GEN_H 92