root/trunk/libffado/src/libstreaming/digidesign/DigidesignReceiveStreamProcessor.h

Revision 1961, 3.0 kB (checked in by jwoithe, 13 years ago)

digidesign: further foundational work for the digidesign driver skeleton. This revision adds in the streaming-related objects. Coming next will be integration of this new driver into the build system and compile-testing.

Line 
1 /*
2  * Copyright (C) 2005-2008, 2011 by Jonathan Woithe
3  * Copyright (C) 2005-2008 by Pieter Palmers
4  *
5  * This file is part of FFADO
6  * FFADO = Free Firewire (pro-)audio drivers for linux
7  *
8  * FFADO is based upon FreeBoB.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 2 of the License, or
13  * (at your option) version 3 of the License.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24
25 #ifndef __FFADO_DIGIDESIGNRECEIVESTREAMPROCESSOR__
26 #define __FFADO_DIGIDESIGNRECEIVESTREAMPROCESSOR__
27
28 /**
29  * This class implements Digidesign streaming
30  */
31
32 #include "debugmodule/debugmodule.h"
33
34 #include "../generic/StreamProcessor.h"
35 #include "../util/cip.h"
36
37 namespace Streaming {
38
39 class DigidesignAudioPort;
40 class DigidesignMidiPort;
41 /*!
42  * \brief The Base Class for a Digidesign receive stream processor
43  *
44  * This class implements the outgoing stream processing for
45  * Digidesign devices
46  *
47  */
48 class DigidesignReceiveStreamProcessor
49     : public StreamProcessor
50 {
51
52 public:
53     /**
54      * Create a Digidesign receive StreamProcessor
55      * @param port 1394 port
56      * @param event_size the size in bytes of a single "frame" in the audio stream
57      */
58     DigidesignReceiveStreamProcessor(FFADODevice &parent, unsigned int event_size);
59     virtual ~DigidesignReceiveStreamProcessor() {};
60
61     enum eChildReturnValue processPacketHeader(unsigned char *data, unsigned int length,
62                                                unsigned char tag, unsigned char sy,
63                                                uint32_t pkt_ctr);
64     enum eChildReturnValue processPacketData(unsigned char *data, unsigned int length);
65
66     virtual bool prepareChild();
67
68 public:
69     virtual unsigned int getEventSize()
70                 {return m_event_size;};
71     virtual unsigned int getMaxPacketSize();
72     virtual unsigned int getEventsPerFrame()
73                     { return 1; };
74     virtual unsigned int getNominalFramesPerPacket();
75
76 protected:
77     bool processReadBlock(char *data, unsigned int nevents, unsigned int offset);
78
79 private:
80     bool decodePacketPorts(quadlet_t *data, unsigned int nevents, unsigned int dbc);
81
82     int decodeDigidesignEventsToPort(DigidesignAudioPort *, quadlet_t *data, unsigned int offset, unsigned int nevents);
83     int decodeDigidesignMidiEventsToPort(DigidesignMidiPort *, 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
94 } // end of namespace Streaming
95
96 #endif /* __FFADO_DIGIDESIGNRECEIVESTREAMPROCESSOR__ */
Note: See TracBrowser for help on using the browser.