Changeset 715 for branches/ppalmers-streaming/src/libstreaming/generic
- Timestamp:
- 11/11/07 10:12:01 (16 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/ppalmers-streaming/src/libstreaming/generic/StreamProcessor.cpp
r714 r715 35 35 IMPL_DEBUG_MODULE( StreamProcessor, StreamProcessor, DEBUG_LEVEL_VERBOSE ); 36 36 37 StreamProcessor::StreamProcessor(enum eProcessorType type, int port , int framerate)37 StreamProcessor::StreamProcessor(enum eProcessorType type, int port) 38 38 : IsoStream((type==ePT_Receive ? IsoStream::eST_Receive : IsoStream::eST_Transmit), port) 39 39 , m_processor_type ( type ) 40 40 , m_state( ePS_Created ) 41 , m_nb_buffers(0) 42 , m_period(0) 43 , m_xruns(0) 44 , m_framerate(framerate) 41 , m_xruns( 0 ) 45 42 , m_manager(NULL) 46 43 , m_running(false) … … 85 82 debugOutputShort( DEBUG_LEVEL_NORMAL, " enable status : %s\n", m_is_disabled ? "No" : "Yes"); 86 83 87 debugOutputShort( DEBUG_LEVEL_NORMAL, " Nominal framerate : %u\n", m_ framerate);84 debugOutputShort( DEBUG_LEVEL_NORMAL, " Nominal framerate : %u\n", m_manager->getNominalRate()); 88 85 debugOutputShort( DEBUG_LEVEL_NORMAL, " Device framerate : Sync: %f, Buffer %f\n", 89 86 24576000.0/getSyncSource().m_data_buffer->getRate(), … … 101 98 { 102 99 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "enter...\n"); 103 104 100 m_data_buffer->init(); 105 106 101 return IsoStream::init(); 107 102 } … … 156 151 157 152 debugOutput( DEBUG_LEVEL_VERBOSE, "Preparing...\n"); 158 159 // init the ports160 161 153 if(!m_manager) { 162 154 debugFatal("Not attached to a manager!\n"); … … 164 156 } 165 157 166 m_nb_buffers=m_manager->getNbBuffers(); 167 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting m_nb_buffers : %d\n", m_nb_buffers); 168 169 m_period=m_manager->getPeriodSize(); 170 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting m_period : %d\n", m_period); 171 158 // init the ports 172 159 // loop over the ports to reset them 173 160 PortManager::preparePorts(); … … 318 305 StreamProcessor::getTimeAtPeriod() { 319 306 if (getType() == ePT_Receive) { 320 ffado_timestamp_t next_period_boundary=m_data_buffer->getTimestampFromHead(m_ period);307 ffado_timestamp_t next_period_boundary=m_data_buffer->getTimestampFromHead(m_manager->getPeriodSize()); 321 308 322 309 #ifdef DEBUG … … 331 318 return (uint64_t)next_period_boundary; 332 319 } else { 333 ffado_timestamp_t next_period_boundary=m_data_buffer->getTimestampFromTail((m_ nb_buffers-1) * m_period);320 ffado_timestamp_t next_period_boundary=m_data_buffer->getTimestampFromTail((m_manager->getNbBuffers()-1) * m_manager->getPeriodSize()); 334 321 335 322 #ifdef DEBUG branches/ppalmers-streaming/src/libstreaming/generic/StreamProcessor.h
r714 r715 38 38 namespace Streaming { 39 39 40 class StreamProcessorManager; 41 40 class StreamProcessorManager; 42 41 /*! 43 42 \brief Class providing a generic interface for Stream Processors … … 89 88 // constructor/destructor 90 89 public: 91 StreamProcessor(enum eProcessorType type, int port , int framerate);90 StreamProcessor(enum eProcessorType type, int port); 92 91 virtual ~StreamProcessor(); 93 92 … … 125 124 126 125 127 //state stuff (TODO: cleanup)126 //--- state stuff (TODO: cleanup) 128 127 bool xrunOccurred() { return (m_xruns>0); }; 129 128 bool isRunning(); ///< returns true if there is some stream data processed … … 144 143 // move to private? 145 144 void resetXrunCounter(); 146 147 148 public: // FIXME: should be private149 Util::TimestampedBuffer *m_data_buffer;150 151 protected: // SPM related152 void setManager(StreamProcessorManager *manager) {m_manager=manager;};153 void clearManager() {m_manager=0;};154 155 145 protected: 156 unsigned int m_nb_buffers; ///< cached from manager->getNbBuffers(), the number of periods to buffer157 unsigned int m_period; ///< cached from manager->getPeriod(), the period size158 unsigned int m_xruns;159 unsigned int m_framerate;160 161 StreamProcessorManager *m_manager;162 163 146 bool m_running; 164 147 bool m_disabled; … … 166 149 unsigned int m_cycle_to_enable_at; 167 150 151 //--- data buffering and accounting 152 public: // FIXME: should be private 153 Util::TimestampedBuffer *m_data_buffer; 154 155 protected: 156 unsigned int m_xruns; 157 158 StreamProcessorManager *m_manager; 168 159 169 160 // frame counter & sync stuff … … 263 254 264 255 int getLastCycle() {return m_last_cycle;}; 265 int getFrameRate() {return m_framerate;};266 256 267 257 int getBufferFill(); 268 258 269 259 protected: 270 271 260 float m_ticks_per_frame; 272 273 261 int m_last_cycle; 274 262 int m_sync_delay; 263 264 protected: // SPM related 265 void setManager(StreamProcessorManager *manager) {m_manager=manager;}; 266 void clearManager() {m_manager=NULL;}; 275 267 276 268 public: