- Timestamp:
- 11/23/07 08:11:41 (16 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/ppalmers-streaming/src/libstreaming/generic/StreamProcessor.h
r719 r720 81 81 ePS_WaitingForStreamDisable, 82 82 }; 83 83 84 84 ///> set the SP state to a specific value 85 85 void setState(enum eProcessorState); … … 103 103 104 104 bool scheduleStateTransition(enum eProcessorState state, uint64_t time_instant); 105 bool scheduleAndWaitForStateTransition(enum eProcessorState state, 106 uint64_t time_instant, 107 enum eProcessorState wait_state); 108 public: 105 bool waitForState(enum eProcessorState state, unsigned int timeout); 106 107 public: //--- state stuff 109 108 bool isRunning() 110 109 {return m_state == ePS_Running;}; … … 112 111 {return m_state == ePS_DryRunning;}; 113 112 114 //--- state stuff (TODO: cleanup) 113 // these schedule and wait for the state transition 115 114 bool startDryRunning(int64_t time_to_start_at); 116 115 bool startRunning(int64_t time_to_start_at); … … 118 117 bool stopRunning(int64_t time_to_stop_at); 119 118 119 // these only schedule the transition 120 bool scheduleStartDryRunning(int64_t time_to_start_at); 121 bool scheduleStartRunning(int64_t time_to_start_at); 122 bool scheduleStopDryRunning(int64_t time_to_stop_at); 123 bool scheduleStopRunning(int64_t time_to_stop_at); 124 120 125 // the main difference between init and prepare is that when prepare is called, 121 126 // the SP is registered to a manager (FIXME: can't it be called by the manager?) 122 127 bool init(); 123 128 bool prepare(); 129 124 130 ///> stop the SP from running or dryrunning 125 131 bool stop(); 126 // constructor/destructor 127 public: 132 133 public: // constructor/destructor 128 134 StreamProcessor(enum eProcessorType type, int port); 129 135 virtual ~StreamProcessor(); 130 136 131 // the receive/transmit functions 132 public: 137 public: // the public receive/transmit functions 133 138 // the transmit interface accepts frames and provides packets 134 139 // implement these for a transmit SP 135 140 // leave default for a receive SP 136 virtual enum raw1394_iso_disposition137 getPacket(unsigned char *data, unsigned int *length,138 unsigned char *tag, unsigned char *sy,139 int cycle, unsigned int dropped, unsigned int max_length)140 {debugWarning("call not allowed\n"); return RAW1394_ISO_STOP;};141 virtual bool putFrames(unsigned int nbframes, int64_t ts)142 {debugWarning("call not allowed\n"); return false;};143 virtual bool putFramesDry(unsigned int nbframes, int64_t ts)144 {debugWarning("call not allowed\n"); return false;};145 virtual bool processWriteBlock(char *data, unsigned int nevents, unsigned int offset)146 {debugWarning("call not allowed\n"); return false;};147 141 148 142 // the receive interface accepts packets and provides frames 149 150 // the following two methods are to be implemented by subclasses 151 virtual bool processPacketHeader(unsigned char *data, unsigned int length, 152 unsigned char channel, unsigned char tag, unsigned char sy, 153 unsigned int cycle, unsigned int dropped) 154 {debugWarning("call not allowed\n"); return false;}; 155 virtual bool processPacketData(unsigned char *data, unsigned int length, 156 unsigned char channel, unsigned char tag, unsigned char sy, 157 unsigned int cycle, unsigned int dropped) 158 {debugWarning("call not allowed\n"); return false;}; 159 160 // this one is implemented by us 143 // these are implemented by the parent SP 161 144 enum raw1394_iso_disposition 162 145 putPacket(unsigned char *data, unsigned int length, … … 164 147 unsigned int cycle, unsigned int dropped); 165 148 149 enum raw1394_iso_disposition 150 getPacket(unsigned char *data, unsigned int *length, 151 unsigned char *tag, unsigned char *sy, 152 int cycle, unsigned int dropped, unsigned int max_length); 153 166 154 bool getFrames(unsigned int nbframes, int64_t ts); ///< transfer the buffer contents to the client 167 protected: 155 bool putFrames(unsigned int nbframes, int64_t ts); ///< transfer the client contents to the buffer 156 157 protected: // the helper receive/transmit functions 168 158 // to be implemented by the children 159 // the following methods are to be implemented by receive SP subclasses 160 virtual bool processPacketHeader(unsigned char *data, unsigned int length, 161 unsigned char channel, unsigned char tag, 162 unsigned char sy, unsigned int cycle, 163 unsigned int dropped) 164 {debugWarning("call not allowed\n"); return false;}; 165 virtual bool processPacketData(unsigned char *data, unsigned int length, 166 unsigned char channel, unsigned char tag, 167 unsigned char sy, unsigned int cycle, 168 unsigned int dropped) 169 {debugWarning("call not allowed\n"); return false;}; 169 170 virtual bool processReadBlock(char *data, unsigned int nevents, unsigned int offset) 170 171 {debugWarning("call not allowed\n"); return false;}; 171 172 virtual bool provideSilenceBlock(unsigned int nevents, unsigned int offset) 173 {debugWarning("call not allowed\n"); return false;}; 174 175 // the following methods are to be implemented by transmit SP subclasses 176 virtual bool generatePacketHeader(unsigned char *data, unsigned int *length, 177 unsigned char *tag, unsigned char *sy, 178 int cycle, unsigned int dropped, 179 unsigned int max_length) 180 {debugWarning("call not allowed\n"); return false;}; 181 virtual bool generatePacketData(unsigned char *data, unsigned int *length, 182 unsigned char *tag, unsigned char *sy, 183 int cycle, unsigned int dropped, 184 unsigned int max_length) 185 {debugWarning("call not allowed\n"); return false;}; 186 virtual bool generateSilentPacketHeader(unsigned char *data, unsigned int *length, 187 unsigned char *tag, unsigned char *sy, 188 int cycle, unsigned int dropped, 189 unsigned int max_length) 190 {debugWarning("call not allowed\n"); return false;}; 191 virtual bool generateSilentPacketData(unsigned char *data, unsigned int *length, 192 unsigned char *tag, unsigned char *sy, 193 int cycle, unsigned int dropped, 194 unsigned int max_length) 195 {debugWarning("call not allowed\n"); return false;}; 196 virtual bool processWriteBlock(char *data, unsigned int nevents, unsigned int offset) 197 {debugWarning("call not allowed\n"); return false;}; 198 virtual bool transmitSilenceBlock(char *data, unsigned int nevents, unsigned int offset) 172 199 {debugWarning("call not allowed\n"); return false;}; 173 200 … … 175 202 bool getFramesDry(unsigned int nbframes, int64_t ts); 176 203 bool getFramesWet(unsigned int nbframes, int64_t ts); 204 bool putFramesDry(unsigned int nbframes, int64_t ts); 205 bool putFramesWet(unsigned int nbframes, int64_t ts); 206 207 bool transferSilence(unsigned int size); 177 208 178 209 // move to private? … … 188 219 189 220 //--- data buffering and accounting 190 public: // FIXME: should be private 221 public: 222 void getBufferHeadTimestamp ( ffado_timestamp_t *ts, signed int *fc ) 223 {m_data_buffer->getBufferHeadTimestamp(ts, fc);}; 224 void getBufferTailTimestamp ( ffado_timestamp_t *ts, signed int *fc ) 225 {m_data_buffer->getBufferTailTimestamp(ts, fc);}; 226 227 void setBufferTailTimestamp ( ffado_timestamp_t new_timestamp ) 228 {m_data_buffer->setBufferTailTimestamp(new_timestamp);}; 229 void setBufferHeadTimestamp ( ffado_timestamp_t new_timestamp ) 230 {m_data_buffer->setBufferHeadTimestamp(new_timestamp);}; 231 protected: 191 232 Util::TimestampedBuffer *m_data_buffer; 192 233 … … 255 296 uint64_t getTimeAtPeriod(); 256 297 257 uint64_t getTimeNow(); 298 uint64_t getTimeNow(); // FIXME: should disappear 258 299 259 300 … … 318 359 319 360 /** 320 * @brief get the nominal number of frames between buffer updates321 * @return the nominal number of frames between buffer updates322 */ 323 virtual unsigned int get UpdatePeriod() = 0;361 * @brief get the nominal number of frames in a packet 362 * @return the nominal number of frames in a packet 363 */ 364 virtual unsigned int getNominalFramesPerPacket() = 0; 324 365 325 366 protected: … … 340 381 StreamStatistics m_WakeupStat; 341 382 DECLARE_DEBUG_MODULE; 342 343 383 }; 344 384