Changeset 714

Show
Ignore:
Timestamp:
11/11/07 09:50:28 (15 years ago)
Author:
ppalmers
Message:

- cleanup of streaming interfaces
- doesn't work yet

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/ppalmers-streaming/src/ffado_streaming.cpp

    r705 r714  
    170170        // prepare the device 
    171171        device->prepare(); 
    172  
    173172        int j=0; 
    174173        for(j=0; j<device->getStreamCount();j++) { 
     
    176175            debugOutput(DEBUG_LEVEL_VERBOSE, "Registering stream processor %d of device %d with processormanager\n",j,i); 
    177176            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; 
    179182            } 
    180183        } 
     
    331334 
    332335int 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); 
    334337} 
    335338 
    336339int 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); 
    338341} 
    339342 
  • branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.cpp

    r712 r714  
    4242 
    4343AmdtpReceiveStreamProcessor::AmdtpReceiveStreamProcessor(int port, int framerate, int dimension) 
    44     : ReceiveStreamProcessor(port, framerate) 
     44    : StreamProcessor(ePT_Receive , port, framerate) 
    4545    , m_dimension(dimension) 
    4646    , m_last_timestamp(0) 
     
    5454    // this has to be done before allocating the buffers, 
    5555    // because this sets the buffersizes from the processormanager 
    56     if(!ReceiveStreamProcessor::init()) { 
     56    if(!StreamProcessor::init()) { 
    5757        debugFatal("Could not do base class init (%d)\n",this); 
    5858        return false; 
     
    257257    // reset all non-device specific stuff 
    258258    // i.e. the iso stream and the associated ports 
    259     if(!ReceiveStreamProcessor::reset()) { 
     259    if(!StreamProcessor::reset()) { 
    260260            debugFatal("Could not do base class reset\n"); 
    261261            return false; 
     
    274274    // prepare all non-device specific stuff 
    275275    // i.e. the iso stream and the associated ports 
    276     if(!ReceiveStreamProcessor::prepare()) { 
     276    if(!StreamProcessor::prepare()) { 
    277277        debugFatal("Could not prepare base class\n"); 
    278278        return false; 
  • branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.h

    r712 r714  
    6565*/ 
    6666class AmdtpReceiveStreamProcessor 
    67     : public ReceiveStreamProcessor 
     67    : public StreamProcessor 
    6868{ 
    6969 
  • branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.cpp

    r712 r714  
    4141/* transmit */ 
    4242AmdtpTransmitStreamProcessor::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) 
    4548{} 
    4649 
     
    5053bool AmdtpTransmitStreamProcessor::init() { 
    5154 
    52     debugOutput( DEBUG_LEVEL_VERBOSE, "Initializing (%p)...\n"); 
     55    debugOutput( DEBUG_LEVEL_VERBOSE, "Initializing (%p)...\n", this); 
    5356    // call the parent init 
    5457    // this has to be done before allocating the buffers, 
    5558    // because this sets the buffersizes from the processormanager 
    56     if(!TransmitStreamProcessor::init()) { 
     59    if(!StreamProcessor::init()) { 
    5760        debugFatal("Could not do base class init (%p)\n",this); 
    5861        return false; 
     
    415418    // reset all non-device specific stuff 
    416419    // i.e. the iso stream and the associated ports 
    417     if(!TransmitStreamProcessor::reset()) { 
     420    if(!StreamProcessor::reset()) { 
    418421        debugFatal("Could not do base class reset\n"); 
    419422        return false; 
     
    438441    // prepare all non-device specific stuff 
    439442    // i.e. the iso stream and the associated ports 
    440     if(!TransmitStreamProcessor::prepare()) { 
     443    if(!StreamProcessor::prepare()) { 
    441444        debugFatal("Could not prepare base class\n"); 
    442445        return false; 
  • branches/ppalmers-streaming/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.h

    r712 r714  
    6666*/ 
    6767class AmdtpTransmitStreamProcessor 
    68     : public TransmitStreamProcessor 
     68    : public StreamProcessor 
    6969{ 
    7070 
  • branches/ppalmers-streaming/src/libstreaming/generic/IsoStream.cpp

    r705 r714  
    7272    debugOutputShort( DEBUG_LEVEL_NORMAL, "  Address        : %p\n",this); 
    7373    debugOutputShort( DEBUG_LEVEL_NORMAL, "  Stream type    : %s\n", 
    74             (this->getType()==EST_Receive ? "Receive" : "Transmit")); 
     74            (this->getStreamType()==eST_Receive ? "Receive" : "Transmit")); 
    7575    debugOutputShort( DEBUG_LEVEL_NORMAL, "  Port, Channel  : %d, %d\n", 
    7676            m_port, m_channel); 
  • branches/ppalmers-streaming/src/libstreaming/generic/IsoStream.h

    r705 r714  
    4848    public: 
    4949 
    50         enum EStreamType { 
    51                 EST_Receive, 
    52                 EST_Transmit 
     50        enum eStreamType { 
     51                eST_Receive, 
     52                eST_Transmit 
    5353        }; 
    5454 
    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
    5757        {}; 
    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
    6060        {}; 
    6161        virtual ~IsoStream() 
     
    6969        int getPort() {return m_port;}; 
    7070 
    71         enum EStreamType getType() { return m_type;}; 
     71        enum eStreamType getStreamType() { return m_isostream_type;}; 
    7272 
    7373        virtual unsigned int getPacketsPerPeriod() {return 1;}; 
     
    9393 
    9494    protected: 
    95  
    9695        void setHandler( IsoHandler * h) ; 
    9796        void clearHandler(); 
    9897 
    99         enum EStreamType m_type; 
    10098        int m_channel; 
    10199        int m_port; 
    102100 
    103101        IsoHandler *m_handler; 
     102 
     103    private: // should be set in the constructor 
     104        enum eStreamType m_isostream_type; 
    104105 
    105106        DECLARE_DEBUG_MODULE; 
  • branches/ppalmers-streaming/src/libstreaming/generic/StreamProcessor.cpp

    r712 r714  
    3535IMPL_DEBUG_MODULE( StreamProcessor, StreamProcessor, DEBUG_LEVEL_VERBOSE ); 
    3636 
    37 StreamProcessor::StreamProcessor(enum IsoStream::EStreamType type, int port, int framerate) 
    38     : IsoStream(type, port) 
     37StreamProcessor::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 ) 
    3941    , m_nb_buffers(0) 
    4042    , m_period(0) 
     
    4648    , m_is_disabled(true) 
    4749    , m_cycle_to_enable_at(0) 
    48     , m_SyncSource(NULL) 
    4950    , m_ticks_per_frame(0) 
    5051    , m_last_cycle(0) 
     
    5859StreamProcessor::~StreamProcessor() { 
    5960    if (m_data_buffer) delete m_data_buffer; 
     61} 
     62 
     63void 
     64StreamProcessor::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; 
    6071} 
    6172 
     
    7687    debugOutputShort( DEBUG_LEVEL_NORMAL, "  Nominal framerate     : %u\n", m_framerate); 
    7788    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(), 
    7990        24576000.0/m_data_buffer->getRate() 
    8091        ); 
     
    169180} 
    170181 
     182StreamProcessor& 
     183StreamProcessor::getSyncSource() 
     184{ 
     185    return m_manager->getSyncSource(); 
     186}; 
     187 
    171188int StreamProcessor::getBufferFill() { 
    172189//     return m_data_buffer->getFrameCounter(); 
     
    180197 
    181198int StreamProcessor::getMaxFrameLatency() { 
    182     if (getType() == E_Receive) { 
     199    if (getType() == ePT_Receive) { 
    183200        return (int)(m_handler->getWakeupInterval() * TICKS_PER_CYCLE); 
    184201    } else { 
     
    225242    m_data_buffer->disable(); 
    226243    m_disabled=true; 
    227     return true; 
    228 } 
    229  
    230 bool StreamProcessor::setSyncSource(StreamProcessor *s) { 
    231     m_SyncSource=s; 
    232244    return true; 
    233245} 
     
    261273    // pass before these packets are processed. Adding this extra term makes that 
    262274    // 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()); 
    264276 
    265277    uint64_t cycle_timer=m_handler->getCycleTimerTicks(); 
     
    303315} 
    304316 
    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; 
     317uint64_t 
     318StreamProcessor::getTimeAtPeriod() { 
     319    if (getType() == ePT_Receive) { 
     320        ffado_timestamp_t next_period_boundary=m_data_buffer->getTimestampFromHead(m_period); 
    311321     
    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 
     348bool 
     349StreamProcessor::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 
     362const char * 
     363StreamProcessor::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  
    5353                        public Util::OptionContainer { 
    5454 
    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 
     57public: 
     58    ///> the streamprocessor type 
     59    enum eProcessorType { 
     60        ePT_Receive, 
     61        ePT_Transmit 
    6162    }; 
    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; }; 
     65private: 
     66    // this can only be set by the constructor 
     67    enum eProcessorType m_processor_type; 
     68 
     69protected: 
     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;}; 
     85private: 
     86    enum eProcessorState m_state; 
     87    const char *ePSToString(enum eProcessorState); 
     88 
     89// constructor/destructor 
     90public: 
     91    StreamProcessor(enum eProcessorType type, int port, int framerate); 
    6492    virtual ~StreamProcessor(); 
    6593 
     94// the receive/transmit functions 
     95public: 
     96    // the transmit interface accepts frames and provides packets 
     97    // implement these for a transmit SP 
     98    // leave default for a receive SP 
    6699    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 
    70114    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); }; 
    82129    bool isRunning(); ///< returns true if there is some stream data processed 
    83  
    84130    virtual bool prepareForEnable(uint64_t time_to_enable_at); 
    85131    virtual bool prepareForDisable(); 
     
    89135    bool isEnabled() {return !m_is_disabled;}; 
    90136 
    91     virtual bool putFrames(unsigned int nbframes, int64_t ts) = 0; ///< transfer the buffer contents from client 
    92     virtual bool getFrames(unsigned int nbframes, int64_t ts) = 0; ///< transfer the buffer contents to the client 
    93     virtual bool putFramesDry(unsigned int nbframes, int64_t ts) = 0; ///< dry-process the buffer contents 
    94     virtual bool getFramesDry(unsigned int nbframes, int64_t ts) = 0; ///< dry-process the buffer contents 
    95  
    96137    virtual bool reset(); ///< reset the streams & buffers (e.g. after xrun) 
    97138 
    98139    virtual bool prepare(); ///< prepare the streams & buffers (e.g. prefill) 
    99  
    100     virtual void dumpInfo(); 
    101  
    102140    virtual bool init(); 
    103  
    104     virtual void setVerboseLevel(int l); 
    105  
    106141    virtual bool prepareForStop() {return true;}; 
    107142    virtual bool prepareForStart() {return true;}; 
    108143 
    109 public: 
     144    // move to private? 
     145    void resetXrunCounter(); 
     146 
     147 
     148public: // FIXME: should be private 
    110149    Util::TimestampedBuffer *m_data_buffer; 
    111  
    112     StreamStatistics m_PacketStat; 
    113     StreamStatistics m_PeriodStat; 
    114  
    115     StreamStatistics m_WakeupStat; 
    116150 
    117151protected: // SPM related 
     
    122156    unsigned int m_nb_buffers; ///< cached from manager->getNbBuffers(), the number of periods to buffer 
    123157    unsigned int m_period; ///< cached from manager->getPeriod(), the period size 
    124  
    125158    unsigned int m_xruns; 
    126  
    127159    unsigned int m_framerate; 
    128160 
    129161    StreamProcessorManager *m_manager; 
    130  
     162     
    131163    bool m_running; 
    132164    bool m_disabled; 
     
    135167 
    136168 
    137  
    138     DECLARE_DEBUG_MODULE; 
    139  
    140169    // frame counter & sync stuff 
    141170    public: 
     
    150179         *         false if it can't 
    151180         */ 
    152         virtual bool canClientTransferFrames(unsigned int nframes) = 0
     181        virtual bool canClientTransferFrames(unsigned int nframes)
    153182 
    154183        /** 
     
    195224         * @return the time in internal units 
    196225         */ 
    197         virtual uint64_t getTimeAtPeriod() = 0
     226        virtual uint64_t getTimeAtPeriod()
    198227 
    199228        uint64_t getTimeNow(); 
     
    229258        virtual int getMaxFrameLatency(); 
    230259 
    231         bool setSyncSource(StreamProcessor *s); 
     260        StreamProcessor& getSyncSource(); 
     261 
    232262        float getTicksPerFrame(); 
    233263 
     
    238268 
    239269    protected: 
    240         StreamProcessor *m_SyncSource; 
    241270 
    242271        float m_ticks_per_frame; 
     
    245274        int m_sync_delay; 
    246275 
     276public: 
     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 
    247285}; 
    248286 
    249 /*! 
    250 \brief Class providing a generic interface for receive Stream Processors 
    251  
    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_disposition 
    264         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 Processors 
    284  
    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_disposition 
    296         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  
    309287} 
    310288 
  • branches/ppalmers-streaming/src/libstreaming/StreamProcessorManager.cpp

    r712 r714  
    7272    assert(m_isoManager); 
    7373 
    74     if (processor->getType()==StreamProcessor::E_Receive) { 
     74    if (processor->getType() == StreamProcessor::ePT_Receive) { 
    7575        processor->setVerboseLevel(getDebugLevel()); // inherit debug level 
    7676 
    7777        m_ReceiveProcessors.push_back(processor); 
    78  
    7978        processor->setManager(this); 
    80  
    8179        return true; 
    8280    } 
    8381 
    84     if (processor->getType()==StreamProcessor::E_Transmit) { 
     82    if (processor->getType() == StreamProcessor::ePT_Transmit) { 
    8583        processor->setVerboseLevel(getDebugLevel()); // inherit debug level 
    8684 
    8785        m_TransmitProcessors.push_back(processor); 
    88  
    8986        processor->setManager(this); 
    90  
    9187        return true; 
    9288    } 
     
    10298    assert(processor); 
    10399 
    104     if (processor->getType()==StreamProcessor::E_Receive) { 
     100    if (processor->getType()==StreamProcessor::ePT_Receive) { 
    105101 
    106102        for ( StreamProcessorVectorIterator it = m_ReceiveProcessors.begin(); 
     
    125121    } 
    126122 
    127     if (processor->getType()==StreamProcessor::E_Transmit) { 
     123    if (processor->getType()==StreamProcessor::ePT_Transmit) { 
    128124        for ( StreamProcessorVectorIterator it = m_TransmitProcessors.begin(); 
    129125            it != m_TransmitProcessors.end(); 
     
    158154    m_SyncSource=s; 
    159155    return true; 
    160 } 
    161  
    162 StreamProcessor *StreamProcessorManager::getSyncSource() { 
    163     return m_SyncSource; 
    164156} 
    165157 
     
    168160    debugOutput( DEBUG_LEVEL_VERBOSE, "enter...\n"); 
    169161 
    170     m_isoManager=new IsoHandlerManager(m_thread_realtime, m_thread_priority + 1); 
     162    m_isoManager = new IsoHandlerManager(m_thread_realtime, m_thread_priority + 1); 
    171163 
    172164    if(!m_isoManager) { 
     
    226218        ++it ) { 
    227219 
    228         if(!(*it)->setSyncSource(m_SyncSource)) { 
    229             debugFatal(  " could not set sync source (%p)...\n",(*it)); 
    230             return false; 
    231         } 
    232  
    233220        if(!(*it)->setOption("slaveMode", m_is_slave)) { 
    234221            debugOutput(DEBUG_LEVEL_VERBOSE, " note: could not set slaveMode option for (%p)...\n",(*it)); 
     
    245232        it != m_TransmitProcessors.end(); 
    246233        ++it ) { 
    247         if(!(*it)->setSyncSource(m_SyncSource)) { 
    248             debugFatal(  " could not set sync source (%p)...\n",(*it)); 
    249             return false; 
    250         } 
    251234        if(!(*it)->setOption("slaveMode", m_is_slave)) { 
    252235            debugOutput(DEBUG_LEVEL_VERBOSE, " note: could not set slaveMode option for (%p)...\n",(*it)); 
     
    377360        waitForPeriod(); 
    378361        // drop the frames for all receive SP's 
    379         dryRun(StreamProcessor::E_Receive); 
     362        dryRun(StreamProcessor::ePT_Receive); 
    380363         
    381364        // we don't have to dryrun for the xmit SP's since they 
     
    10671050    debugOutput( DEBUG_LEVEL_VERBOSE, "Transferring period...\n"); 
    10681051    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); 
    10711054    return retval; 
    10721055} 
     
    10811064 */ 
    10821065 
    1083 bool StreamProcessorManager::transfer(enum StreamProcessor::EProcessorType t) { 
     1066bool StreamProcessorManager::transfer(enum StreamProcessor::eProcessorType t) { 
    10841067    debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "Transferring period...\n"); 
    10851068    bool retval = true; 
    10861069    // a static cast could make sure that there is no performance 
    10871070    // penalty for the virtual functions (to be checked) 
    1088     if (t==StreamProcessor::E_Receive) { 
     1071    if (t==StreamProcessor::ePT_Receive) { 
    10891072        // determine the time at which we want reception to start 
    10901073        float rate=m_SyncSource->getTicksPerFrame(); 
     
    11481131    debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "Dry-running period...\n"); 
    11491132    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); 
    11521135    return retval; 
    11531136} 
     
    11621145 */ 
    11631146 
    1164 bool StreamProcessorManager::dryRun(enum StreamProcessor::EProcessorType t) { 
     1147bool StreamProcessorManager::dryRun(enum StreamProcessor::eProcessorType t) { 
    11651148    debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "Dry-running period...\n"); 
    11661149    bool retval = true; 
    11671150    // a static cast could make sure that there is no performance 
    11681151    // penalty for the virtual functions (to be checked) 
    1169     if (t==StreamProcessor::E_Receive) { 
     1152    if (t==StreamProcessor::ePT_Receive) { 
    11701153        // determine the time at which we want reception to start 
    11711154        float rate=m_SyncSource->getTicksPerFrame(); 
  • branches/ppalmers-streaming/src/libstreaming/StreamProcessorManager.h

    r705 r714  
    8787 
    8888    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) 
    9090     
    9191    bool dryRun(); 
    92     bool dryRun(enum StreamProcessor::EProcessorType); 
     92    bool dryRun(enum StreamProcessor::eProcessorType); 
    9393 
    9494    int getDelayedUsecs() {return m_delayed_usecs;}; 
     
    122122public: 
    123123    bool setSyncSource(StreamProcessor *s); 
    124     StreamProcessor * getSyncSource(); 
     124    StreamProcessor& getSyncSource() 
     125        {return *m_SyncSource;}; 
    125126 
    126127protected: 
  • branches/ppalmers-streaming/src/libstreaming/util/IsoHandlerManager.cpp

    r707 r714  
    304304 
    305305    // allocate a handler for this stream 
    306     if (stream->getType()==IsoStream::EST_Receive) { 
     306    if (stream->getStreamType()==IsoStream::eST_Receive) { 
    307307        // setup the optimal parameters for the raw1394 ISO buffering 
    308308        unsigned int packets_per_period=stream->getPacketsPerPeriod(); 
     
    394394    } 
    395395 
    396     if (stream->getType()==IsoStream::EST_Transmit) { 
     396    if (stream->getStreamType()==IsoStream::eST_Transmit) { 
    397397        // setup the optimal parameters for the raw1394 ISO buffering 
    398398        unsigned int packets_per_period=stream->getPacketsPerPeriod(); 
  • branches/ppalmers-streaming/tests/SytMonitor.cpp

    r705 r714  
    3535 
    3636SytMonitor::SytMonitor(int port) 
    37     : IsoStream(IsoStream::EST_Receive, port) { 
     37    : IsoStream(IsoStream::eST_Receive, port) { 
    3838    m_cinfo_buffer=ffado_ringbuffer_create(16384*sizeof(struct cycle_info)); 
    3939 
  • branches/ppalmers-streaming/tests/test-cycletimer.cpp

    r705 r714  
    288288#ifdef TEST_PORT_0 
    289289    // 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); 
    291291 
    292292    if (!s) {