Show
Ignore:
Timestamp:
11/28/07 03:25:27 (13 years ago)
Author:
ppalmers
Message:

adapt motu code to new SP base class (compiles, needs real testing)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/ppalmers-streaming/src/libstreaming/motu/MotuTransmitStreamProcessor.h

    r732 r733  
    2222 */ 
    2323 
    24 #ifndef __FFADO_AMDTPTRANSMITSTREAMPROCESSOR__ 
    25 #define __FFADO_AMDTPTRANSMITSTREAMPROCESSOR__ 
     24#ifndef __FFADO_MOTUTRANSMITSTREAMPROCESSOR__ 
     25#define __FFADO_MOTUTRANSMITSTREAMPROCESSOR__ 
    2626 
    2727/** 
    28  * This class implements IEC61883-6 / AM824 / AMDTP based streaming 
     28 * This class implements MOTU based streaming 
    2929 */ 
    3030 
     
    3434#include "../util/cip.h" 
    3535 
    36 #include <libiec61883/iec61883.h> 
    37 #include <pthread.h> 
    38  
    39 #define AMDTP_MAX_PACKET_SIZE 2048 
    40  
    41 #define IEC61883_STREAM_TYPE_MIDI   0x0D 
    42 #define IEC61883_STREAM_TYPE_SPDIF  0x00 
    43 #define IEC61883_STREAM_TYPE_MBLA   0x06 
    44  
    45 #define IEC61883_AM824_LABEL_MASK             0xFF000000 
    46 #define IEC61883_AM824_GET_LABEL(x)         (((x) & 0xFF000000) >> 24) 
    47 #define IEC61883_AM824_SET_LABEL(x,y)         ((x) | ((y)<<24)) 
    48  
    49 #define IEC61883_AM824_LABEL_MIDI_NO_DATA     0x80 
    50 #define IEC61883_AM824_LABEL_MIDI_1X          0x81 
    51 #define IEC61883_AM824_LABEL_MIDI_2X          0x82 
    52 #define IEC61883_AM824_LABEL_MIDI_3X          0x83 
    53  
    5436namespace Streaming { 
    5537 
    5638class Port; 
    57 class AmdtpAudioPort; 
    58 class AmdtpMidiPort; 
     39class MotuAudioPort; 
    5940 
    6041/*! 
    61 \brief The Base Class for an AMDTP transmit stream processor 
     42\brief The Base Class for an MOTU transmit stream processor 
    6243 
    6344 This class implements a TransmitStreamProcessor that multiplexes Ports 
    64  into AMDTP streams. 
     45 into MOTU streams. 
    6546 
    6647*/ 
    67 class AmdtpTransmitStreamProcessor 
     48class MotuTransmitStreamProcessor 
    6849    : public StreamProcessor 
    6950{ 
     
    7152public: 
    7253    /** 
    73      * Create a AMDTP transmit StreamProcessor 
    74      * @param port 1394 port 
    75      * @param framerate frame rate 
    76      * @param dimension number of substreams in the ISO stream 
    77      *                  (midi-muxed is only one stream) 
     54     * Create a MOTU transmit StreamProcessor 
    7855     */ 
    79     AmdtpTransmitStreamProcessor(int port, int dimension); 
    80     virtual ~AmdtpTransmitStreamProcessor() {}; 
     56    MotuTransmitStreamProcessor(int port, unsigned int event_size); 
     57    virtual ~MotuTransmitStreamProcessor() {}; 
    8158 
    8259    enum eChildReturnValue generatePacketHeader(unsigned char *data, unsigned int *length, 
     
    9572 
    9673public: 
    97     virtual unsigned int getEventSize() 
    98                     {return 4;}; 
    99     virtual unsigned int getMaxPacketSize() 
    100                     {return 4 * (2 + m_syt_interval * m_dimension);}; 
    101     virtual unsigned int getEventsPerFrame() 
    102                     { return m_dimension; }; 
    103     virtual unsigned int getNominalFramesPerPacket() 
    104                     {return m_syt_interval;}; 
    105     virtual unsigned int getPacketsPerPeriod(); 
    106     virtual unsigned int getNominalPacketsNeeded(unsigned int nframes); 
     74    virtual unsigned int getEventSize()  
     75                {return m_event_size;}; 
     76    virtual unsigned int getMaxPacketSize(); 
     77    virtual unsigned int getEventsPerFrame()  
     78                    { return 1; }; // FIXME: check 
     79    virtual unsigned int getNominalFramesPerPacket(); 
    10780 
    10881protected: 
     
    11184 
    11285private: 
    113     unsigned int fillNoDataPacketHeader(struct iec61883_packet *packet, unsigned int* length); 
    114     unsigned int fillDataPacketHeader(struct iec61883_packet *packet, unsigned int* length, uint32_t ts); 
     86    unsigned int fillNoDataPacketHeader(quadlet_t *data, unsigned int* length); 
     87    unsigned int fillDataPacketHeader(quadlet_t *data, unsigned int* length, uint32_t ts); 
    11588 
    11689    int transmitBlock(char *data, unsigned int nevents, 
     
    12093                           unsigned int dbc); 
    12194 
    122     int encodePortToMBLAEvents(AmdtpAudioPort *, quadlet_t *data, 
     95    int encodePortToMotuEvents(MotuAudioPort *, quadlet_t *data, 
    12396                                unsigned int offset, unsigned int nevents); 
    124     int encodeSilencePortToMBLAEvents(AmdtpAudioPort *, quadlet_t *data, 
     97    int encodeSilencePortToMotuEvents(MotuAudioPort *, quadlet_t *data, 
    12598                                unsigned int offset, unsigned int nevents); 
    12699 
    127     struct iec61883_cip m_cip_status; 
    128     int m_dimension; 
    129     unsigned int m_syt_interval; 
    130     int m_fdf; 
    131     unsigned int m_dbc; 
     100    /* 
     101     * An iso packet mostly consists of multiple events.  m_event_size 
     102     * is the size of a single 'event' in bytes. 
     103     */ 
     104    unsigned int m_event_size; 
     105 
     106    // Keep track of transmission data block count 
     107    unsigned int m_tx_dbc; 
     108 
    132109}; 
    133110 
    134111} // end of namespace Streaming 
    135112 
    136 #endif /* __FFADO_AMDTPTRANSMITSTREAMPROCESSOR__ */ 
     113#endif /* __FFADO_MOTUTRANSMITSTREAMPROCESSOR__ */ 
    137114