root/branches/libfreebob-2.0/src/libstreaming/IsoStream.cpp

Revision 244, 3.0 kB (checked in by pieterpalmers, 18 years ago)

- first try to implement the SYT synchronisation.

Not working yet.

- committing to spend some time to get the Motu people going.

Line 
1 /* $Id$ */
2
3 /*
4  *   FreeBob Streaming API
5  *   FreeBob = Firewire (pro-)audio for linux
6  *
7  *   http://freebob.sf.net
8  *
9  *   Copyright (C) 2005,2006 Pieter Palmers <pieterpalmers@users.sourceforge.net>
10  *
11  *   This program is free software {} you can redistribute it and/or modify
12  *   it under the terms of the GNU General Public License as published by
13  *   the Free Software Foundation {} either version 2 of the License, or
14  *   (at your option) any later version.
15  *
16  *   This program is distributed in the hope that it will be useful,
17  *   but WITHOUT ANY WARRANTY {} without even the implied warranty of
18  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *   GNU General Public License for more details.
20  *
21  *   You should have received a copy of the GNU General Public License
22  *   along with this program {} if not, write to the Free Software
23  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  *
25  *
26  *
27  */
28
29 #include "IsoStream.h"
30 #include "PacketBuffer.h"
31 #include <assert.h>
32
33
34 namespace FreebobStreaming
35 {
36
37 IMPL_DEBUG_MODULE( IsoStream, IsoStream, DEBUG_LEVEL_NORMAL );
38
39 enum raw1394_iso_disposition
40 IsoStream::putPacket(unsigned char *data, unsigned int length,
41                               unsigned char channel, unsigned char tag, unsigned char sy,
42                                   unsigned int cycle, unsigned int dropped) {
43
44         debugOutput( DEBUG_LEVEL_VERY_VERBOSE,
45                      "received packet: length=%d, channel=%d, cycle=%d\n",
46                      length, channel, cycle );
47
48         return RAW1394_ISO_OK;
49 }
50
51 enum raw1394_iso_disposition
52 IsoStream::getPacket(unsigned char *data, unsigned int *length,
53                               unsigned char *tag, unsigned char *sy,
54                               int cycle, unsigned int dropped, unsigned int max_length) {
55         debugOutput( DEBUG_LEVEL_VERY_VERBOSE,
56                      "sending packet: length=%d, cycle=%d\n",
57                      *length, cycle );
58
59         memcpy(data,&cycle,sizeof(cycle));
60         *length=sizeof(cycle);
61         *tag = 1;
62         *sy = 0;
63
64
65         return RAW1394_ISO_OK;
66 }
67
68 int IsoStream::getNodeId() {
69         if (m_handler) {
70                 return m_handler->getLocalNodeId();
71         }
72         return -1;
73 }
74
75
76 void IsoStream::dumpInfo()
77 {
78
79         debugOutputShort( DEBUG_LEVEL_NORMAL, "  Address        : %p\n",this);
80         debugOutputShort( DEBUG_LEVEL_NORMAL, "  Stream type    : %s\n",
81              (this->getType()==EST_Receive ? "Receive" : "Transmit"));
82         debugOutputShort( DEBUG_LEVEL_NORMAL, "  Port, Channel  : %d, %d\n",
83              m_port, m_channel);
84
85 };
86
87 bool IsoStream::setChannel(int c) {
88         debugOutput( DEBUG_LEVEL_VERBOSE, "setting channel to %d\n",c);
89
90         m_channel=c;
91         return true;
92 }
93
94
95 bool IsoStream::reset() {
96         debugOutput( DEBUG_LEVEL_VERBOSE, "enter...\n");
97         return true;
98 }
99
100 bool IsoStream::prepare() {
101         debugOutput( DEBUG_LEVEL_VERBOSE, "enter...\n");
102         return true;
103 }
104
105 bool IsoStream::init() {
106         debugOutput( DEBUG_LEVEL_VERBOSE, "enter...\n");
107         return true;
108
109 }
110
111 void IsoStream::setHandler(IsoHandler *h) {
112         debugOutput( DEBUG_LEVEL_VERBOSE, "setting handler of isostream %p to %p\n", this,h);
113         m_handler=h;
114 }
115
116 void IsoStream::clearHandler() {
117         debugOutput( DEBUG_LEVEL_VERBOSE, "clearing handler of isostream %p\n", this);
118
119     m_handler=0;
120
121 }
122
123 }
Note: See TracBrowser for help on using the browser.