Changeset 714
- Timestamp:
- 11/11/07 09:50:28 (15 years ago)
- Files:
-
- branches/ppalmers-streaming/src/ffado_streaming.cpp (modified) (3 diffs)
- branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.cpp (modified) (4 diffs)
- branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.h (modified) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.cpp (modified) (4 diffs)
- branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.h (modified) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/generic/IsoStream.cpp (modified) (1 diff)
- branches/ppalmers-streaming/src/libstreaming/generic/IsoStream.h (modified) (3 diffs)
- branches/ppalmers-streaming/src/libstreaming/generic/StreamProcessor.cpp (modified) (9 diffs)
- branches/ppalmers-streaming/src/libstreaming/generic/StreamProcessor.h (modified) (9 diffs)
- branches/ppalmers-streaming/src/libstreaming/StreamProcessorManager.cpp (modified) (12 diffs)
- branches/ppalmers-streaming/src/libstreaming/StreamProcessorManager.h (modified) (2 diffs)
- branches/ppalmers-streaming/src/libstreaming/util/IsoHandlerManager.cpp (modified) (2 diffs)
- branches/ppalmers-streaming/tests/SytMonitor.cpp (modified) (1 diff)
- branches/ppalmers-streaming/tests/test-cycletimer.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/ppalmers-streaming/src/ffado_streaming.cpp
r705 r714 170 170 // prepare the device 171 171 device->prepare(); 172 173 172 int j=0; 174 173 for(j=0; j<device->getStreamCount();j++) { … … 176 175 debugOutput(DEBUG_LEVEL_VERBOSE, "Registering stream processor %d of device %d with processormanager\n",j,i); 177 176 if (!dev->processorManager->registerProcessor(streamproc)) { 178 debugWarning("Could not register stream processor (%p) with the Processor manager\n",streamproc); 177 delete dev->processorManager; 178 delete dev->m_deviceManager; 179 delete dev; 180 debugFatal("Could not register stream processor (%p) with the Processor manager\n", streamproc); 181 return 0; 179 182 } 180 183 } … … 331 334 332 335 int ffado_streaming_transfer_capture_buffers(ffado_device_t *dev) { 333 return dev->processorManager->transfer(StreamProcessor:: E_Receive);336 return dev->processorManager->transfer(StreamProcessor::ePT_Receive); 334 337 } 335 338 336 339 int ffado_streaming_transfer_playback_buffers(ffado_device_t *dev) { 337 return dev->processorManager->transfer(StreamProcessor:: E_Transmit);340 return dev->processorManager->transfer(StreamProcessor::ePT_Receive); 338 341 } 339 342 branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.cpp
r712 r714 42 42 43 43 AmdtpReceiveStreamProcessor::AmdtpReceiveStreamProcessor(int port, int framerate, int dimension) 44 : ReceiveStreamProcessor(port, framerate)44 : StreamProcessor(ePT_Receive , port, framerate) 45 45 , m_dimension(dimension) 46 46 , m_last_timestamp(0) … … 54 54 // this has to be done before allocating the buffers, 55 55 // because this sets the buffersizes from the processormanager 56 if(! ReceiveStreamProcessor::init()) {56 if(!StreamProcessor::init()) { 57 57 debugFatal("Could not do base class init (%d)\n",this); 58 58 return false; … … 257 257 // reset all non-device specific stuff 258 258 // i.e. the iso stream and the associated ports 259 if(! ReceiveStreamProcessor::reset()) {259 if(!StreamProcessor::reset()) { 260 260 debugFatal("Could not do base class reset\n"); 261 261 return false; … … 274 274 // prepare all non-device specific stuff 275 275 // i.e. the iso stream and the associated ports 276 if(! ReceiveStreamProcessor::prepare()) {276 if(!StreamProcessor::prepare()) { 277 277 debugFatal("Could not prepare base class\n"); 278 278 return false; branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.h
r712 r714 65 65 */ 66 66 class AmdtpReceiveStreamProcessor 67 : public ReceiveStreamProcessor67 : public StreamProcessor 68 68 { 69 69 branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.cpp
r712 r714 41 41 /* transmit */ 42 42 AmdtpTransmitStreamProcessor::AmdtpTransmitStreamProcessor(int port, int framerate, int dimension) 43 : TransmitStreamProcessor(port, framerate), m_dimension(dimension) 44 , m_last_timestamp(0), m_dbc(0), m_ringbuffer_size_frames(0) 43 : StreamProcessor(ePT_Transmit, port, framerate) 44 , m_dimension(dimension) 45 , m_last_timestamp(0) 46 , m_dbc(0) 47 , m_ringbuffer_size_frames(0) 45 48 {} 46 49 … … 50 53 bool AmdtpTransmitStreamProcessor::init() { 51 54 52 debugOutput( DEBUG_LEVEL_VERBOSE, "Initializing (%p)...\n" );55 debugOutput( DEBUG_LEVEL_VERBOSE, "Initializing (%p)...\n", this); 53 56 // call the parent init 54 57 // this has to be done before allocating the buffers, 55 58 // because this sets the buffersizes from the processormanager 56 if(! TransmitStreamProcessor::init()) {59 if(!StreamProcessor::init()) { 57 60 debugFatal("Could not do base class init (%p)\n",this); 58 61 return false; … … 415 418 // reset all non-device specific stuff 416 419 // i.e. the iso stream and the associated ports 417 if(! TransmitStreamProcessor::reset()) {420 if(!StreamProcessor::reset()) { 418 421 debugFatal("Could not do base class reset\n"); 419 422 return false; … … 438 441 // prepare all non-device specific stuff 439 442 // i.e. the iso stream and the associated ports 440 if(! TransmitStreamProcessor::prepare()) {443 if(!StreamProcessor::prepare()) { 441 444 debugFatal("Could not prepare base class\n"); 442 445 return false; branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.h
r712 r714 66 66 */ 67 67 class AmdtpTransmitStreamProcessor 68 : public TransmitStreamProcessor68 : public StreamProcessor 69 69 { 70 70 branches/ppalmers-streaming/src/libstreaming/generic/IsoStream.cpp
r705 r714 72 72 debugOutputShort( DEBUG_LEVEL_NORMAL, " Address : %p\n",this); 73 73 debugOutputShort( DEBUG_LEVEL_NORMAL, " Stream type : %s\n", 74 (this->get Type()==EST_Receive ? "Receive" : "Transmit"));74 (this->getStreamType()==eST_Receive ? "Receive" : "Transmit")); 75 75 debugOutputShort( DEBUG_LEVEL_NORMAL, " Port, Channel : %d, %d\n", 76 76 m_port, m_channel); branches/ppalmers-streaming/src/libstreaming/generic/IsoStream.h
r705 r714 48 48 public: 49 49 50 enum EStreamType {51 EST_Receive,52 EST_Transmit50 enum eStreamType { 51 eST_Receive, 52 eST_Transmit 53 53 }; 54 54 55 IsoStream(enum EStreamType type)56 : m_type(type), m_channel(-1), m_port(0), m_handler(0)55 IsoStream(enum eStreamType type) 56 : m_channel(-1), m_port(0), m_handler(0), m_isostream_type(type) 57 57 {}; 58 IsoStream(enum EStreamType type, int port)59 : m_ type(type), m_channel(-1), m_port(port), m_handler(0)58 IsoStream(enum eStreamType type, int port) 59 : m_channel(-1), m_port(port), m_handler(0), m_isostream_type(type) 60 60 {}; 61 61 virtual ~IsoStream() … … 69 69 int getPort() {return m_port;}; 70 70 71 enum EStreamType getType() { returnm_type;};71 enum eStreamType getStreamType() { return m_isostream_type;}; 72 72 73 73 virtual unsigned int getPacketsPerPeriod() {return 1;}; … … 93 93 94 94 protected: 95 96 95 void setHandler( IsoHandler * h) ; 97 96 void clearHandler(); 98 97 99 enum EStreamType m_type;100 98 int m_channel; 101 99 int m_port; 102 100 103 101 IsoHandler *m_handler; 102 103 private: // should be set in the constructor 104 enum eStreamType m_isostream_type; 104 105 105 106 DECLARE_DEBUG_MODULE; branches/ppalmers-streaming/src/libstreaming/generic/StreamProcessor.cpp
r712 r714 35 35 IMPL_DEBUG_MODULE( StreamProcessor, StreamProcessor, DEBUG_LEVEL_VERBOSE ); 36 36 37 StreamProcessor::StreamProcessor(enum IsoStream::EStreamType type, int port, int framerate) 38 : IsoStream(type, port) 37 StreamProcessor::StreamProcessor(enum eProcessorType type, int port, int framerate) 38 : IsoStream((type==ePT_Receive ? IsoStream::eST_Receive : IsoStream::eST_Transmit), port) 39 , m_processor_type ( type ) 40 , m_state( ePS_Created ) 39 41 , m_nb_buffers(0) 40 42 , m_period(0) … … 46 48 , m_is_disabled(true) 47 49 , m_cycle_to_enable_at(0) 48 , m_SyncSource(NULL)49 50 , m_ticks_per_frame(0) 50 51 , m_last_cycle(0) … … 58 59 StreamProcessor::~StreamProcessor() { 59 60 if (m_data_buffer) delete m_data_buffer; 61 } 62 63 void 64 StreamProcessor::setState(enum eProcessorState s) { 65 #ifdef DEBUG 66 // check the state transistion 67 debugOutput( DEBUG_LEVEL_VERBOSE, "State transition from %s to %s", 68 ePSToString(m_state), ePSToString(s) ); 69 #endif 70 m_state = s; 60 71 } 61 72 … … 76 87 debugOutputShort( DEBUG_LEVEL_NORMAL, " Nominal framerate : %u\n", m_framerate); 77 88 debugOutputShort( DEBUG_LEVEL_NORMAL, " Device framerate : Sync: %f, Buffer %f\n", 78 24576000.0/ m_SyncSource->m_data_buffer->getRate(),89 24576000.0/getSyncSource().m_data_buffer->getRate(), 79 90 24576000.0/m_data_buffer->getRate() 80 91 ); … … 169 180 } 170 181 182 StreamProcessor& 183 StreamProcessor::getSyncSource() 184 { 185 return m_manager->getSyncSource(); 186 }; 187 171 188 int StreamProcessor::getBufferFill() { 172 189 // return m_data_buffer->getFrameCounter(); … … 180 197 181 198 int StreamProcessor::getMaxFrameLatency() { 182 if (getType() == E_Receive) {199 if (getType() == ePT_Receive) { 183 200 return (int)(m_handler->getWakeupInterval() * TICKS_PER_CYCLE); 184 201 } else { … … 225 242 m_data_buffer->disable(); 226 243 m_disabled=true; 227 return true;228 }229 230 bool StreamProcessor::setSyncSource(StreamProcessor *s) {231 m_SyncSource=s;232 244 return true; 233 245 } … … 261 273 // pass before these packets are processed. Adding this extra term makes that 262 274 // the period boundary is signalled later 263 time_at_period = addTicks(time_at_period, m_SyncSource->getSyncDelay());275 time_at_period = addTicks(time_at_period, getSyncSource().getSyncDelay()); 264 276 265 277 uint64_t cycle_timer=m_handler->getCycleTimerTicks(); … … 303 315 } 304 316 305 uint64_t ReceiveStreamProcessor::getTimeAtPeriod() { 306 ffado_timestamp_t next_period_boundary=m_data_buffer->getTimestampFromHead(m_period); 307 308 #ifdef DEBUG 309 ffado_timestamp_t ts; 310 signed int fc; 317 uint64_t 318 StreamProcessor::getTimeAtPeriod() { 319 if (getType() == ePT_Receive) { 320 ffado_timestamp_t next_period_boundary=m_data_buffer->getTimestampFromHead(m_period); 311 321 312 m_data_buffer->getBufferTailTimestamp(&ts,&fc); 313 314 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "=> NPD="TIMESTAMP_FORMAT_SPEC", LTS="TIMESTAMP_FORMAT_SPEC", FC=%5u, TPF=%f\n", 315 next_period_boundary, ts, fc, getTicksPerFrame() 316 ); 317 #endif 318 319 return (uint64_t)next_period_boundary; 320 } 321 322 bool ReceiveStreamProcessor::canClientTransferFrames(unsigned int nbframes) { 323 return m_data_buffer->getFrameCounter() >= (int) nbframes; 324 } 325 326 uint64_t TransmitStreamProcessor::getTimeAtPeriod() { 327 ffado_timestamp_t next_period_boundary=m_data_buffer->getTimestampFromTail((m_nb_buffers-1) * m_period); 328 329 #ifdef DEBUG 330 ffado_timestamp_t ts; 331 signed int fc; 332 m_data_buffer->getBufferTailTimestamp(&ts,&fc); 333 334 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "=> NPD="TIMESTAMP_FORMAT_SPEC", LTS="TIMESTAMP_FORMAT_SPEC", FC=%5u, TPF=%f\n", 335 next_period_boundary, ts, fc, getTicksPerFrame() 336 ); 337 #endif 338 339 return (uint64_t)next_period_boundary; 340 } 341 342 bool TransmitStreamProcessor::canClientTransferFrames(unsigned int nbframes) { 343 bool can_transfer; 344 // there has to be enough space to put the frames in 345 can_transfer = m_data_buffer->getBufferSize() - m_data_buffer->getFrameCounter() > nbframes; 346 // or the buffer is transparent 347 can_transfer |= m_data_buffer->isTransparent(); 348 return can_transfer; 349 } 350 351 352 } 322 #ifdef DEBUG 323 ffado_timestamp_t ts; 324 signed int fc; 325 m_data_buffer->getBufferTailTimestamp(&ts,&fc); 326 327 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "=> NPD="TIMESTAMP_FORMAT_SPEC", LTS="TIMESTAMP_FORMAT_SPEC", FC=%5u, TPF=%f\n", 328 next_period_boundary, ts, fc, getTicksPerFrame() 329 ); 330 #endif 331 return (uint64_t)next_period_boundary; 332 } else { 333 ffado_timestamp_t next_period_boundary=m_data_buffer->getTimestampFromTail((m_nb_buffers-1) * m_period); 334 335 #ifdef DEBUG 336 ffado_timestamp_t ts; 337 signed int fc; 338 m_data_buffer->getBufferTailTimestamp(&ts,&fc); 339 340 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "=> NPD="TIMESTAMP_FORMAT_SPEC", LTS="TIMESTAMP_FORMAT_SPEC", FC=%5u, TPF=%f\n", 341 next_period_boundary, ts, fc, getTicksPerFrame() 342 ); 343 #endif 344 return (uint64_t)next_period_boundary; 345 } 346 } 347 348 bool 349 StreamProcessor::canClientTransferFrames(unsigned int nbframes) { 350 if (getType() == ePT_Receive) { 351 return m_data_buffer->getFrameCounter() >= (int) nbframes; 352 } else { 353 bool can_transfer; 354 // there has to be enough space to put the frames in 355 can_transfer = m_data_buffer->getBufferSize() - m_data_buffer->getFrameCounter() > nbframes; 356 // or the buffer is transparent 357 can_transfer |= m_data_buffer->isTransparent(); 358 return can_transfer; 359 } 360 } 361 362 const char * 363 StreamProcessor::ePSToString(enum eProcessorState s) { 364 switch (s) { 365 case ePS_Created: return "ePS_Created"; 366 case ePS_Initialized: return "ePS_Initialized"; 367 case ePS_WaitingForRunningStream: return "ePS_WaitingForRunningStream"; 368 case ePS_DryRunning: return "ePS_DryRunning"; 369 case ePS_WaitingForEnabledStream: return "ePS_WaitingForEnabledStream"; 370 case ePS_StreamEnabled: return "ePS_StreamEnabled"; 371 case ePS_WaitingForDisabledStream: return "ePS_WaitingForDisabledStream"; 372 } 373 } 374 375 } // end of namespace branches/ppalmers-streaming/src/libstreaming/generic/StreamProcessor.h
r712 r714 53 53 public Util::OptionContainer { 54 54 55 friend class StreamProcessorManager; 56 57 public: 58 enum EProcessorType { 59 E_Receive, 60 E_Transmit 55 friend class StreamProcessorManager; // FIXME: get rid of this 56 57 public: 58 ///> the streamprocessor type 59 enum eProcessorType { 60 ePT_Receive, 61 ePT_Transmit 61 62 }; 62 63 StreamProcessor(enum IsoStream::EStreamType type, int port, int framerate); 63 ///> returns the type of the streamprocessor 64 virtual enum eProcessorType getType() { return m_processor_type; }; 65 private: 66 // this can only be set by the constructor 67 enum eProcessorType m_processor_type; 68 69 protected: 70 ///> the state the streamprocessor is in 71 enum eProcessorState { 72 ePS_Created, 73 ePS_Initialized, 74 ePS_WaitingForRunningStream, 75 ePS_DryRunning, 76 ePS_WaitingForEnabledStream, 77 ePS_StreamEnabled, 78 ePS_WaitingForDisabledStream, 79 }; 80 81 ///> set the SP state to a specific value 82 void setState(enum eProcessorState); 83 ///> get the SP state 84 enum eProcessorState getState() {return m_state;}; 85 private: 86 enum eProcessorState m_state; 87 const char *ePSToString(enum eProcessorState); 88 89 // constructor/destructor 90 public: 91 StreamProcessor(enum eProcessorType type, int port, int framerate); 64 92 virtual ~StreamProcessor(); 65 93 94 // the receive/transmit functions 95 public: 96 // the transmit interface accepts frames and provides packets 97 // implement these for a transmit SP 98 // leave default for a receive SP 66 99 virtual enum raw1394_iso_disposition 67 putPacket(unsigned char *data, unsigned int length, 68 unsigned char channel, unsigned char tag, unsigned char sy, 69 unsigned int cycle, unsigned int dropped) = 0; 100 getPacket(unsigned char *data, unsigned int *length, 101 unsigned char *tag, unsigned char *sy, 102 int cycle, unsigned int dropped, unsigned int max_length) 103 {debugWarning("call not allowed\n"); return RAW1394_ISO_STOP;}; 104 virtual bool putFrames(unsigned int nbframes, int64_t ts) 105 {debugWarning("call not allowed\n"); return false;}; 106 virtual bool putFramesDry(unsigned int nbframes, int64_t ts) 107 {debugWarning("call not allowed\n"); return false;}; 108 virtual bool processWriteBlock(char *data, unsigned int nevents, unsigned int offset) 109 {debugWarning("call not allowed\n"); return false;}; 110 111 // the receive interface accepts packets and provides frames 112 // implement these for a receive SP 113 // leave default for a transmit SP 70 114 virtual enum raw1394_iso_disposition 71 getPacket(unsigned char *data, unsigned int *length, 72 unsigned char *tag, unsigned char *sy, 73 int cycle, unsigned int dropped, unsigned int max_length) = 0; 74 75 virtual enum EProcessorType getType() =0; 76 77 bool xrunOccurred() { return (m_xruns>0);}; 78 79 // move to private? 80 void resetXrunCounter(); 81 115 putPacket(unsigned char *data, unsigned int length, 116 unsigned char channel, unsigned char tag, unsigned char sy, 117 unsigned int cycle, unsigned int dropped) 118 {debugWarning("call not allowed\n"); return RAW1394_ISO_STOP;}; 119 virtual bool getFrames(unsigned int nbframes, int64_t ts) 120 {debugWarning("call not allowed\n"); return false;}; 121 virtual bool getFramesDry(unsigned int nbframes, int64_t ts) 122 {debugWarning("call not allowed\n"); return false;}; 123 virtual bool processReadBlock(char *data, unsigned int nevents, unsigned int offset) 124 {debugWarning("call not allowed\n"); return false;}; 125 126 127 // state stuff (TODO: cleanup) 128 bool xrunOccurred() { return (m_xruns>0); }; 82 129 bool isRunning(); ///< returns true if there is some stream data processed 83 84 130 virtual bool prepareForEnable(uint64_t time_to_enable_at); 85 131 virtual bool prepareForDisable(); … … 89 135 bool isEnabled() {return !m_is_disabled;}; 90 136 91 virtual bool putFrames(unsigned int nbframes, int64_t ts) = 0; ///< transfer the buffer contents from client92 virtual bool getFrames(unsigned int nbframes, int64_t ts) = 0; ///< transfer the buffer contents to the client93 virtual bool putFramesDry(unsigned int nbframes, int64_t ts) = 0; ///< dry-process the buffer contents94 virtual bool getFramesDry(unsigned int nbframes, int64_t ts) = 0; ///< dry-process the buffer contents95 96 137 virtual bool reset(); ///< reset the streams & buffers (e.g. after xrun) 97 138 98 139 virtual bool prepare(); ///< prepare the streams & buffers (e.g. prefill) 99 100 virtual void dumpInfo();101 102 140 virtual bool init(); 103 104 virtual void setVerboseLevel(int l);105 106 141 virtual bool prepareForStop() {return true;}; 107 142 virtual bool prepareForStart() {return true;}; 108 143 109 public: 144 // move to private? 145 void resetXrunCounter(); 146 147 148 public: // FIXME: should be private 110 149 Util::TimestampedBuffer *m_data_buffer; 111 112 StreamStatistics m_PacketStat;113 StreamStatistics m_PeriodStat;114 115 StreamStatistics m_WakeupStat;116 150 117 151 protected: // SPM related … … 122 156 unsigned int m_nb_buffers; ///< cached from manager->getNbBuffers(), the number of periods to buffer 123 157 unsigned int m_period; ///< cached from manager->getPeriod(), the period size 124 125 158 unsigned int m_xruns; 126 127 159 unsigned int m_framerate; 128 160 129 161 StreamProcessorManager *m_manager; 130 162 131 163 bool m_running; 132 164 bool m_disabled; … … 135 167 136 168 137 138 DECLARE_DEBUG_MODULE;139 140 169 // frame counter & sync stuff 141 170 public: … … 150 179 * false if it can't 151 180 */ 152 virtual bool canClientTransferFrames(unsigned int nframes) = 0;181 virtual bool canClientTransferFrames(unsigned int nframes); 153 182 154 183 /** … … 195 224 * @return the time in internal units 196 225 */ 197 virtual uint64_t getTimeAtPeriod() = 0;226 virtual uint64_t getTimeAtPeriod(); 198 227 199 228 uint64_t getTimeNow(); … … 229 258 virtual int getMaxFrameLatency(); 230 259 231 bool setSyncSource(StreamProcessor *s); 260 StreamProcessor& getSyncSource(); 261 232 262 float getTicksPerFrame(); 233 263 … … 238 268 239 269 protected: 240 StreamProcessor *m_SyncSource;241 270 242 271 float m_ticks_per_frame; … … 245 274 int m_sync_delay; 246 275 276 public: 277 // debug stuff 278 virtual void dumpInfo(); 279 virtual void setVerboseLevel(int l); 280 StreamStatistics m_PacketStat; 281 StreamStatistics m_PeriodStat; 282 StreamStatistics m_WakeupStat; 283 DECLARE_DEBUG_MODULE; 284 247 285 }; 248 286 249 /*!250 \brief Class providing a generic interface for receive Stream Processors251 252 */253 class ReceiveStreamProcessor : public StreamProcessor {254 255 public:256 ReceiveStreamProcessor(int port, int framerate)257 : StreamProcessor(IsoStream::EST_Receive, port, framerate) {};258 virtual ~ReceiveStreamProcessor(){};259 260 261 virtual enum EProcessorType getType() {return E_Receive;};262 263 virtual enum raw1394_iso_disposition264 getPacket(unsigned char *data, unsigned int *length,265 unsigned char *tag, unsigned char *sy,266 int cycle, unsigned int dropped, unsigned int max_length)267 {return RAW1394_ISO_STOP;};268 virtual bool putFrames(unsigned int nbframes, int64_t ts) {return false;};269 virtual bool putFramesDry(unsigned int nbframes, int64_t ts) {return false;};270 271 virtual enum raw1394_iso_disposition putPacket(unsigned char *data, unsigned int length,272 unsigned char channel, unsigned char tag, unsigned char sy,273 unsigned int cycle, unsigned int dropped) = 0;274 275 uint64_t getTimeAtPeriod();276 bool canClientTransferFrames(unsigned int nframes);277 278 protected:279 bool processWriteBlock(char *data, unsigned int nevents, unsigned int offset) {return true;};280 };281 282 /*!283 \brief Class providing a generic interface for receive Stream Processors284 285 */286 class TransmitStreamProcessor : public StreamProcessor {287 288 public:289 TransmitStreamProcessor(int port, int framerate)290 : StreamProcessor(IsoStream::EST_Transmit, port, framerate) {};291 virtual ~TransmitStreamProcessor() {};292 293 virtual enum EProcessorType getType() {return E_Transmit;};294 295 virtual enum raw1394_iso_disposition296 putPacket(unsigned char *data, unsigned int length,297 unsigned char channel, unsigned char tag, unsigned char sy,298 unsigned int cycle, unsigned int dropped) {return RAW1394_ISO_STOP;};299 virtual bool getFrames(unsigned int nbframes, int64_t ts) {return false;};300 virtual bool getFramesDry(unsigned int nbframes, int64_t ts) {return false;};301 302 uint64_t getTimeAtPeriod();303 bool canClientTransferFrames(unsigned int nframes);304 305 protected:306 bool processReadBlock(char *data, unsigned int nevents, unsigned int offset) {return true;};307 };308 309 287 } 310 288 branches/ppalmers-streaming/src/libstreaming/StreamProcessorManager.cpp
r712 r714 72 72 assert(m_isoManager); 73 73 74 if (processor->getType() ==StreamProcessor::E_Receive) {74 if (processor->getType() == StreamProcessor::ePT_Receive) { 75 75 processor->setVerboseLevel(getDebugLevel()); // inherit debug level 76 76 77 77 m_ReceiveProcessors.push_back(processor); 78 79 78 processor->setManager(this); 80 81 79 return true; 82 80 } 83 81 84 if (processor->getType() ==StreamProcessor::E_Transmit) {82 if (processor->getType() == StreamProcessor::ePT_Transmit) { 85 83 processor->setVerboseLevel(getDebugLevel()); // inherit debug level 86 84 87 85 m_TransmitProcessors.push_back(processor); 88 89 86 processor->setManager(this); 90 91 87 return true; 92 88 } … … 102 98 assert(processor); 103 99 104 if (processor->getType()==StreamProcessor:: E_Receive) {100 if (processor->getType()==StreamProcessor::ePT_Receive) { 105 101 106 102 for ( StreamProcessorVectorIterator it = m_ReceiveProcessors.begin(); … … 125 121 } 126 122 127 if (processor->getType()==StreamProcessor:: E_Transmit) {123 if (processor->getType()==StreamProcessor::ePT_Transmit) { 128 124 for ( StreamProcessorVectorIterator it = m_TransmitProcessors.begin(); 129 125 it != m_TransmitProcessors.end(); … … 158 154 m_SyncSource=s; 159 155 return true; 160 }161 162 StreamProcessor *StreamProcessorManager::getSyncSource() {163 return m_SyncSource;164 156 } 165 157 … … 168 160 debugOutput( DEBUG_LEVEL_VERBOSE, "enter...\n"); 169 161 170 m_isoManager =new IsoHandlerManager(m_thread_realtime, m_thread_priority + 1);162 m_isoManager = new IsoHandlerManager(m_thread_realtime, m_thread_priority + 1); 171 163 172 164 if(!m_isoManager) { … … 226 218 ++it ) { 227 219 228 if(!(*it)->setSyncSource(m_SyncSource)) {229 debugFatal( " could not set sync source (%p)...\n",(*it));230 return false;231 }232 233 220 if(!(*it)->setOption("slaveMode", m_is_slave)) { 234 221 debugOutput(DEBUG_LEVEL_VERBOSE, " note: could not set slaveMode option for (%p)...\n",(*it)); … … 245 232 it != m_TransmitProcessors.end(); 246 233 ++it ) { 247 if(!(*it)->setSyncSource(m_SyncSource)) {248 debugFatal( " could not set sync source (%p)...\n",(*it));249 return false;250 }251 234 if(!(*it)->setOption("slaveMode", m_is_slave)) { 252 235 debugOutput(DEBUG_LEVEL_VERBOSE, " note: could not set slaveMode option for (%p)...\n",(*it)); … … 377 360 waitForPeriod(); 378 361 // drop the frames for all receive SP's 379 dryRun(StreamProcessor:: E_Receive);362 dryRun(StreamProcessor::ePT_Receive); 380 363 381 364 // we don't have to dryrun for the xmit SP's since they … … 1067 1050 debugOutput( DEBUG_LEVEL_VERBOSE, "Transferring period...\n"); 1068 1051 bool retval=true; 1069 retval &= dryRun(StreamProcessor:: E_Receive);1070 retval &= dryRun(StreamProcessor:: E_Transmit);1052 retval &= dryRun(StreamProcessor::ePT_Receive); 1053 retval &= dryRun(StreamProcessor::ePT_Transmit); 1071 1054 return retval; 1072 1055 } … … 1081 1064 */ 1082 1065 1083 bool StreamProcessorManager::transfer(enum StreamProcessor:: EProcessorType t) {1066 bool StreamProcessorManager::transfer(enum StreamProcessor::eProcessorType t) { 1084 1067 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "Transferring period...\n"); 1085 1068 bool retval = true; 1086 1069 // a static cast could make sure that there is no performance 1087 1070 // penalty for the virtual functions (to be checked) 1088 if (t==StreamProcessor:: E_Receive) {1071 if (t==StreamProcessor::ePT_Receive) { 1089 1072 // determine the time at which we want reception to start 1090 1073 float rate=m_SyncSource->getTicksPerFrame(); … … 1148 1131 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "Dry-running period...\n"); 1149 1132 bool retval=true; 1150 retval &= dryRun(StreamProcessor:: E_Receive);1151 retval &= dryRun(StreamProcessor:: E_Transmit);1133 retval &= dryRun(StreamProcessor::ePT_Receive); 1134 retval &= dryRun(StreamProcessor::ePT_Transmit); 1152 1135 return retval; 1153 1136 } … … 1162 1145 */ 1163 1146 1164 bool StreamProcessorManager::dryRun(enum StreamProcessor:: EProcessorType t) {1147 bool StreamProcessorManager::dryRun(enum StreamProcessor::eProcessorType t) { 1165 1148 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "Dry-running period...\n"); 1166 1149 bool retval = true; 1167 1150 // a static cast could make sure that there is no performance 1168 1151 // penalty for the virtual functions (to be checked) 1169 if (t==StreamProcessor:: E_Receive) {1152 if (t==StreamProcessor::ePT_Receive) { 1170 1153 // determine the time at which we want reception to start 1171 1154 float rate=m_SyncSource->getTicksPerFrame(); branches/ppalmers-streaming/src/libstreaming/StreamProcessorManager.h
r705 r714 87 87 88 88 bool transfer(); ///< transfer the buffer contents from/to client 89 bool transfer(enum StreamProcessor:: EProcessorType); ///< transfer the buffer contents from/to client (single processor type)89 bool transfer(enum StreamProcessor::eProcessorType); ///< transfer the buffer contents from/to client (single processor type) 90 90 91 91 bool dryRun(); 92 bool dryRun(enum StreamProcessor:: EProcessorType);92 bool dryRun(enum StreamProcessor::eProcessorType); 93 93 94 94 int getDelayedUsecs() {return m_delayed_usecs;}; … … 122 122 public: 123 123 bool setSyncSource(StreamProcessor *s); 124 StreamProcessor * getSyncSource(); 124 StreamProcessor& getSyncSource() 125 {return *m_SyncSource;}; 125 126 126 127 protected: branches/ppalmers-streaming/src/libstreaming/util/IsoHandlerManager.cpp
r707 r714 304 304 305 305 // allocate a handler for this stream 306 if (stream->get Type()==IsoStream::EST_Receive) {306 if (stream->getStreamType()==IsoStream::eST_Receive) { 307 307 // setup the optimal parameters for the raw1394 ISO buffering 308 308 unsigned int packets_per_period=stream->getPacketsPerPeriod(); … … 394 394 } 395 395 396 if (stream->get Type()==IsoStream::EST_Transmit) {396 if (stream->getStreamType()==IsoStream::eST_Transmit) { 397 397 // setup the optimal parameters for the raw1394 ISO buffering 398 398 unsigned int packets_per_period=stream->getPacketsPerPeriod(); branches/ppalmers-streaming/tests/SytMonitor.cpp
r705 r714 35 35 36 36 SytMonitor::SytMonitor(int port) 37 : IsoStream(IsoStream:: EST_Receive, port) {37 : IsoStream(IsoStream::eST_Receive, port) { 38 38 m_cinfo_buffer=ffado_ringbuffer_create(16384*sizeof(struct cycle_info)); 39 39 branches/ppalmers-streaming/tests/test-cycletimer.cpp
r705 r714 288 288 #ifdef TEST_PORT_0 289 289 // add a stream to the manager so that it has something to do 290 s=new IsoStream(IsoStream:: EST_Receive, 0);290 s=new IsoStream(IsoStream::eST_Receive, 0); 291 291 292 292 if (!s) {