root/branches/ppalmers-streaming/src/libstreaming/motu/MotuReceiveStreamProcessor.h

Revision 733, 3.0 kB (checked in by ppalmers, 13 years ago)

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

Line 
1 /*
2  * Copyright (C) 2005-2007 by Pieter Palmers
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License version 2.1, as published by the Free Software Foundation;
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21  * MA 02110-1301 USA
22  */
23
24 #ifndef __FFADO_MOTURECEIVESTREAMPROCESSOR__
25 #define __FFADO_MOTURECEIVESTREAMPROCESSOR__
26
27 /**
28  * This class implements MOTU streaming
29  */
30
31 #include "debugmodule/debugmodule.h"
32
33 #include "../generic/StreamProcessor.h"
34 #include "../util/cip.h"
35
36 namespace Streaming {
37
38 class MotuAudioPort;
39 /*!
40  * \brief The Base Class for a MOTU receive stream processor
41  *
42  * This class implements the outgoing stream processing for
43  * motu devices
44  *
45  */
46 class MotuReceiveStreamProcessor
47     : public StreamProcessor
48 {
49
50 public:
51     /**
52      * Create a MOTU receive StreamProcessor
53      * @param port 1394 port
54      * @param dimension number of substreams in the ISO stream
55      *                  (midi-muxed is only one stream)
56      */
57     MotuReceiveStreamProcessor(int port, unsigned int event_size);
58     virtual ~MotuReceiveStreamProcessor() {};
59
60     enum eChildReturnValue processPacketHeader(unsigned char *data, unsigned int length,
61                   unsigned char channel, unsigned char tag, unsigned char sy,
62                   unsigned int cycle, unsigned int dropped);
63     enum eChildReturnValue processPacketData(unsigned char *data, unsigned int length,
64                   unsigned char channel, unsigned char tag, unsigned char sy,
65                   unsigned int cycle, unsigned int dropped);
66
67     virtual bool prepareChild();
68
69 public:
70     virtual unsigned int getEventSize()
71                 {return m_event_size;};
72     virtual unsigned int getMaxPacketSize();
73     virtual unsigned int getEventsPerFrame()
74                     { return 1; }; // FIXME: check
75     virtual unsigned int getNominalFramesPerPacket();
76
77 protected:
78     bool processReadBlock(char *data, unsigned int nevents, unsigned int offset);
79
80 private:
81     bool decodePacketPorts(quadlet_t *data, unsigned int nevents, unsigned int dbc);
82
83     int decodeMotuEventsToPort(MotuAudioPort *, quadlet_t *data, unsigned int offset, unsigned int nevents);
84
85     /*
86      * An iso packet mostly consists of multiple events.  m_event_size
87      * is the size of a single 'event' in bytes.
88      */
89     unsigned int m_event_size;
90 };
91
92
93 } // end of namespace Streaming
94
95 #endif /* __FFADO_MOTURECEIVESTREAMPROCESSOR__ */
96
Note: See TracBrowser for help on using the browser.