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

Revision 2803, 4.5 kB (checked in by jwoithe, 3 years ago)

Cosmetic: capitalise "L" in "Linux".

"Linux" is a proper noun so it should start with a capital letter. These
changes are almost all within comments.

This patch was originally proposed by pander on the ffado-devel mailing
list. It has been expanded to cover all similar cases to maintain
consistency throughout the source tree.

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_DIGIDESIGNTRANSMITSTREAMPROCESSOR__
26 #define __FFADO_DIGIDESIGNTRANSMITSTREAMPROCESSOR__
27
28 /**
29  * This class implements Digidesign based 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 Port;
40 class DigidesignAudioPort;
41 class DigidesignMidiPort;
42 /*!
43 \brief The Base Class for a Digidesign transmit stream processor
44
45  This class implements a TransmitStreamProcessor that multiplexes Ports
46  into Digidesign streams.
47
48 */
49 class DigidesignTransmitStreamProcessor
50     : public StreamProcessor
51 {
52
53 public:
54     /**
55      * Create a Digidesign transmit StreamProcessor
56      */
57     DigidesignTransmitStreamProcessor(FFADODevice &parent, unsigned int event_size);
58     virtual ~DigidesignTransmitStreamProcessor() {};
59
60     enum eChildReturnValue generatePacketHeader(unsigned char *data, unsigned int *length,
61                                                 unsigned char *tag, unsigned char *sy,
62                                                 uint32_t pkt_ctr);
63     enum eChildReturnValue generatePacketData(unsigned char *data, unsigned int *length);
64     enum eChildReturnValue generateEmptyPacketHeader(unsigned char *data, unsigned int *length,
65                                                      unsigned char *tag, unsigned char *sy,
66                                                      uint32_t pkt_ctr);
67     enum eChildReturnValue generateEmptyPacketData(unsigned char *data, unsigned int *length);
68     enum eChildReturnValue generateSilentPacketHeader(unsigned char *data, unsigned int *length,
69                                                       unsigned char *tag, unsigned char *sy,
70                                                       uint32_t pkt_ctr);
71     enum eChildReturnValue generateSilentPacketData(unsigned char *data, unsigned int *length);
72     virtual bool prepareChild();
73
74 public:
75     virtual unsigned int getEventSize()
76                 {return m_event_size;};
77     virtual unsigned int getMaxPacketSize();
78     virtual unsigned int getEventsPerFrame()
79                     { return 1; };
80     virtual unsigned int getNominalFramesPerPacket();
81
82 protected:
83     bool processWriteBlock(char *data, unsigned int nevents, unsigned int offset);
84     bool transmitSilenceBlock(char *data, unsigned int nevents, unsigned int offset);
85
86 private:
87     unsigned int fillNoDataPacketHeader(quadlet_t *data, unsigned int* length);
88     unsigned int fillDataPacketHeader(quadlet_t *data, unsigned int* length, uint32_t ts);
89
90     int transmitBlock(char *data, unsigned int nevents,
91                         unsigned int offset);
92
93     bool encodePacketPorts(quadlet_t *data, unsigned int nevents,
94                            unsigned int dbc);
95
96     int encodePortToDigidesignEvents(DigidesignAudioPort *, quadlet_t *data,
97                                 unsigned int offset, unsigned int nevents);
98     int encodeSilencePortToDigidesignEvents(DigidesignAudioPort *, quadlet_t *data,
99                                 unsigned int offset, unsigned int nevents);
100
101     int encodePortToDigidesignMidiEvents(
102                        DigidesignMidiPort *p, quadlet_t *data,
103                        unsigned int offset, unsigned int nevents);
104     int encodeSilencePortToDigidesignMidiEvents(
105                        DigidesignMidiPort *p, quadlet_t *data,
106                        unsigned int offset, unsigned int nevents);
107
108     /*
109      * An iso packet mostly consists of multiple events.  m_event_size
110      * is the size of a single 'event' in bytes.
111      */
112     unsigned int m_event_size;
113
114 };
115
116 } // end of namespace Streaming
117
118 #endif /* __FFADO_DIGIDESIGNTRANSMITSTREAMPROCESSOR__ */
Note: See TracBrowser for help on using the browser.