Changeset 336 for branches

Show
Ignore:
Timestamp:
12/25/06 07:42:25 (16 years ago)
Author:
pieterpalmers
Message:

- Merged the developments on trunk since branch-off:

branch occurred at rev 194
svn merge -r 194:HEAD https://svn.sourceforge.net/svnroot/freebob/trunk/libfreebob

- Modified libfreebobavc to use the messagebuffer for debug info.
- This should compile and run

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libfreebob-2.0/AUTHORS

    r125 r336  
     1Pieter Palmers  <pieterpalmers@users.sourceforge.net> 
    12Daniel Wagner <wagi@monom.org> 
     3Pieter Palmers  <pieterpalmers@users.sourceforge.net> 
     4Jonathan Woithe <jwoithe@physics.adelaide.edu.au> 
  • branches/libfreebob-2.0/ChangeLog

    r194 r336  
     12006-11-20  Daniel Wagner  <wagi@monom.org> 
     2 
     3        * freebob_set_samplerate: return value consitency fix. On success 
     4        it return 0 else -1. Reported by Jamie Gennis jgennis at gmail dot com 
     5 
     6        * freebob_streaming_start: Reset the playback ringbuffer before calling  
     7        freebob_streaming_start.  
     8         
     92006-11-12  Daniel Wagner  <wagi@monom.org> 
     10 
     11        * test mixer programm added. 
     12 
     13        * basic function block AV/C commands added. 
     14        test program for setting the volume added. 
     15 
     162006-11-11  Daniel Wagner  <wagi@monom.org> 
     17 
     18        * src/bebob/bebob_avdevice.cpp (setSamplingFrequencyPlug): copy past 
     19        error fixed. Reported by Jamie Gennis jgennis at gmail dot com 
     20 
     212006-08-27  Daniel Wagner  <wagi@monom.org> 
     22 
     23        * configure.ac: Version set to 1.4.0 
     24        * maudio device support infrastructure added. Implements 
     25        IAvDevice interface, discover reads the information from 
     26        an xml file.  
     27 
     282006-08-22  Daniel Wagner  <wagi@monom.org> 
     29 
     30        * configure.ac: Version bump to 1.3.0 
     31        * freebob_sync allows now to set the sync mode. It does not 
     32        check yet if it really could set the mode. 
     33 
     342006-07-17  Daniel Wagner  <wagi@monom.org> 
     35 
     36        * configure.ac: Version bump to 1.2.0 
     37        * freebob_sync program added 
     38        * Basic interface added for sync info 
     39 
     402006-07-02  Daniel Wagner  <wagi@monom.org> 
     41 
     42        * firmware downloader: check device firmware compatibility 
     43 
     442006-06-27  Daniel Wagner  <wagi@monom.org> 
     45 
     46        * configure.ac: Version bump to 1.1.0 
     47        * remove bebob_light code 
     48        * downloader various improvements 
     49        * ConfigRom::isAvcDevice() removed. Device probe code added.  
     50        Each device driver class can check if it supports a device. 
     51 
     522006-06-24  Daniel Wagner  <wagi@monom.org> 
     53 
     54        * tests/streaming/Makefile.am: Fixed build problem with missing '/'. 
     55 
     562006-06-21  Daniel Wagner  <wagi@monom.org> 
     57 
     58        * freebob-downloader first version added 
     59 
     602006-06-10  Daniel Wagner  <wagi@monom.org> 
     61 
     62        * Changed building rules: No static sub libraries 
     63        are build anymore. 
     64 
     652006-06-01  Daniel Wagner  <wagi@monom.org> 
     66 
     67        * configure.ac: Version bump to 1.0.0 
     68 
     69        * Changed all FreeBob to FreeBoB 
     70        * Removed all .cvsignore 
     71        * Added Pieter to AUTHORS 
     72        * Updated NEWS and README (release canditate date added) 
     73 
     742006-05-31  Daniel Wagner  <wagi@monom.org> 
     75 
     76        * Free all allocated asprintf buffers after xmlNewChild. 
     77        Compiler warning removed 
     78 
     792006-05-31  Pieter Palmers  <pieterpalmers@users.sourceforge.net> 
     80    * src/devicemanager.cpp: 
     81    - fixed some memory leaks 
     82    * src/bebob_light/bebob_light_avdevice.cpp: 
     83    - fixed some memory leaks 
     84    - implemented a test to see if the correct AVC subunits are  
     85      present 
     86    - fixed a bug that added NULL to the subunit list when an 
     87      unsupported AVC subunit was found. 
     88    * src/libfreebobavc/avc_generic.cpp: 
     89    - fixed memory leak 
     90    * src/libfreebobavc/ieee1394service.cpp: 
     91    - fixed memory leak 
     92    * src/libfreebobavc/avc_extended_plug_info.cpp: 
     93    - fixed memory leak 
     94    * src/libfreebobstreaming/messagebuffer.h: 
     95    - add extern "C" 
     96    * src/libfreebobstreaming/freebob_streaming.c: 
     97    - fixed problem with verbosity setting not being passed on 
     98    - reformatted some error/debug messages 
     99    * configure.ac: version bump to 0.9.4 
     100 
     1012006-05-29  Pieter Palmers  <pieterpalmers@users.sourceforge.net> 
     102    - implemented a hacked solution to the naming problem when  
     103      using 2 identical devices. Now the port name is prefixed  
     104      with "dev#?" with # being the device number (in order of  
     105      discovery), and the ? being either "c" or "p", meaning  
     106      "capture" or "playback". Note however that there is no  
     107      guarantee that device 1 will be the same device next time  
     108      you start up. This will have to change in 2.0. 
     109    * configure.ac: version bump to 0.9.3 
     110 
     1112006-05-26  Pieter Palmers  <pieterpalmers@users.sourceforge.net> 
     112        * src/libfreebobstreaming/*:  
     113    - added a 'verbose' option to disable/enable message output 
     114    - removed some residual messages 
     115    * configure.ac: version bump to 0.9.2 
     116 
     1172006-05-24  Pieter Palmers  <pieterpalmers@users.sourceforge.net> 
     118    * README: 
     119    - updated readme to reflect recent changes 
     120    * src/libfreebobstreaming/*:  
     121    - message buffer fix 
     122    * configure.ac:  
     123    - Made -O2 the default for non-debug builds 
     124    - Version bump to 0.9.1 
     125 
     1262006-05-22  Pieter Palmers  <pieterpalmers@users.sourceforge.net> 
     127    * */Makefile.am: 
     128    - fixed some problems wrt missing files in SVN and in make dist 
     129 
     130    * configure.ac: version bump to 0.9.0 (release candidate 1) 
     131 
    11322006-05-12  Pieter Palmers  <pieterpalmers@users.sourceforge.net> 
    2133        * src/libfreebobstreaming/*:  
     
    348479        - I use a build dir of $srcdir/obj-$arch-$os) 
    349480 
    350         Both patches are written by Jeremy Kerr <jk@ozlabs.org> 
     481        Both patches are written by Jeremy Kerr jk at ozlabs dot org 
    351482 
    3524832006-01-12  Daniel Wagner  <wagi@monom.org> 
  • branches/libfreebob-2.0/configure.ac

    r333 r336  
    1 # configure.ac - Configure script for FreeBob
     1# configure.ac - Configure script for FreeBoB
    22# Copyright (C) 2005,06 by Daniel Wagner. 
    33# Copyright (C) 2006    by Pieter Palmers. 
    44# 
    5 # This file is part of FreeBob
     5# This file is part of FreeBoB
    66# 
    7 # FreeBob is free software; you can redistribute it and/or modify 
     7# FreeBoB is free software; you can redistribute it and/or modify 
    88# it under the terms of the GNU General Public License as published by 
    99# the Free Software Foundation; either version 2 of the License, or 
    1010# (at your option) any later version. 
    11 # FreeBob is distributed in the hope that it will be useful, 
     11# FreeBoB is distributed in the hope that it will be useful, 
    1212# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1313# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414# GNU General Public License for more details. 
    1515# You should have received a copy of the GNU General Public License 
    16 # along with FreeBob; if not, write to the Free Software 
     16# along with FreeBoB; if not, write to the Free Software 
    1717# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1818# 
     
    2121 
    2222AC_PREREQ(2.57) 
     23 
    2324 
    2425m4_define(freebob_major_version, 1) 
     
    113114# Check for dependencies 
    114115PKG_CHECK_MODULES(LIBRAW1394, libraw1394 >= 1.2.1) 
    115 PKG_CHECK_MODULES(LIBIEC61883, libiec61883 >= 1.1.0) 
    116 PKG_CHECK_MODULES(LIBAVC1394, libavc1394 >= 0.5.2
     116PKG_CHECK_MODULES(LIBIEC61883, libiec61883 >= 1.0.0) 
     117PKG_CHECK_MODULES(LIBAVC1394, libavc1394 >= 0.5.3
    117118PKG_CHECK_MODULES(ALSA, alsa >= 1.0.0) 
    118119PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.6.0) 
     
    197198) 
    198199 
    199  
    200200CFLAGS="$CFLAGS -Wall -std=gnu99" 
    201 CXXFLAGS="$CXXFLAGS -Wall" 
     201CXXFLAGS="$CXXFLAGS -Wall -DDATADIR=\\\"\$(datadir)\\\""  
    202202 
    203203if test "${debug}" = true; then 
    204204   CFLAGS="$CFLAGS -g -DDEBUG" 
    205205   CXXFLAGS="$CXXFLAGS -g -DDEBUG"  
     206else  
     207   CFLAGS="$CFLAGS -O2" 
     208   CXXFLAGS="$CXXFLAGS -O2" 
    206209fi; 
    207210 
     
    230233                 doc/reference.doxygen 
    231234                 libfreebob/Makefile 
    232                  src/debugmodule/Makefile 
    233                  src/libfreebobavc/Makefile 
    234                  src/libstreaming/Makefile 
    235                  src/libutil/Makefile 
    236235                 src/Makefile 
    237236                 tests/Makefile 
     
    244243AC_MSG_RESULT([ 
    245244 
    246 FreeBob $VERSION is now configured for $canonical_host_type 
     245FreeBoB $VERSION is now configured for $canonical_host_type 
    247246 
    248247  Source directory:     $srcdir 
  • branches/libfreebob-2.0/libfreebob.pc.in

    r125 r336  
    55 
    66Name: libfreebob 
    7 Description: FreeBob 
     7Description: FreeBoB 
    88Version: @VERSION@ 
    99Libs: -L${libdir} -lfreebob 
  • branches/libfreebob-2.0/libfreebob/freebob_streaming.h

    r235 r336  
    11/* 
    2  *   FreeBob Streaming API 
    3  *   FreeBob = Firewire (pro-)audio for linux 
     2 *   FreeBoB Streaming API 
     3 *   FreeBoB = Firewire (pro-)audio for linux 
    44 * 
    55 *   http://freebob.sf.net 
     
    2727/* freebob_streaming.h 
    2828 * 
    29  * Specification for the FreeBob Streaming API 
     29 * Specification for the FreeBoB Streaming API 
    3030 * 
    3131 */ 
     
    161161 
    162162/** 
    163  * Initializes the streaming from/to a FreeBob device. A FreeBob device 
     163 * Initializes the streaming from/to a FreeBoB device. A FreeBoB device 
    164164 * is a virtual device composed of several BeBoB or compatible devices, 
    165165 * linked together in one sync domain. 
     
    189189 
    190190/** 
    191  * Finishes the FreeBob streaming. Cleans up all internal data structures 
     191 * Finishes the FreeBoB streaming. Cleans up all internal data structures 
    192192 * and terminates connections. 
    193193 * 
     
    314314 
    315315/** 
    316  * Starts the streaming operation. This initiates the connections to the FreeBob devices and 
     316 * Starts the streaming operation. This initiates the connections to the FreeBoB devices and 
    317317 * starts the packet handling thread(s). This has to be called before any I/O can occur. 
    318318 * 
     
    324324 
    325325/** 
    326  * Stops the streaming operation. This closes the connections to the FreeBob devices and 
     326 * Stops the streaming operation. This closes the connections to the FreeBoB devices and 
    327327 * stops the packet handling thread(s).  
    328328 * 
  • branches/libfreebob-2.0/libfreebob/Makefile.am

    r222 r336  
    22# Copyright (C) 2005 by Daniel Wagner. 
    33# 
    4 # This file is part of FreeBob
     4# This file is part of FreeBoB
    55# 
    6 # FreeBob is free software; you can redistribute it and/or modify 
     6# FreeBoB is free software; you can redistribute it and/or modify 
    77# it under the terms of the GNU General Public License as published by 
    88# the Free Software Foundation; either version 2 of the License, or 
    99# (at your option) any later version. 
    10 # FreeBob is distributed in the hope that it will be useful, 
     10# FreeBoB is distributed in the hope that it will be useful, 
    1111# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313# GNU General Public License for more details. 
    1414# You should have received a copy of the GNU General Public License 
    15 # along with FreeBob; if not, write to the Free Software 
     15# along with FreeBoB; if not, write to the Free Software 
    1616# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1717 
    1818 
    1919libfreebobincludedir = $(includedir)/libfreebob 
     20 
    2021libfreebobinclude_HEADERS = freebob.h freebob_streaming.h xmlparser.h freebob_bounce.h 
    21  
  • branches/libfreebob-2.0/Makefile.am

    r245 r336  
    22# Copyright (C) 2005 by Daniel Wagner. 
    33# 
    4 # This file is part of FreeBob
     4# This file is part of FreeBoB
    55# 
    6 # FreeBob is free software; you can redistribute it and/or modify 
     6# FreeBoB is free software; you can redistribute it and/or modify 
    77# it under the terms of the GNU General Public License as published by 
    88# the Free Software Foundation; either version 2 of the License, or 
    99# (at your option) any later version. 
    10 # FreeBob is distributed in the hope that it will be useful, 
     10# FreeBoB is distributed in the hope that it will be useful, 
    1111# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313# GNU General Public License for more details. 
    1414# You should have received a copy of the GNU General Public License 
    15 # along with FreeBob; if not, write to the Free Software 
     15# along with FreeBoB; if not, write to the Free Software 
    1616# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1717 
  • branches/libfreebob-2.0/NEWS

    r125 r336  
     101.06.2006: 1.0.0 release candidate of libfreebob called 'Take it away Genghis' release. 
    1226.12.2005: First beta release of libfreebob called 'late x-mass gift' release. 
  • branches/libfreebob-2.0/README

    r125 r336  
    1 FreeBob version 0.0.1 
     1FreeBoB version 1.0.0 
    22===================== 
    33 
    44This project aims to provide a free driver implemenation for the BeBoB 
    5 platform.  The BeBob is used in many available IEEE 1394 based break-out  
     5platform.  The BeBoB is used in many available IEEE 1394 based break-out  
    66boxes. 
    7  
    8 This is the first beta release of libfreebob. Currently it depends 
    9 still on the old streaming backend driver from the prealpha-release 2.1. 
    10 In order to use libfreebob you need to download and install it this 
    11 special version. 
    12  
    13 The device discovering is done completely different to the  
    14 prealpha-release version of freebob. In the old version 
    15 it is done using the descriptors. But this version has several sever 
    16 drawbacks, e.g. not every BeBoB device is supported. This implemention 
    17 now uses a some extended commands like the extended plug info command. 
    18 This allows to discover any BeBoB device. Furthermore it provides 
    19 more information and it is extremly faster... which is of course 
    20 not very important because it is only device discovering and not 
    21 streaming :) 
    227 
    238Dependencies 
    249------------ 
    2510 
    26 To build libfreebob you need several libraries. For all libraries a version 
    27 is provided which is a 'known good' version (all tested with a debian testing 
    28 installation).  The first few libraries it seems it is not necessary that  
    29 the version must match. The chances that it works also with an older versions  
    30 are good: 
    31  
    32 alsa        (>= 1.0.11) 
    33 libxml2     (>= 2.6.22) 
     11To build libfreebob you need several libraries. For all libraries a 
     12version is provided which is a 'known good' version.  The first few 
     13libraries it seems it is not necessary that the version must 
     14match. The chances that it works also with an older versions are good: 
     15 
     16alsa        (>= 1.0.0) 
     17libxml2     (>= 2.6.0) 
    3418libpthread  (>= 2.3.5) 
    3519 
    3620These libraries here should be at least the version listed: 
    3721 
    38 libraw1394  (>= 1.2.0),  http://www.linux1394.org 
    39 libiec61883 (>= 1.1.0),  http://www.linux1394.org 
    40 libavc1394  (>= 0.5.1),  http://sourceforge.net/projects/libavc1394 
    41  
    42 And finally, you need the special jackd version which uses libfreebob. 
    43 It can be downloaded from sf.net as well. 
    44  
     22libraw1394  (>= 1.2.1),  http://www.linux1394.org 
     23libiec61883 (>= 1.0.0),  http://www.linux1394.org 
     24libavc1394  (>= 0.5.3),  http://sourceforge.net/projects/libavc1394 
     25 
     26Currently only the jackd audio server is supported. 
     27 
     28jackd (>= 0.102.5), http://jackaudio.org 
     29 
     30Optionally, but recommended is that you install qjackctl: 
     31 
     32qjackctl (>= 0.2.20.10), http://sourceforge.net/projects/qjackctl 
    4533 
    4634How to build 
     
    5644$ export LD_LIBRARY_PATH=/usr/local/lib 
    5745 
    58 If you want to build the release version you can do following (CVS checkout) 
    59  
    60 $ ./autogen.sh 
    61 $ make install 
    62  
    63 If you have not a CVS checkout you can do following: 
     46If you want to build the release version you can do following: 
    6447 
    6548$ ./configure 
     
    7457$ make install 
    7558 
    76 After you have install libfreebob you can start building the 
    77 special jack version with the iec61883 backend driver which is using 
    78 libfreebob. 
    79  
    80  
    81 Testing 
    82 ------- 
    83  
    84 Under the tests directory there is a test program. You should first 
    85 try to run this.  
    86  
    87 If you don't have installed libfreebob then you can adapt your 
    88 LD_LIBRARY_PATH environment variable to 
    89  
    90 $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../src/.libs 
    91  
    92 Then you can try running the program without having to install it. 
    93  
    94 With the release version you see something like this (note that you  
    95 have to provide the correct node id, in this example '-n 0'): 
    96  
    97 wagi@cruxam:~/src/libfreebob/tests$ ./test-freebob -n 0 discover 
    98 Using freebob library version: libfreebob 0.0.1 
    99  
    100 Direction:              0 (capture) 
    101  
    102 Connection Info 
    103 =============== 
    104  
    105 Number of connections:  1 
    106  
    107   Connection  0 
    108   ------------- 
    109     [ 0] Id:         0 
    110     [ 0] Port:       0 
    111     [ 0] Node:       0 
    112     [ 0] Plug:       0 
    113     [ 0] Dimension:  7 
    114     [ 0] Samplerate: 48000 
    115     [ 0] Number of stream infos: 7 
    116  
    117     StreamId  Position Location Format Type DPort Name 
    118     -------------------------------------------------- 
    119     [ 0]:[ 0] 0x01     0x01     0x06   0x03 0x00  LineOut 1+2 left 
    120     [ 0]:[ 1] 0x04     0x02     0x06   0x03 0x00  LineOut 1+2 right 
    121     [ 0]:[ 2] 0x02     0x01     0x06   0x03 0x00  LineOut 3+4 left 
    122     [ 0]:[ 3] 0x05     0x02     0x06   0x03 0x00  LineOut 3+4 right 
    123     [ 0]:[ 4] 0x00     0x01     0x06   0x04 0x00  SpdifOut left 
    124     [ 0]:[ 5] 0x03     0x02     0x06   0x04 0x00  SpdifOut right 
    125     [ 0]:[ 6] 0x06     0x01     0x0d   0x0a 0x00  MidiPort_1 
    126  
    127  
    128 Direction:              1 (playback) 
    129  
    130 Connection Info 
    131 =============== 
    132  
    133 Number of connections:  1 
    134  
    135   Connection  0 
    136   ------------- 
    137     [ 0] Id:         0 
    138     [ 0] Port:       0 
    139     [ 0] Node:       0 
    140     [ 0] Plug:       0 
    141     [ 0] Dimension:  7 
    142     [ 0] Samplerate: 48000 
    143     [ 0] Number of stream infos: 7 
    144  
    145     StreamId  Position Location Format Type DPort Name 
    146     -------------------------------------------------- 
    147     [ 0]:[ 0] 0x01     0x01     0x06   0x02 0x00  MicIn1 left 
    148     [ 0]:[ 1] 0x04     0x02     0x06   0x02 0x00  MicIn1 right 
    149     [ 0]:[ 2] 0x02     0x01     0x06   0x03 0x00  LineIn 3+4 left 
    150     [ 0]:[ 3] 0x05     0x02     0x06   0x03 0x00  LineIn 3+4 right 
    151     [ 0]:[ 4] 0x00     0x01     0x06   0x04 0x00  SpdifIn left 
    152     [ 0]:[ 5] 0x03     0x02     0x06   0x04 0x00  SpdifIn right 
    153     [ 0]:[ 6] 0x06     0x01     0x0d   0x0a 0x00  MidiPort_1 
    154  
    155  
    156 To impress friends you need of course to use the debug version 
    157 which looks like this: 
    158  
    159 wagi@cruxam:~/src/libfreebob/tests$ ./test-freebob -n 0 discover 
    160 Using freebob library version: libfreebob 0.0.1 
    161  
    162 Debug (avdevice.cpp)[47] AvDevice: Found AvDevice (NodeID 0) 
    163 Debug (avdevice.cpp)[1262] enumerateSubUnits: subunit_id =  0, subunit_type =  1 (Audio), max_subunit_ID = 0 
    164 Debug (avdevice.cpp)[1262] enumerateSubUnits: subunit_id =  0, subunit_type = 12 (Music), max_subunit_ID = 0 
    165 Debug (avdevice.cpp)[169] discoverStep1: number of iso input plugs = 2, number of iso output plugs = 2 
    166 Debug (avdevice.cpp)[214] discoverStep2: number of output plugs is 1 for iso input plug 0 
    167 Debug (avdevice.cpp)[251] discoverStep2: output plug 0 is owned by subunit_type 12, subunit_id = 0 
    168 Debug (avdevice.cpp)[1203] discoverPlugConnection: IsoStreamInput plug 0 has a valid connection to plug 0 of MusicSubunit subunit 0 
    169 Debug (avdevice.cpp)[214] discoverStep2: number of output plugs is 0 for iso input plug 1 
    170 Debug (avdevice.cpp)[339] discoverStep3: output plug 0 is owned by subunit_type 12, subunit_id 0 
    171 Debug (avdevice.cpp)[1203] discoverPlugConnection: IsoStreamOutput plug 0 has a valid connection to plug 0 of MusicSubunit subunit 0 
    172 Debug (avdevice.cpp)[339] discoverStep3: output plug 5 is owned by subunit_type 12, subunit_id 0 
    173 Debug (avdevice.cpp)[1203] discoverPlugConnection: IsoStreamOutput plug 1 has a valid connection to plug 5 of MusicSubunit subunit 0 
    174 Debug (avdevice.cpp)[416] discoverStep4: iso input plug 0 is of type 0 (IsoStream) 
    175 Debug (avdevice.cpp)[383] discoverStep4: iso input plug 1 has no valid connecton -> skip 
    176 Debug (avdevice.cpp)[465] discoverStep4: iso output plug 0 is of type 0 (IsoStream) 
    177 Debug (avdevice.cpp)[465] discoverStep4: iso output plug 1 is of type 3 (Sync) 
    178 Debug (avdevice.cpp)[524] discoverStep5: iso input plug 0 has 7 channels 
    179 Debug (avdevice.cpp)[491] discoverStep5: iso input plug 1 has no valid connecton -> skip 
    180 Debug (avdevice.cpp)[573] discoverStep5: iso output plug 0 has 7 channels 
    181 Debug (avdevice.cpp)[573] discoverStep5: iso output plug 1 has 2 channels 
    182 Debug (avdevice.cpp)[636] discoverStep6: iso input plug 0: channel position information retrieved 
    183 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 2 
    184 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 2 
    185 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    186 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 5 
    187 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 2 
    188 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 2 
    189 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 3 
    190 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    191 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 6 
    192 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 2 
    193 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 2 
    194 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 1 
    195 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    196 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 4 
    197 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 2 
    198 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 1 
    199 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 7 
    200 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    201 Debug (avdevice.cpp)[598] discoverStep6: iso input plug 1 has no valid connecton -> skip 
    202 Debug (avdevice.cpp)[690] discoverStep6: iso output plug 0: channel position information retrieved 
    203 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 2 
    204 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 2 
    205 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    206 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 5 
    207 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 2 
    208 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 2 
    209 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 3 
    210 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    211 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 6 
    212 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 2 
    213 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 2 
    214 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 1 
    215 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    216 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 4 
    217 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 2 
    218 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 1 
    219 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 7 
    220 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    221 Debug (avdevice.cpp)[690] discoverStep6: iso output plug 1: channel position information retrieved 
    222 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 2 
    223 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 1 
    224 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    225 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 2 
    226 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 2 
    227 Debug (avdevice.cpp)[767] discoverStep7: iso input plug 0 stream position 2: channel name = LineOut 1+2 left 
    228 Debug (avdevice.cpp)[767] discoverStep7: iso input plug 0 stream position 5: channel name = LineOut 1+2 right 
    229 Debug (avdevice.cpp)[767] discoverStep7: iso input plug 0 stream position 3: channel name = LineOut 3+4 left 
    230 Debug (avdevice.cpp)[767] discoverStep7: iso input plug 0 stream position 6: channel name = LineOut 3+4 right 
    231 Debug (avdevice.cpp)[767] discoverStep7: iso input plug 0 stream position 1: channel name = SpdifOut left 
    232 Debug (avdevice.cpp)[767] discoverStep7: iso input plug 0 stream position 4: channel name = SpdifOut right 
    233 Debug (avdevice.cpp)[767] discoverStep7: iso input plug 0 stream position 7: channel name = MidiPort_1 
    234 Debug (avdevice.cpp)[716] discoverStep7: iso input plug 1 has no valid connecton -> skip 
    235 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 0 stream position 2: channel name = MicIn1 left 
    236 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 0 stream position 5: channel name = MicIn1 right 
    237 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 0 stream position 3: channel name = LineIn 3+4 left 
    238 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 0 stream position 6: channel name = LineIn 3+4 right 
    239 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 0 stream position 1: channel name = SpdifIn left 
    240 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 0 stream position 4: channel name = SpdifIn right 
    241 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 0 stream position 7: channel name = MidiPort_1 
    242 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 1 stream position 1: channel name = SynchChannel1 
    243 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 1 stream position 2: channel name = SynchChannel2 
    244 Debug (avdevice.cpp)[910] discoverStep8: iso input plug 0: cluster index = 1, portType Line, cluster name = LineOut 1+2 
    245 Debug (avdevice.cpp)[910] discoverStep8: iso input plug 0: cluster index = 2, portType Line, cluster name = LineOut 3+4 
    246 Debug (avdevice.cpp)[910] discoverStep8: iso input plug 0: cluster index = 3, portType SPDIF, cluster name = SpdifOut 
    247 Debug (avdevice.cpp)[910] discoverStep8: iso input plug 0: cluster index = 4, portType MIDI, cluster name = MidiSection.0 
    248 Debug (avdevice.cpp)[866] discoverStep8: iso input plug 1 has no valid connecton -> skip 
    249 Debug (avdevice.cpp)[980] discoverStep8: iso output plug 0: cluster index = 1, portType Microphone, cluster name = MicIn1 
    250 Debug (avdevice.cpp)[980] discoverStep8: iso output plug 0: cluster index = 2, portType Line, cluster name = LineIn 3+4 
    251 Debug (avdevice.cpp)[980] discoverStep8: iso output plug 0: cluster index = 3, portType SPDIF, cluster name = SpdifIn 
    252 Debug (avdevice.cpp)[980] discoverStep8: iso output plug 0: cluster index = 4, portType MIDI, cluster name = MidiSection.0 
    253 Warning (avdevice.cpp)[936] discoverStep8: Skipping plugs with id > 0. Further investigation needed 
    254 Debug (avdevice.cpp)[1040] discoverStep9: discoverStep9: iso input plug 0 uses sampling frequency 4 
    255 Debug (avdevice.cpp)[1070] discoverStep9: iso input plug 0 cluster info 1: stream format 6 
    256 Debug (avdevice.cpp)[1070] discoverStep9: iso input plug 0 cluster info 2: stream format 6 
    257 Debug (avdevice.cpp)[1070] discoverStep9: iso input plug 0 cluster info 3: stream format 6 
    258 Debug (avdevice.cpp)[1070] discoverStep9: iso input plug 0 cluster info 4: stream format 13 
    259 Debug (avdevice.cpp)[1008] discoverStep9: iso input plug 1 has no valid connecton -> skip 
    260 Debug (avdevice.cpp)[1134] discoverStep9: discoverStep9: iso output plug 0 uses sampling frequency 4 
    261 Debug (avdevice.cpp)[1164] discoverStep9: iso output plug 0 cluster info 1: stream format 6 
    262 Debug (avdevice.cpp)[1164] discoverStep9: iso output plug 0 cluster info 2: stream format 6 
    263 Debug (avdevice.cpp)[1164] discoverStep9: iso output plug 0 cluster info 3: stream format 6 
    264 Debug (avdevice.cpp)[1164] discoverStep9: iso output plug 0 cluster info 4: stream format 13 
    265 Debug (avdevice.cpp)[1177] discoverStep9: iso output plug 1 is sync stream with sampling frequency 4 
    266 Direction:              0 (capture) 
    267  
    268 Connection Info 
    269 =============== 
    270  
    271 Number of connections:  1 
    272  
    273   Connection  0 
    274   ------------- 
    275     [ 0] Id:         0 
    276     [ 0] Port:       0 
    277     [ 0] Node:       0 
    278     [ 0] Plug:       0 
    279     [ 0] Dimension:  7 
    280     [ 0] Samplerate: 48000 
    281     [ 0] Number of stream infos: 7 
    282  
    283     StreamId  Position Location Format Type DPort Name 
    284     -------------------------------------------------- 
    285     [ 0]:[ 0] 0x01     0x01     0x06   0x03 0x00  LineOut 1+2 left 
    286     [ 0]:[ 1] 0x04     0x02     0x06   0x03 0x00  LineOut 1+2 right 
    287     [ 0]:[ 2] 0x02     0x01     0x06   0x03 0x00  LineOut 3+4 left 
    288     [ 0]:[ 3] 0x05     0x02     0x06   0x03 0x00  LineOut 3+4 right 
    289     [ 0]:[ 4] 0x00     0x01     0x06   0x04 0x00  SpdifOut left 
    290     [ 0]:[ 5] 0x03     0x02     0x06   0x04 0x00  SpdifOut right 
    291     [ 0]:[ 6] 0x06     0x01     0x0d   0x0a 0x00  MidiPort_1 
    292  
    293  
    294 Direction:              1 (playback) 
    295  
    296 Connection Info 
    297 =============== 
    298  
    299 Number of connections:  1 
    300  
    301   Connection  0 
    302   ------------- 
    303     [ 0] Id:         0 
    304     [ 0] Port:       0 
    305     [ 0] Node:       0 
    306     [ 0] Plug:       0 
    307     [ 0] Dimension:  7 
    308     [ 0] Samplerate: 48000 
    309     [ 0] Number of stream infos: 7 
    310  
    311     StreamId  Position Location Format Type DPort Name 
    312     -------------------------------------------------- 
    313     [ 0]:[ 0] 0x01     0x01     0x06   0x02 0x00  MicIn1 left 
    314     [ 0]:[ 1] 0x04     0x02     0x06   0x02 0x00  MicIn1 right 
    315     [ 0]:[ 2] 0x02     0x01     0x06   0x03 0x00  LineIn 3+4 left 
    316     [ 0]:[ 3] 0x05     0x02     0x06   0x03 0x00  LineIn 3+4 right 
    317     [ 0]:[ 4] 0x00     0x01     0x06   0x04 0x00  SpdifIn left 
    318     [ 0]:[ 5] 0x03     0x02     0x06   0x04 0x00  SpdifIn right 
    319     [ 0]:[ 6] 0x06     0x01     0x0d   0x0a 0x00  MidiPort_1 
     59NOTE: In order to build jackd with freebob support, you have  
     60to install libfreebob before you build jackd. 
    32061 
    32162 
     
    32364------------- 
    32465 
    325 In order to get it running you need to provide some arguments to  
    326 jackd, e.g. 
    327  
    328 $ jackd -d iec61883 -n 1 -d 0 -p 512 -b 1000 -b 1000 -i 20 -r 8192 
    329  
    330 Note that '-n' most be addapted to your local 1394 bus configuraiton. 
    331 This is the node number of the device. 
    332  
    333 On my screen I get: 
    334  
    335 wagi@cruxam:~/src/jack-audio-connection-kit+freebob-0.100.0$ jackd -d iec61883 -n 1 -d 0 -p 512 -b 1000 -b 1000 -i 20 -r 8192 
    336 jackd 0.100.0 
     66The easiest way to run this is using qjackctl. There are only minor  
     67differences with the other backends, however you should change some 
     68of the default values: 
     69- The 'interface' field should contain only a number. This number is 
     70  the port number of the IEEE1394 host controller the audio device 
     71  is connected to. For most people this will be '0', but if you have 
     72  multiple controllers, you have to change this number. 
     73- The 'Input channels' and 'Output channels' fields indicate if the 
     74  backend should provide capture and/or playback channels. If you set 
     75  these to 0, no channels are created. In order to enable capture and/or 
     76  playback, you have to set them to a nonzero value. 
     77- It is recommended to change the 'periods/buffer' field to 3, especially 
     78  if you use low period sizes (=< 128) 
     79- It is recommended to raise the RT priority to 70. 
     80 
     81In order to get it running from the command line, you need to provide some  
     82arguments to jackd. 
     83 
     84Run  
     85 
     86$ jackd -d freebob --help 
     87 
     88to see the backend options. You can easily figure out how to set them using 
     89the remarks given above (for qjackctl). 
     90 
     91For the other aspects of jackd usage, consult the jackd documentation. 
     92 
     93Here is a sample session (without realtime support enabled): 
     94 
     95[wagi@halo ~]$ jackd -d freebob 
     96jackd 0.102.9 
    33797Copyright 2001-2005 Paul Davis and others. 
    33898jackd comes with ABSOLUTELY NO WARRANTY 
     
    342102JACK compiled with System V SHM support. 
    343103loading driver .. 
    344 IEC61883: Using libfreebob version libfreebob 0.0.1 
    345 Debug (avdevice.cpp)[47] AvDevice: Found AvDevice (NodeID 1) 
    346 Debug (avdevice.cpp)[1262] enumerateSubUnits: subunit_id =  0, subunit_type =  1 (Audio), max_subunit_ID = 0 
    347 Debug (avdevice.cpp)[1262] enumerateSubUnits: subunit_id =  0, subunit_type = 12 (Music), max_subunit_ID = 0 
    348 Debug (avdevice.cpp)[169] discoverStep1: number of iso input plugs = 2, number of iso output plugs = 2 
    349 Debug (avdevice.cpp)[214] discoverStep2: number of output plugs is 1 for iso input plug 0 
    350 Debug (avdevice.cpp)[251] discoverStep2: output plug 0 is owned by subunit_type 12, subunit_id = 0 
    351 Debug (avdevice.cpp)[1203] discoverPlugConnection: IsoStreamInput plug 0 has a valid connection to plug 0 of MusicSubunit subunit 0 
    352 Debug (avdevice.cpp)[214] discoverStep2: number of output plugs is 0 for iso input plug 1 
    353 Debug (avdevice.cpp)[339] discoverStep3: output plug 0 is owned by subunit_type 12, subunit_id 0 
    354 Debug (avdevice.cpp)[1203] discoverPlugConnection: IsoStreamOutput plug 0 has a valid connection to plug 0 of MusicSubunit subunit 0 
    355 Debug (avdevice.cpp)[339] discoverStep3: output plug 5 is owned by subunit_type 12, subunit_id 0 
    356 Debug (avdevice.cpp)[1203] discoverPlugConnection: IsoStreamOutput plug 1 has a valid connection to plug 5 of MusicSubunit subunit 0 
    357 Debug (avdevice.cpp)[416] discoverStep4: iso input plug 0 is of type 0 (IsoStream) 
    358 Debug (avdevice.cpp)[383] discoverStep4: iso input plug 1 has no valid connecton -> skip 
    359 Debug (avdevice.cpp)[465] discoverStep4: iso output plug 0 is of type 0 (IsoStream) 
    360 Debug (avdevice.cpp)[465] discoverStep4: iso output plug 1 is of type 3 (Sync) 
    361 Debug (avdevice.cpp)[524] discoverStep5: iso input plug 0 has 7 channels 
    362 Debug (avdevice.cpp)[491] discoverStep5: iso input plug 1 has no valid connecton -> skip 
    363 Debug (avdevice.cpp)[573] discoverStep5: iso output plug 0 has 7 channels 
    364 Debug (avdevice.cpp)[573] discoverStep5: iso output plug 1 has 2 channels 
    365 Debug (avdevice.cpp)[636] discoverStep6: iso input plug 0: channel position information retrieved 
    366 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 2 
    367 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 2 
    368 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    369 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 5 
    370 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 2 
    371 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 2 
    372 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 3 
    373 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    374 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 6 
    375 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 2 
    376 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 2 
    377 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 1 
    378 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    379 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 4 
    380 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 2 
    381 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 1 
    382 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 7 
    383 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    384 Debug (avdevice.cpp)[598] discoverStep6: iso input plug 1 has no valid connecton -> skip 
    385 Debug (avdevice.cpp)[690] discoverStep6: iso output plug 0: channel position information retrieved 
    386 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 2 
    387 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 2 
    388 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    389 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 5 
    390 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 2 
    391 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 2 
    392 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 3 
    393 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    394 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 6 
    395 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 2 
    396 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 2 
    397 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 1 
    398 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    399 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 4 
    400 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 2 
    401 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 1 
    402 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 7 
    403 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    404 Debug (avdevice.cpp)[690] discoverStep6: iso output plug 1: channel position information retrieved 
    405 Debug (avplug.cpp)[105] debugOutputClusterInfos: number of channels: 2 
    406 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 1 
    407 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 1 
    408 Debug (avplug.cpp)[115] debugOutputClusterInfos: stream position: 2 
    409 Debug (avplug.cpp)[118] debugOutputClusterInfos: location: 2 
    410 Debug (avdevice.cpp)[767] discoverStep7: iso input plug 0 stream position 2: channel name = LineOut 1+2 left 
    411 Debug (avdevice.cpp)[767] discoverStep7: iso input plug 0 stream position 5: channel name = LineOut 1+2 right 
    412 Debug (avdevice.cpp)[767] discoverStep7: iso input plug 0 stream position 3: channel name = LineOut 3+4 left 
    413 Debug (avdevice.cpp)[767] discoverStep7: iso input plug 0 stream position 6: channel name = LineOut 3+4 right 
    414 Debug (avdevice.cpp)[767] discoverStep7: iso input plug 0 stream position 1: channel name = SpdifOut left 
    415 Debug (avdevice.cpp)[767] discoverStep7: iso input plug 0 stream position 4: channel name = SpdifOut right 
    416 Debug (avdevice.cpp)[767] discoverStep7: iso input plug 0 stream position 7: channel name = MidiPort_1 
    417 Debug (avdevice.cpp)[716] discoverStep7: iso input plug 1 has no valid connecton -> skip 
    418 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 0 stream position 2: channel name = MicIn1 left 
    419 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 0 stream position 5: channel name = MicIn1 right 
    420 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 0 stream position 3: channel name = LineIn 3+4 left 
    421 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 0 stream position 6: channel name = LineIn 3+4 right 
    422 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 0 stream position 1: channel name = SpdifIn left 
    423 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 0 stream position 4: channel name = SpdifIn right 
    424 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 0 stream position 7: channel name = MidiPort_1 
    425 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 1 stream position 1: channel name = SynchChannel1 
    426 Debug (avdevice.cpp)[838] discoverStep7: iso output plug 1 stream position 2: channel name = SynchChannel2 
    427 Debug (avdevice.cpp)[910] discoverStep8: iso input plug 0: cluster index = 1, portType Line, cluster name = LineOut 1+2 
    428 Debug (avdevice.cpp)[910] discoverStep8: iso input plug 0: cluster index = 2, portType Line, cluster name = LineOut 3+4 
    429 Debug (avdevice.cpp)[910] discoverStep8: iso input plug 0: cluster index = 3, portType SPDIF, cluster name = SpdifOut 
    430 Debug (avdevice.cpp)[910] discoverStep8: iso input plug 0: cluster index = 4, portType MIDI, cluster name = MidiSection.0 
    431 Debug (avdevice.cpp)[866] discoverStep8: iso input plug 1 has no valid connecton -> skip 
    432 Debug (avdevice.cpp)[980] discoverStep8: iso output plug 0: cluster index = 1, portType Microphone, cluster name = MicIn1 
    433 Debug (avdevice.cpp)[980] discoverStep8: iso output plug 0: cluster index = 2, portType Line, cluster name = LineIn 3+4 
    434 Debug (avdevice.cpp)[980] discoverStep8: iso output plug 0: cluster index = 3, portType SPDIF, cluster name = SpdifIn 
    435 Debug (avdevice.cpp)[980] discoverStep8: iso output plug 0: cluster index = 4, portType MIDI, cluster name = MidiSection.0 
    436 Warning (avdevice.cpp)[936] discoverStep8: Skipping plugs with id > 0. Further investigation needed 
    437 Debug (avdevice.cpp)[1040] discoverStep9: discoverStep9: iso input plug 0 uses sampling frequency 4 
    438 Debug (avdevice.cpp)[1070] discoverStep9: iso input plug 0 cluster info 1: stream format 6 
    439 Debug (avdevice.cpp)[1070] discoverStep9: iso input plug 0 cluster info 2: stream format 6 
    440 Debug (avdevice.cpp)[1070] discoverStep9: iso input plug 0 cluster info 3: stream format 6 
    441 Debug (avdevice.cpp)[1070] discoverStep9: iso input plug 0 cluster info 4: stream format 13 
    442 Debug (avdevice.cpp)[1008] discoverStep9: iso input plug 1 has no valid connecton -> skip 
    443 Debug (avdevice.cpp)[1134] discoverStep9: discoverStep9: iso output plug 0 uses sampling frequency 4 
    444 Debug (avdevice.cpp)[1164] discoverStep9: iso output plug 0 cluster info 1: stream format 6 
    445 Debug (avdevice.cpp)[1164] discoverStep9: iso output plug 0 cluster info 2: stream format 6 
    446 Debug (avdevice.cpp)[1164] discoverStep9: iso output plug 0 cluster info 3: stream format 6 
    447 Debug (avdevice.cpp)[1164] discoverStep9: iso output plug 0 cluster info 4: stream format 13 
    448 Debug (avdevice.cpp)[1177] discoverStep9: iso output plug 1 is sync stream with sampling frequency 4 
    449 IEC61883: Adding 1 capture connection(s)... 
    450 IEC61883:   capture connection 0: 0 streams, dim 1 from (0,7,7) 
    451 IEC61883:     adding stream 0: (1,1) 0x06 0x03 -> 0 (LineOut 1+2 left) 
    452 IEC61883:     adding stream 1: (4,2) 0x06 0x03 -> 0 (LineOut 1+2 right) 
    453 IEC61883:     adding stream 2: (2,1) 0x06 0x03 -> 0 (LineOut 3+4 left) 
    454 IEC61883:     adding stream 3: (5,2) 0x06 0x03 -> 0 (LineOut 3+4 right) 
    455 IEC61883:     adding stream 4: (0,1) 0x06 0x04 -> 0 (SpdifOut left) 
    456 IEC61883:     adding stream 5: (3,2) 0x06 0x04 -> 0 (SpdifOut right) 
    457 IEC61883:     adding stream 6: (6,1) 0x0D 0x0A -> 0 (MidiPort_1) 
    458 IEC61883: Adding 1 playback connection(s)... 
    459 IEC61883:   playback connection 0: 0 streams, dim 1 to (0,7,7) 
    460 IEC61883:     adding stream 0: (1,1) 0x06 0x02 -> 0 (MicIn1 left) 
    461 IEC61883:     adding stream 1: (4,2) 0x06 0x02 -> 0 (MicIn1 right) 
    462 IEC61883:     adding stream 2: (2,1) 0x06 0x03 -> 0 (LineIn 3+4 left) 
    463 IEC61883:     adding stream 3: (5,2) 0x06 0x03 -> 0 (LineIn 3+4 right) 
    464 IEC61883:     adding stream 4: (0,1) 0x06 0x04 -> 0 (SpdifIn left) 
    465 IEC61883:     adding stream 5: (3,2) 0x06 0x04 -> 0 (SpdifIn right) 
    466 IEC61883:     adding stream 6: (6,1) 0x0D 0x0A -> 0 (MidiPort_1) 
    467 IEC61883D: Creating driver (period_size=512, ringbuffer_size=8192) 
    468 Creating IEC61883 client... 512/8192/48000 
    469  poll timeout = 10 ms 
    470 Creating 7 buffers of 8192 quadlets... 
    471 IEC61883C: Creating playback connection from node 65473, plug 0 
    472              prebuffers=0, buffers=1000, irq_interval=20 
    473 Creating 7 buffers of 8192 quadlets... 
    474 IEC61883 Client created... 
    475 IEC61883CM: registered jack port cap_0_1_0_LineOut 1+2 left 
    476 IEC61883CM: registered jack port cap_0_1_0_LineOut 1+2 right 
    477 IEC61883CM: registered jack port cap_0_1_0_LineOut 3+4 left 
    478 IEC61883CM: registered jack port cap_0_1_0_LineOut 3+4 right 
    479 IEC61883CM: registered jack port cap_0_1_0_SpdifOut left 
    480 IEC61883CM: registered jack port cap_0_1_0_SpdifOut right 
    481 IEC61883CM: registered midi port MidiIn_0_1_0_MidiPort_1_1 as 128:0 
    482 IEC61883CM: registered jack port pbk_0_1_0_MicIn1 left 
    483 IEC61883CM: registered jack port pbk_0_1_0_MicIn1 right 
    484 IEC61883CM: registered jack port pbk_0_1_0_LineIn 3+4 left 
    485 IEC61883CM: registered jack port pbk_0_1_0_LineIn 3+4 right 
    486 IEC61883CM: registered jack port pbk_0_1_0_SpdifIn left 
    487 IEC61883CM: registered jack port pbk_0_1_0_SpdifIn right 
    488 IEC61883CM: registered midi port MidiOut_0_1_0_MidiPort_1_1 as 128:1 
    489 Client start... 
    490  creating capture connections... 
     104Freebob using Firewire port 0, node -1 
    491105libiec61883 warning: Established connection on channel 0. 
    492106You may need to manually set the channel on the receiving node. 
    493 Init ISO master receive handler on channel 0... 
    494    (BUFFER=1000,PACKET_MAX=2048,IRQ=20)... 
    495 Start ISO master receive... 
    496  creating playback connections... 
    497107libiec61883 warning: Established connection on channel 1. 
    498108You may need to manually set the channel on the transmitting node. 
    499 Init ISO slave transmit handler on channel 1... 
    500    other mode (BUFFER=1000,PACKET_MAX=2048,IRQ=20)... 
    501 Start ISO slave transmit... PREBUFFER=0 
    502   ->     2618k Packets, Bufferfill (I:  512, O:    0), Packets dropped (I:    0, O:   11), XRUNS (   0)(1, 8/0) 
    503  
     109 
     110In case of problems 
     111------------------- 
     112 
     113Under the tests directory there is a test program. You should first 
     114try to run this. 
     115 
     116If you don't have installed libfreebob then you can adapt your 
     117LD_LIBRARY_PATH environment variable to 
     118 
     119$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../src/.libs 
     120 
     121Then you can try running the program without having to install it. 
     122 
     123With the release version you see something like this: 
     124 
     125wagi@cruxam:~/src/libfreebob/tests$ ./test-freebob discover 
     126verbose level = 0 
     127Using freebob library version: libfreebob 0.9.0 
     128 
     129  port = 2, devices_on_bus = 1 
     130  get info for device = 0, node = 1 
     131Direction:              0 (capture) 
     132 
     133Connection Info 
     134=============== 
     135 
     136Number of connections:  1 
     137 
     138  Connection  0 
     139  ------------- 
     140    [ 0] Id:         0 
     141    [ 0] Port:       2 
     142    [ 0] Node:       1 
     143    [ 0] Plug:       0 
     144    [ 0] Dimension:  7 
     145    [ 0] Samplerate: 44100 
     146    [ 0] IsoChannel: -1 
     147    [ 0] IsMaster:   0 
     148    [ 0] Number of stream infos: 8 
     149 
     150    StreamId  Position Location Format Type DPort Name 
     151    -------------------------------------------------- 
     152    [ 0]:[ 0] 0x01     0x01     0x06   0x02 0x00  MicIn 1+2 left 
     153    [ 0]:[ 1] 0x04     0x02     0x06   0x02 0x00  MicIn 1+2 right 
     154    [ 0]:[ 2] 0x02     0x01     0x06   0x03 0x00  LineIn 1+2 left 
     155    [ 0]:[ 3] 0x05     0x02     0x06   0x03 0x00  LineIn 1+2 right 
     156    [ 0]:[ 4] 0x00     0x01     0x06   0x04 0x00  SpdifIn 1 left 
     157    [ 0]:[ 5] 0x03     0x02     0x06   0x04 0x00  SpdifIn 1 right 
     158    [ 0]:[ 6] 0x06     0x01     0x0d   0x0a 0x00  MidiIn2 
     159    [ 0]:[ 7] 0x06     0x02     0x0d   0x0a 0x00  MidiIn2 
     160 
     161 
     162Direction:              1 (playback) 
     163 
     164Connection Info 
     165=============== 
     166 
     167Number of connections:  1 
     168 
     169  Connection  0 
     170  ------------- 
     171    [ 0] Id:         0 
     172    [ 0] Port:       2 
     173    [ 0] Node:       1 
     174    [ 0] Plug:       0 
     175    [ 0] Dimension:  11 
     176    [ 0] Samplerate: 44100 
     177    [ 0] IsoChannel: -1 
     178    [ 0] IsMaster:   0 
     179    [ 0] Number of stream infos: 12 
     180 
     181    StreamId  Position Location Format Type DPort Name 
     182    -------------------------------------------------- 
     183    [ 0]:[ 0] 0x01     0x01     0x06   0x03 0x00  MultiChannel 7.1 Front left 
     184    [ 0]:[ 1] 0x06     0x02     0x06   0x03 0x00  MultiChannel 7.1 Front right 
     185    [ 0]:[ 2] 0x02     0x03     0x06   0x03 0x00  MultiChannel 7.1 Center 
     186    [ 0]:[ 3] 0x07     0x04     0x06   0x03 0x00  MultiChannel 7.1 Subwoofer 
     187    [ 0]:[ 4] 0x03     0x05     0x06   0x03 0x00  MultiChannel 7.1 Rear left 
     188    [ 0]:[ 5] 0x08     0x06     0x06   0x03 0x00  MultiChannel 7.1 Rear right 
     189    [ 0]:[ 6] 0x04     0x07     0x06   0x03 0x00  MultiChannel 7.1 Surround left 
     190    [ 0]:[ 7] 0x09     0x08     0x06   0x03 0x00  MultiChannel 7.1 Surround right 
     191    [ 0]:[ 8] 0x00     0x01     0x06   0x04 0x00  SpdifOut 1 left 
     192    [ 0]:[ 9] 0x05     0x02     0x06   0x04 0x00  SpdifOut 1 right 
     193    [ 0]:[10] 0x0a     0x01     0x0d   0x0a 0x00  MidiOut2 
     194    [ 0]:[11] 0x0a     0x02     0x0d   0x0a 0x00  MidiOut2 
     195 
     196 
     197If you don't get this, check if you have multiple host controllers, and  
     198use the -p parameter to specify them. If you get any error messages, the  
     199best way to help us figure out what the problem might be is to build the  
     200debug version (./configure --enable-debug). You can then rerun the test 
     201application and send us its output. 
     202 
  • branches/libfreebob-2.0/src/bebob/bebob_avdevice.cpp

    r187 r336  
    22 * Copyright (C) 2005,06 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    3434 
    3535#include <iostream> 
     36#include <sstream> 
    3637 
    3738namespace BeBoB { 
     
    3940IMPL_DEBUG_MODULE( AvDevice, AvDevice, DEBUG_LEVEL_NORMAL ); 
    4041 
    41 AvDevice::AvDevice( Ieee1394Service& ieee1394service, 
     42AvDevice::AvDevice( std::auto_ptr< ConfigRom >( configRom ), 
     43                    Ieee1394Service& ieee1394service, 
    4244                    int nodeId, 
    4345                    int verboseLevel ) 
    44     :  m_1394Service( &ieee1394service ) 
     46    : m_configRom( configRom ) 
     47    , m_1394Service( &ieee1394service ) 
    4548    , m_nodeId( nodeId ) 
    4649    , m_verboseLevel( verboseLevel ) 
    4750    , m_plugManager( verboseLevel ) 
    48 
    49     if ( m_verboseLevel ) { 
    50         setDebugLevel( DEBUG_LEVEL_VERBOSE ); 
    51     } 
     51    , m_activeSyncInfo( 0 ) 
     52    , m_id(0) 
     53    , m_receiveProcessor ( 0 ) 
     54    , m_receiveProcessorBandwidth ( -1 ) 
     55    , m_transmitProcessor ( 0 ) 
     56    , m_transmitProcessorBandwidth ( -1 ) 
     57
     58    setDebugLevel( verboseLevel ); 
    5259    debugOutput( DEBUG_LEVEL_VERBOSE, "Created BeBoB::AvDevice (NodeID %d)\n", 
    5360                 nodeId ); 
    54  
    55     m_configRom = new ConfigRom( m_1394Service, m_nodeId ); 
    56     m_configRom->initialize(); 
    5761} 
    5862 
    5963AvDevice::~AvDevice() 
    6064{ 
    61     delete m_configRom; 
    6265    for ( AvDeviceSubunitVector::iterator it = m_subunits.begin(); 
    6366          it != m_subunits.end(); 
     
    9093{ 
    9194    return *m_configRom; 
     95} 
     96 
     97struct VendorModelEntry { 
     98    unsigned int vendor_id; 
     99    unsigned int model_id; 
     100}; 
     101 
     102static VendorModelEntry supportedDeviceList[] = 
     103{ 
     104    {0x00000f, 0x00010065},  // Mackie, Onyx Firewire 
     105 
     106    {0x0003db, 0x00010048},  // Apogee Electronics, Rosetta 200 
     107 
     108    {0x0007f5, 0x00010048},  // BridgeCo, RD Audio1 
     109 
     110    {0x000a92, 0x00010066},  // Presonous FirePOD 
     111 
     112    {0x000aac, 0x00000004},  // TerraTec Electronic GmbH, Phase X24 FW (model version 4) 
     113    {0x000aac, 0x00000007},  // TerraTec Electronic GmbH, Phase X24 FW (model version 7) 
     114 
     115    {0x000f1b, 0x00010064},  // ESI, Quatafire 610 
     116 
     117    {0x0040ab, 0x00010048},  // EDIROL, FA-101 
     118    {0x0040ab, 0x00010049},  // EDIROL, FA-66 
     119 
     120    {0x00130e, 0x00000003},  // Focusrite, Pro26IO (Saffire 26) 
     121}; 
     122 
     123bool 
     124AvDevice::probe( ConfigRom& configRom ) 
     125{ 
     126    unsigned int vendorId = configRom.getNodeVendorId(); 
     127    unsigned int modelId = configRom.getModelId(); 
     128 
     129    for ( unsigned int i = 0; 
     130          i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) ); 
     131          ++i ) 
     132    { 
     133        if ( ( supportedDeviceList[i].vendor_id == vendorId ) 
     134             && ( supportedDeviceList[i].model_id == modelId ) ) 
     135        { 
     136            return true; 
     137        } 
     138    } 
     139 
     140    return false; 
    92141} 
    93142 
     
    385434    // Check all possible PCR input to MSU input connections 
    386435    // -> sync stream input 
    387     checkSyncConnections( syncPCRInputPlugs, syncMSUInputPlugs ); 
     436    checkSyncConnectionsAndAddToList( syncPCRInputPlugs, 
     437                                      syncMSUInputPlugs, 
     438                                      "Sync Stream Input" ); 
    388439 
    389440    // Check all possible MSU output to PCR output connections 
    390441    // -> sync stream output 
    391     checkSyncConnections( syncMSUOutputPlugs,  syncPCROutputPlugs ); 
     442    checkSyncConnectionsAndAddToList( syncMSUOutputPlugs, 
     443                                      syncPCROutputPlugs, 
     444                                      "Sync Stream Output" ); 
    392445 
    393446    // Check all PCR iso input to MSU input connections 
    394447    // -> SYT match 
    395     checkSyncConnections( isoPCRInputPlugs, syncMSUInputPlugs ); 
     448    checkSyncConnectionsAndAddToList( isoPCRInputPlugs, 
     449                                      syncMSUInputPlugs, 
     450                                      "Syt Match" ); 
    396451 
    397452    // Check all MSU sync output to MSU input connections 
    398453    // -> CSP 
    399     checkSyncConnections( syncMSUOutputPlugs, syncMSUInputPlugs ); 
     454    checkSyncConnectionsAndAddToList( syncMSUOutputPlugs, 
     455                                      syncMSUInputPlugs, 
     456                                      "Internal (CSP)" ); 
    400457 
    401458    // Check all external PCR digital input to MSU input connections 
    402459    // -> SPDIF/ADAT sync 
    403     checkSyncConnections( digitalPCRInputPlugs, syncMSUInputPlugs ); 
    404  
    405  
    406     // Currently active connection signal sourqce cmd, command type 
     460    checkSyncConnectionsAndAddToList( digitalPCRInputPlugs, 
     461                                      syncMSUInputPlugs, 
     462                                      "Digital Input Sync" ); 
     463 
     464    // Currently active connection signal source cmd, command type 
    407465    // status, source unknown, destination MSU sync input plug 
    408466 
     
    418476        { 
    419477            AvPlug* plug = *jt; 
    420             plug = plug; // disable compiler warning in release mode 
    421                          // will be optimized away 
     478 
     479            for ( SyncInfoVector::iterator it = m_syncInfos.begin(); 
     480                  it != m_syncInfos.end(); 
     481                  ++it ) 
     482            { 
     483                SyncInfo* pSyncInfo = &*it; 
     484                if ( ( pSyncInfo->m_source == plug ) 
     485                     && ( pSyncInfo->m_destination == msuPlug ) ) 
     486                { 
     487                    m_activeSyncInfo = pSyncInfo; 
     488                    break; 
     489                } 
     490            } 
    422491            debugOutput( DEBUG_LEVEL_NORMAL, 
    423492                         "Active Sync Connection: '%s' -> '%s'\n", 
    424                          msuPlug->getName(), 
    425                          plug->getName() ); 
     493                         plug->getName(), 
     494                         msuPlug->getName() ); 
    426495        } 
    427496    } 
     
    433502AvDevice::enumerateSubUnits() 
    434503{ 
     504    bool musicSubunitFound=false; 
     505    bool audioSubunitFound=false; 
     506 
    435507    SubUnitInfoCmd subUnitInfoCmd( m_1394Service ); 
    436508    //subUnitInfoCmd.setVerbose( 1 ); 
    437509    subUnitInfoCmd.setCommandType( AVCCommand::eCT_Status ); 
    438510 
    439     // BeBob has always exactly one audio and one music subunit. This 
     511    // BeBoB has always exactly one audio and one music subunit. This 
    440512    // means is fits into the first page of the SubUnitInfo command. 
    441513    // So there is no need to do more than needed 
     
    446518    if ( !subUnitInfoCmd.fire() ) { 
    447519        debugError( "Subunit info command failed\n" ); 
     520        // shouldn't this be an error situation? 
     521        return false; 
    448522    } 
    449523 
     
    469543                return false; 
    470544            } 
     545             
     546            m_subunits.push_back( subunit ); 
     547            audioSubunitFound=true; 
     548             
    471549            break; 
    472550        case AVCCommand::eST_Music: 
     
    477555                return false; 
    478556            } 
     557             
     558            m_subunits.push_back( subunit ); 
     559            musicSubunitFound=true; 
     560             
    479561            break; 
    480562        default: 
     
    496578            return false; 
    497579        } 
    498         m_subunits.push_back( subunit ); 
    499     } 
    500  
    501     return true; 
     580 
     581    } 
     582 
     583    // a BeBoB always has an audio and a music subunit 
     584    return (musicSubunitFound && audioSubunitFound); 
    502585} 
    503586 
     
    643726    return true; 
    644727} 
     728 
     729int 
     730AvDevice::getSamplingFrequency( ) { 
     731    AvPlug* inputPlug = getPlugById( m_pcrPlugs, AvPlug::eAPD_Input, 0 ); 
     732    if ( !inputPlug ) { 
     733        debugError( "setSampleRate: Could not retrieve iso input plug 0\n" ); 
     734        return false; 
     735    } 
     736    AvPlug* outputPlug = getPlugById( m_pcrPlugs, AvPlug::eAPD_Output, 0 ); 
     737    if ( !outputPlug ) { 
     738        debugError( "setSampleRate: Could not retrieve iso output plug 0\n" ); 
     739        return false; 
     740    } 
     741 
     742    int samplerate_playback=inputPlug->getSampleRate(); 
     743    int samplerate_capture=outputPlug->getSampleRate(); 
     744 
     745    if (samplerate_playback != samplerate_capture) { 
     746        debugWarning("Samplerates for capture and playback differ!\n"); 
     747    } 
     748    return samplerate_capture; 
     749} 
     750 
    645751 
    646752bool 
     
    699805                foundFreq = 
    700806                    static_cast<ESamplingFrequency>( 
    701                         compoundStream->m_samplingFrequency ); 
     807                        syncStream->m_samplingFrequency ); 
    702808            } 
    703809 
     
    768874 
    769875bool 
    770 AvDevice::checkSyncConnections( AvPlugVector& plhs, AvPlugVector& prhs ) 
     876AvDevice::checkSyncConnectionsAndAddToList( AvPlugVector& plhs, 
     877                                            AvPlugVector& prhs, 
     878                                            std::string syncDescription ) 
    771879{ 
    772880    for ( AvPlugVector::iterator plIt = plhs.begin(); 
     
    781889            AvPlug* pr = *prIt; 
    782890            if ( pl->inquireConnnection( *pr ) ) { 
     891                m_syncInfos.push_back( SyncInfo( *pl, *pr, syncDescription ) ); 
    783892                debugOutput( DEBUG_LEVEL_NORMAL, 
    784893                             "Sync connection '%s' -> '%s'\n", 
     
    791900} 
    792901 
    793 
     902bool AvDevice::setActiveSync(const SyncInfo& syncInfo) 
     903
     904    return syncInfo.m_source->setConnection( *syncInfo.m_destination ); 
     905
     906 
     907bool AvDevice::setId( unsigned int id) 
     908
     909    // FIXME: decent ID system nescessary 
     910    m_id=id; 
     911        return true; 
     912
     913 
     914bool 
     915AvDevice::prepare() { 
     916    /////////// 
     917    // get plugs 
     918 
     919    AvPlug* inputPlug = getPlugById( m_pcrPlugs, AvPlug::eAPD_Input, 0 ); 
     920    if ( !inputPlug ) { 
     921        debugError( "setSampleRate: Could not retrieve iso input plug 0\n" ); 
     922        return false; 
     923    } 
     924    AvPlug* outputPlug = getPlugById( m_pcrPlugs, AvPlug::eAPD_Output, 0 ); 
     925    if ( !outputPlug ) { 
     926        debugError( "setSampleRate: Could not retrieve iso output plug 0\n" ); 
     927        return false; 
     928    } 
     929 
     930    int samplerate=outputPlug->getSampleRate(); 
     931    m_receiveProcessor=new FreebobStreaming::AmdtpReceiveStreamProcessor( 
     932                             m_1394Service->getPort(), 
     933                             samplerate, 
     934                             outputPlug->getNrOfChannels()); 
     935 
     936    if(!m_receiveProcessor->init()) { 
     937        debugFatal("Could not initialize receive processor!\n"); 
     938        return false; 
     939    } 
     940 
     941    if (!addPlugToProcessor(*outputPlug,m_receiveProcessor,  
     942        FreebobStreaming::AmdtpAudioPort::E_Capture)) { 
     943        debugFatal("Could not add plug to processor!\n"); 
     944        return false; 
     945    } 
     946 
     947    // do the transmit processor 
     948//     if (m_snoopMode) { 
     949//         // we are snooping, so these are receive too. 
     950//         samplerate=inputPlug->getSampleRate(); 
     951//         m_receiveProcessor2=new FreebobStreaming::AmdtpReceiveStreamProcessor( 
     952//                                   channel, 
     953//                                   m_1394Service->getPort(), 
     954//                                   samplerate, 
     955//                                   inputPlug->getNrOfChannels()); 
     956//          
     957//         if(!m_receiveProcessor2->init()) { 
     958//             debugFatal("Could not initialize snooping receive processor!\n"); 
     959//             return false; 
     960//         } 
     961//         if (!addPlugToProcessor(*inputPlug,m_receiveProcessor2,  
     962//             FreebobStreaming::AmdtpAudioPort::E_Capture)) { 
     963//             debugFatal("Could not add plug to processor!\n"); 
     964//             return false; 
     965//         } 
     966//     } else { 
     967        // do the transmit processor 
     968        samplerate=inputPlug->getSampleRate(); 
     969        m_transmitProcessor=new FreebobStreaming::AmdtpTransmitStreamProcessor( 
     970                                m_1394Service->getPort(), 
     971                                samplerate, 
     972                                inputPlug->getNrOfChannels()); 
     973                                 
     974        if(!m_transmitProcessor->init()) { 
     975            debugFatal("Could not initialize transmit processor!\n"); 
     976            return false; 
     977         
     978        } 
     979         
     980        // FIXME: do this the proper way! 
     981        m_transmitProcessor->syncmaster=m_receiveProcessor; 
     982     
     983        if (!addPlugToProcessor(*inputPlug,m_transmitProcessor,  
     984            FreebobStreaming::AmdtpAudioPort::E_Playback)) { 
     985            debugFatal("Could not add plug to processor!\n"); 
     986            return false; 
     987        } 
     988//     } 
     989 
     990    return true; 
     991
     992 
     993bool 
     994AvDevice::addPlugToProcessor( 
     995    AvPlug& plug,  
     996    FreebobStreaming::StreamProcessor *processor,  
     997    FreebobStreaming::AmdtpAudioPort::E_Direction direction) { 
     998 
     999    AvPlug::ClusterInfoVector& clusterInfos = plug.getClusterInfos(); 
     1000    for ( AvPlug::ClusterInfoVector::const_iterator it = clusterInfos.begin(); 
     1001          it != clusterInfos.end(); 
     1002          ++it ) 
     1003    { 
     1004        const AvPlug::ClusterInfo* clusterInfo = &( *it ); 
     1005 
     1006        AvPlug::ChannelInfoVector channelInfos = clusterInfo->m_channelInfos; 
     1007        for ( AvPlug::ChannelInfoVector::const_iterator it = channelInfos.begin(); 
     1008              it != channelInfos.end(); 
     1009              ++it ) 
     1010        { 
     1011            const AvPlug::ChannelInfo* channelInfo = &( *it ); 
     1012            std::ostringstream portname; 
     1013             
     1014            portname << "dev" << m_id << "_" << channelInfo->m_name; 
     1015             
     1016            FreebobStreaming::Port *p=NULL; 
     1017            switch(clusterInfo->m_portType) { 
     1018            case ExtendedPlugInfoClusterInfoSpecificData::ePT_Speaker: 
     1019            case ExtendedPlugInfoClusterInfoSpecificData::ePT_Headphone: 
     1020            case ExtendedPlugInfoClusterInfoSpecificData::ePT_Microphone: 
     1021            case ExtendedPlugInfoClusterInfoSpecificData::ePT_Line: 
     1022            case ExtendedPlugInfoClusterInfoSpecificData::ePT_Analog: 
     1023                p=new FreebobStreaming::AmdtpAudioPort( 
     1024                        portname.str(), 
     1025                        direction,  
     1026                        // \todo: streaming backend expects indexing starting from 0 
     1027                        // but bebob reports it starting from 1. Decide where 
     1028                        // and how to handle this (pp: here) 
     1029                        channelInfo->m_streamPosition - 1,  
     1030                        channelInfo->m_location,  
     1031                        FreebobStreaming::AmdtpPortInfo::E_MBLA,  
     1032                        clusterInfo->m_portType 
     1033                ); 
     1034                break; 
     1035 
     1036            case ExtendedPlugInfoClusterInfoSpecificData::ePT_MIDI: 
     1037                p=new FreebobStreaming::AmdtpMidiPort( 
     1038                        portname.str(), 
     1039                        direction,  
     1040                        // \todo: streaming backend expects indexing starting from 0 
     1041                        // but bebob reports it starting from 1. Decide where 
     1042                        // and how to handle this (pp: here) 
     1043                        channelInfo->m_streamPosition - 1,  
     1044                        channelInfo->m_location,  
     1045                        FreebobStreaming::AmdtpPortInfo::E_Midi,  
     1046                        clusterInfo->m_portType 
     1047                ); 
     1048 
     1049                break; 
     1050            case ExtendedPlugInfoClusterInfoSpecificData::ePT_SPDIF: 
     1051            case ExtendedPlugInfoClusterInfoSpecificData::ePT_ADAT: 
     1052            case ExtendedPlugInfoClusterInfoSpecificData::ePT_TDIF: 
     1053            case ExtendedPlugInfoClusterInfoSpecificData::ePT_MADI: 
     1054            case ExtendedPlugInfoClusterInfoSpecificData::ePT_Digital: 
     1055            case ExtendedPlugInfoClusterInfoSpecificData::ePT_NoType: 
     1056            default: 
     1057            // unsupported 
     1058                break; 
     1059            } 
     1060 
     1061            if (!p) { 
     1062                debugOutput(DEBUG_LEVEL_VERBOSE, "Skipped port %s\n",channelInfo->m_name.c_str()); 
     1063            } else { 
     1064         
     1065                if (!processor->addPort(p)) { 
     1066                    debugWarning("Could not register port with stream processor\n"); 
     1067                    return false; 
     1068                } 
     1069            } 
     1070         } 
     1071    } 
     1072    return true; 
     1073
     1074 
     1075int  
     1076AvDevice::getStreamCount() { 
     1077    return 2; // one receive, one transmit 
     1078
     1079 
     1080FreebobStreaming::StreamProcessor * 
     1081AvDevice::getStreamProcessorByIndex(int i) { 
     1082    switch (i) { 
     1083    case 0: 
     1084        return m_receiveProcessor; 
     1085    case 1: 
     1086//         if (m_snoopMode) { 
     1087//             return m_receiveProcessor2; 
     1088//         } else { 
     1089            return m_transmitProcessor; 
     1090//         } 
     1091    default: 
     1092        return NULL; 
     1093    } 
     1094    return 0; 
     1095
     1096 
     1097int 
     1098AvDevice::startStreamByIndex(int i) { 
     1099    int iso_channel=0; 
     1100    int plug=0; 
     1101    int hostplug=-1; 
     1102     
     1103//     if (m_snoopMode) { 
     1104//      
     1105//         switch (i) { 
     1106//         case 0: 
     1107//             // snooping doesn't use CMP, but obtains the info of the channel 
     1108//             // from the target plug 
     1109//              
     1110//             // TODO: get isochannel from plug 
     1111//              
     1112//             // set the channel obtained by the connection management 
     1113//             m_receiveProcessor->setChannel(iso_channel); 
     1114//             break; 
     1115//         case 1: 
     1116//             // snooping doesn't use CMP, but obtains the info of the channel 
     1117//             // from the target plug 
     1118//              
     1119//             // TODO: get isochannel from plug 
     1120//              
     1121//             // set the channel obtained by the connection management 
     1122//             m_receiveProcessor2->setChannel(iso_channel); 
     1123//  
     1124//             break; 
     1125//         default: 
     1126//             return 0; 
     1127//         } 
     1128//     } else { 
     1129     
     1130        switch (i) { 
     1131        case 0: 
     1132            // do connection management: make connection 
     1133            iso_channel = iec61883_cmp_connect( 
     1134                m_1394Service->getHandle(),  
     1135                m_nodeId | 0xffc0,  
     1136                &plug, 
     1137                raw1394_get_local_id (m_1394Service->getHandle()),  
     1138                &hostplug,  
     1139                &m_receiveProcessorBandwidth); 
     1140             
     1141            // set the channel obtained by the connection management 
     1142            m_receiveProcessor->setChannel(iso_channel); 
     1143            break; 
     1144        case 1: 
     1145            // do connection management: make connection 
     1146            iso_channel = iec61883_cmp_connect( 
     1147                m_1394Service->getHandle(),  
     1148                raw1394_get_local_id (m_1394Service->getHandle()),  
     1149                &hostplug,  
     1150                m_nodeId | 0xffc0,  
     1151                &plug, 
     1152                &m_transmitProcessorBandwidth); 
     1153             
     1154            // set the channel obtained by the connection management 
     1155            m_transmitProcessor->setChannel(iso_channel); 
     1156            break; 
     1157        default: 
     1158            return 0; 
     1159        } 
     1160//     } 
     1161     
     1162    return 0; 
     1163 
     1164
     1165 
     1166int 
     1167AvDevice::stopStreamByIndex(int i) { 
     1168    // do connection management: break connection 
     1169 
     1170    int plug=0; 
     1171    int hostplug=-1; 
     1172//     if (m_snoopMode) { 
     1173//         switch (i) { 
     1174//         case 0: 
     1175//             // do connection management: break connection 
     1176//      
     1177//             break; 
     1178//         case 1: 
     1179//             // do connection management: break connection 
     1180//  
     1181//             break; 
     1182//         default: 
     1183//             return 0; 
     1184//         } 
     1185//     } else { 
     1186        switch (i) { 
     1187        case 0: 
     1188            // do connection management: break connection 
     1189            iec61883_cmp_disconnect( 
     1190                m_1394Service->getHandle(),  
     1191                m_nodeId | 0xffc0,  
     1192                plug, 
     1193                raw1394_get_local_id (m_1394Service->getHandle()),  
     1194                hostplug,  
     1195                m_receiveProcessor->getChannel(), 
     1196                m_receiveProcessorBandwidth); 
     1197     
     1198            break; 
     1199        case 1: 
     1200            // do connection management: break connection 
     1201            iec61883_cmp_disconnect( 
     1202                m_1394Service->getHandle(),  
     1203                raw1394_get_local_id (m_1394Service->getHandle()),  
     1204                hostplug,  
     1205                m_nodeId | 0xffc0,  
     1206                plug, 
     1207                m_transmitProcessor->getChannel(), 
     1208                m_transmitProcessorBandwidth); 
     1209 
     1210            break; 
     1211        default: 
     1212            return 0; 
     1213        } 
     1214//     } 
     1215     
     1216    return 0; 
     1217
     1218 
     1219 
     1220} // end of namespace 
  • branches/libfreebob-2.0/src/bebob/bebob_avdevice.h

    r187 r336  
    22 * Copyright (C) 2005,06 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    3232#include "bebob/bebob_avdevice_subunit.h" 
    3333 
     34#include "libstreaming/AmdtpStreamProcessor.h" 
     35#include "libstreaming/AmdtpPort.h" 
     36#include "libstreaming/AmdtpPortInfo.h" 
     37 
    3438#include "iavdevice.h" 
    3539 
     
    4246class AvDevice : public IAvDevice { 
    4347public: 
    44     AvDevice( Ieee1394Service& ieee1394Service, 
     48    AvDevice( std::auto_ptr<ConfigRom>( configRom ), 
     49          Ieee1394Service& ieee1394Service, 
    4550              int nodeId, 
    46              int verboseLevel ); 
     51          int verboseLevel ); 
    4752    virtual ~AvDevice(); 
    4853 
     54    static bool probe( ConfigRom& configRom ); 
    4955    virtual bool discover(); 
    5056    virtual ConfigRom& getConfigRom() const; 
     57 
     58    virtual bool setSamplingFrequency( ESamplingFrequency samplingFrequency ); 
     59    virtual int getSamplingFrequency( ); 
     60 
     61    virtual int getStreamCount(); 
     62    virtual FreebobStreaming::StreamProcessor *getStreamProcessorByIndex(int i); 
     63 
     64    virtual bool prepare(); 
     65 
     66    virtual int startStreamByIndex(int i); 
     67    virtual int stopStreamByIndex(int i); 
     68 
    5169    virtual bool addXmlDescription( xmlNodePtr deviceNode ); 
    52     virtual bool setSamplingFrequency( ESamplingFrequency samplingFrequency ); 
    5370    virtual void showDevice() const; 
     71    virtual bool setId(unsigned int id); 
    5472 
    5573    Ieee1394Service* get1394Service() 
    56        { return m_1394Service; } 
     74    { return m_1394Service; } 
    5775 
    5876    AvPlugManager& getPlugManager() 
    59         { return m_plugManager; } 
     77    { return m_plugManager; } 
     78 
     79    struct SyncInfo { 
     80        SyncInfo( AvPlug& source, 
     81                  AvPlug& destination, 
     82                  std::string description ) 
     83            : m_source( &source ) 
     84            , m_destination( &destination ) 
     85            , m_description( description ) 
     86            {} 
     87    AvPlug*     m_source; 
     88    AvPlug*     m_destination; 
     89        std::string m_description; 
     90    }; 
     91 
     92    typedef std::vector<SyncInfo> SyncInfoVector; 
     93    const SyncInfoVector& getSyncInfos() const 
     94        { return m_syncInfos; } 
     95    const SyncInfo* getActiveSyncInfo() const 
     96        { return m_activeSyncInfo; } 
     97    bool setActiveSync( const SyncInfo& syncInfo ); 
    6098 
    6199protected: 
     
    83121                         int id ); 
    84122    AvPlugVector getPlugsByType( AvPlugVector& plugs, 
    85                                  AvPlug::EAvPlugDirection plugDirection, 
    86                                  AvPlug::EAvPlugType type); 
     123                 AvPlug::EAvPlugDirection plugDirection, 
     124                 AvPlug::EAvPlugType type); 
     125 
     126    bool addPlugToProcessor( AvPlug& plug, FreebobStreaming::StreamProcessor *processor,  
     127                             FreebobStreaming::AmdtpAudioPort::E_Direction direction); 
    87128 
    88129    bool setSamplingFrequencyPlug( AvPlug& plug, 
     
    92133    void showAvPlugs( AvPlugVector& plugs ) const; 
    93134 
    94     bool checkSyncConnections( AvPlugVector& plhs, AvPlugVector& prhs ); 
     135    bool checkSyncConnectionsAndAddToList( AvPlugVector& plhs, 
     136                                           AvPlugVector& prhs, 
     137                                           std::string syncDescription ); 
    95138protected: 
     139    std::auto_ptr<ConfigRom>( m_configRom ); 
    96140    Ieee1394Service* m_1394Service; 
    97     ConfigRom*       m_configRom; 
    98141    int              m_nodeId; 
    99142    int              m_verboseLevel; 
     
    108151    AvPlugManager    m_plugManager; 
    109152 
     153    SyncInfoVector   m_syncInfos; 
     154    SyncInfo*        m_activeSyncInfo; 
     155 
     156    unsigned int m_id; 
     157 
     158    // streaming stuff 
     159    FreebobStreaming::AmdtpReceiveStreamProcessor *m_receiveProcessor; 
     160    int m_receiveProcessorBandwidth; 
     161 
     162    FreebobStreaming::AmdtpTransmitStreamProcessor *m_transmitProcessor; 
     163    int m_transmitProcessorBandwidth; 
     164 
    110165    DECLARE_DEBUG_MODULE; 
    111166}; 
  • branches/libfreebob-2.0/src/bebob/bebob_avdevice_subunit.cpp

    r187 r336  
    22 * Copyright (C) 2005,06 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/bebob/bebob_avdevice_subunit.h

    r187 r336  
    22 * Copyright (C) 2005,06 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/bebob/bebob_avdevice_xml.cpp

    r187 r336  
    22 * Copyright (C) 2006 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/bebob/bebob_avplug.cpp

    r187 r336  
    22 * Copyright (C) 2005,06 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    9595    if ( m_verboseLevel ) { 
    9696        setDebugLevel( DEBUG_LEVEL_VERBOSE ); 
    97    
     97   
    9898} 
    9999 
     
    174174    SignalSourceCmd signalSourceCmd = setSrcPlugAddrToSignalCmd(); 
    175175    setDestPlugAddrToSignalCmd( signalSourceCmd, plug ); 
     176    signalSourceCmd.setCommandType( AVCCommand::eCT_SpecificInquiry ); 
    176177    signalSourceCmd.setVerbose( m_verboseLevel ); 
    177178 
     
    190191    debugOutput( DEBUG_LEVEL_VERBOSE, 
    191192                 "Connection not possible between '%s' and '%s'\n", 
     193                 getName(),  plug.getName() ); 
     194    return false; 
     195} 
     196 
     197bool 
     198AvPlug::setConnection( AvPlug& plug ) 
     199{ 
     200    SignalSourceCmd signalSourceCmd = setSrcPlugAddrToSignalCmd(); 
     201    setDestPlugAddrToSignalCmd( signalSourceCmd, plug ); 
     202    signalSourceCmd.setCommandType( AVCCommand::eCT_Control ); 
     203    signalSourceCmd.setVerbose( m_verboseLevel ); 
     204 
     205    if ( !signalSourceCmd.fire() ) { 
     206        debugError( "Could not set connection between '%s' and '%s'\n", 
     207                    getName(), plug.getName() ); 
     208        return false; 
     209    } 
     210 
     211    if ( signalSourceCmd.getResponse() == AVCCommand::eR_Accepted ) { 
     212        debugOutput( DEBUG_LEVEL_VERBOSE, 
     213                     "Could set connection between '%s' and '%s'\n", 
     214                     getName(), plug.getName() ); 
     215        return true; 
     216    } 
     217    debugOutput( DEBUG_LEVEL_VERBOSE, 
     218                 "Could not set connection between '%s' and '%s'\n", 
    192219                 getName(),  plug.getName() ); 
    193220    return false; 
     
    10771104 
    10781105    signalSourceCmd.setNodeId( m_nodeId ); 
    1079     signalSourceCmd.setCommandType( AVCCommand::eCT_SpecificInquiry ); 
    10801106    signalSourceCmd.setSubunitType( AVCCommand::eST_Unit  ); 
    10811107    signalSourceCmd.setSubunitId( 0xff ); 
  • branches/libfreebob-2.0/src/bebob/bebob_avplug.h

    r187 r336  
    22 * Copyright (C) 2005,06 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    8888 
    8989    bool inquireConnnection( AvPlug& plug ); 
     90    bool setConnection( AvPlug& plug ); 
    9091 
    9192    int getGlobalId() const 
     
    131132 
    132133    void showPlug() const; 
     134     
     135     
     136    struct ChannelInfo { 
     137        stream_position_t          m_streamPosition; 
     138        stream_position_location_t m_location; 
     139        std::string                m_name; 
     140    }; 
     141    typedef std::vector<ChannelInfo> ChannelInfoVector; 
     142 
     143    struct ClusterInfo { 
     144        int                      m_index; 
     145        port_type_t              m_portType; 
     146        std::string              m_name; 
     147 
     148        nr_of_channels_t         m_nrOfChannels; 
     149        ChannelInfoVector        m_channelInfos; 
     150        stream_format_t          m_streamFormat; 
     151    }; 
     152    typedef std::vector<ClusterInfo> ClusterInfoVector; 
     153    ClusterInfoVector& getClusterInfos() 
     154    { return m_clusterInfos; } 
    133155 
    134156protected: 
     
    194216 
    195217    // Channel & Cluster Info 
    196     struct ChannelInfo { 
    197         stream_position_t          m_streamPosition; 
    198         stream_position_location_t m_location; 
    199         std::string                m_name; 
    200     }; 
    201     typedef std::vector<ChannelInfo> ChannelInfoVector; 
    202  
    203     struct ClusterInfo { 
    204         int                      m_index; 
    205         port_type_t              m_portType; 
    206         std::string              m_name; 
    207  
    208         nr_of_channels_t         m_nrOfChannels; 
    209         ChannelInfoVector        m_channelInfos; 
    210         stream_format_t          m_streamFormat; 
    211     }; 
    212     typedef std::vector<ClusterInfo> ClusterInfoVector; 
    213218 
    214219    ClusterInfoVector        m_clusterInfos; 
  • branches/libfreebob-2.0/src/bebob/bebob_avplug_xml.cpp

    r187 r336  
    22 * Copyright (C) 2006 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    5353    { 
    5454        debugError( "Couldn't create 'Direction' node\n" ); 
    55         return false; 
    56     } 
     55        free( result ); 
     56        return false; 
     57    } 
     58    free( result ); 
    5759 
    5860    xmlNodePtr connection = xmlNewChild( connectionSet, 0, 
     
    7981                       BAD_CAST "Port",  BAD_CAST result ) ) { 
    8082        debugError( "Couldn't create 'Port' node\n" ); 
    81         return false; 
    82     } 
     83        free( result ); 
     84        return false; 
     85    } 
     86    free( result ); 
    8387 
    8488    asprintf( &result, "%d",  m_nodeId); 
     
    8690                       BAD_CAST "Node",  BAD_CAST result ) ) { 
    8791        debugError( "Couldn't create 'Node' node\n" ); 
    88         return false; 
    89     } 
     92        free( result ); 
     93        return false; 
     94    } 
     95    free( result ); 
     96 
    9097 
    9198    asprintf( &result, "%d",  m_nrOfChannels ); 
     
    93100                       BAD_CAST "Dimension",  BAD_CAST result ) ) { 
    94101        debugError( "Couldn't create 'Dimension' node\n" ); 
    95         return false; 
    96     } 
     102        free( result ); 
     103        return false; 
     104    } 
     105    free( result ); 
    97106 
    98107    asprintf( &result, "%d",  getSampleRate() ); 
     
    100109                       BAD_CAST "Samplerate",  BAD_CAST result ) ) { 
    101110        debugError( "Couldn't create 'Samplerate' node\n" ); 
    102         return false; 
    103     } 
     111        free( result ); 
     112        return false; 
     113    } 
     114    free( result ); 
    104115 
    105116    if ( !xmlNewChild( connection,  0, 
     
    146157            { 
    147158                debugError( "Couldn't create 'Position' node" ); 
    148                 return false; 
    149             } 
     159                free( result ); 
     160                return false; 
     161            } 
     162            free( result ); 
    150163 
    151164            asprintf( &result, "%d", channelInfo->m_location ); 
     
    154167            { 
    155168                debugError( "Couldn't create 'Location' node" ); 
    156                 return false; 
    157             } 
     169                free( result ); 
     170                return false; 
     171            } 
     172            free( result ); 
    158173 
    159174            asprintf( &result, "%d", clusterInfo->m_streamFormat ); 
     
    162177            { 
    163178                debugError( "Couldn't create 'Format' node" ); 
    164                 return false; 
    165             } 
     179                free( result ); 
     180                return false; 
     181            } 
     182            free( result ); 
    166183 
    167184            asprintf( &result, "%d", clusterInfo->m_portType ); 
     
    170187            { 
    171188                debugError( "Couldn't create 'Type' node" ); 
    172                 return false; 
    173             } 
     189                free( result ); 
     190                return false; 
     191            } 
     192            free( result ); 
     193 
    174194 
    175195            // \todo XXX: What do to do with DestinationPort value?? 
     
    179199            { 
    180200                debugError( "Couldn't create 'DestinationPort' node" ); 
    181                 return false; 
    182             } 
     201                free( result ); 
     202                return false; 
     203            } 
     204            free( result ); 
    183205 
    184206            if ( !xmlNewChild( stream,  0, 
     
    221243    { 
    222244        debugError( "addXmlDescriptionStreamFormats: Could not  create 'Direction' node\n" ); 
    223         return false; 
    224     } 
     245        free( result ); 
     246        return false; 
     247    } 
     248    free( result ); 
     249 
    225250 
    226251    for ( FormatInfoVector::iterator it = 
     
    243268        { 
    244269            debugError( "Couldn't create 'Samplerate' node\n" ); 
    245             return false; 
    246         } 
     270            free( result ); 
     271            return false; 
     272        } 
     273        free( result ); 
    247274 
    248275        asprintf( &result, "%d",  formatInfo.m_audioChannels ); 
     
    251278        { 
    252279            debugError( "Couldn't create 'AudioChannels' node\n" ); 
    253             return false; 
    254         } 
     280            free( result ); 
     281            return false; 
     282        } 
     283        free( result ); 
    255284 
    256285        asprintf( &result, "%d",  formatInfo.m_midiChannels ); 
     
    259288        { 
    260289            debugError( "Couldn't create 'MidiChannels' node\n" ); 
     290            free( result ); 
    261291            return false; 
    262292        } 
  • branches/libfreebob-2.0/src/bebob/bebob_functionblock.cpp

    r187 r336  
    22 * Copyright (C) 2006 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/bebob/bebob_functionblock.h

    r187 r336  
    22 * Copyright (C) 2006 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/bounce/bounce_avdevice.cpp

    r242 r336  
    33 * Copyright (C) 2006 by Daniel Wagner 
    44 * 
    5  * This file is part of FreeBob
     5 * This file is part of FreeBoB
    66 * 
    7  * FreeBob is free software; you can redistribute it and/or modify 
     7 * FreeBoB is free software; you can redistribute it and/or modify 
    88 * it under the terms of the GNU General Public License as published by 
    99 * the Free Software Foundation; either version 2 of the License, or 
    1010 * (at your option) any later version. 
    11  * FreeBob is distributed in the hope that it will be useful, 
     11 * FreeBoB is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1313 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    17  * along with FreeBob; if not, write to the Free Software 
     17 * along with FreeBoB; if not, write to the Free Software 
    1818 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1919 * MA 02111-1307 USA. 
     
    4444IMPL_DEBUG_MODULE( BounceDevice, BounceDevice, DEBUG_LEVEL_VERBOSE ); 
    4545 
    46 BounceDevice::BounceDevice( Ieee1394Service& ieee1394service, 
     46 
     47BounceDevice::BounceDevice( std::auto_ptr< ConfigRom >( configRom ), 
     48                            Ieee1394Service& ieee1394service, 
    4749                            int nodeId, 
    4850                            int verboseLevel ) 
    49     : m_1394Service( &ieee1394service ) 
     51    : m_configRom( configRom ) 
     52    , m_1394Service( &ieee1394service ) 
    5053    , m_nodeId( nodeId ) 
    5154    , m_verboseLevel( verboseLevel ) 
     
    5760    , m_transmitProcessorBandwidth ( -1 ) 
    5861{ 
    59     setDebugLevel( m_verboseLevel ); 
     62    setDebugLevel( verboseLevel ); 
    6063     
    6164    debugOutput( DEBUG_LEVEL_VERBOSE, "Created Bounce::BounceDevice (NodeID %d)\n", 
    6265                 nodeId ); 
    63     m_configRom = new ConfigRom( m_1394Service, m_nodeId ); 
    64     m_configRom->initialize(); 
    6566} 
    6667 
    6768BounceDevice::~BounceDevice() 
    6869{ 
    69         delete m_configRom; 
     70 
    7071} 
    7172 
     
    7475{ 
    7576    return *m_configRom; 
     77} 
     78 
     79struct VendorModelEntry { 
     80    unsigned int vendor_id; 
     81    unsigned int model_id; 
     82}; 
     83 
     84static VendorModelEntry supportedDeviceList[] = 
     85{ 
     86//     {0x0000, 0x000000},   
     87}; 
     88 
     89bool 
     90BounceDevice::probe( ConfigRom& configRom ) 
     91{ 
     92    unsigned int vendorId = configRom.getNodeVendorId(); 
     93    unsigned int modelId = configRom.getModelId(); 
     94 
     95    for ( unsigned int i = 0; 
     96          i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) ); 
     97          ++i ) 
     98    { 
     99        if ( ( supportedDeviceList[i].vendor_id == vendorId ) 
     100             && ( supportedDeviceList[i].model_id == modelId )  
     101           ) 
     102        { 
     103            return true; 
     104        } 
     105    } 
     106 
     107    return false; 
    76108} 
    77109 
  • branches/libfreebob-2.0/src/bounce/bounce_avdevice.h

    r242 r336  
    33 * Copyright (C) 2006 by Daniel Wagner 
    44 * 
    5  * This file is part of FreeBob
     5 * This file is part of FreeBoB
    66 * 
    7  * FreeBob is free software; you can redistribute it and/or modify 
     7 * FreeBoB is free software; you can redistribute it and/or modify 
    88 * it under the terms of the GNU General Public License as published by 
    99 * the Free Software Foundation; either version 2 of the License, or 
    1010 * (at your option) any later version. 
    11  * FreeBob is distributed in the hope that it will be useful, 
     11 * FreeBoB is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1313 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    17  * along with FreeBob; if not, write to the Free Software 
     17 * along with FreeBoB; if not, write to the Free Software 
    1818 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1919 * MA 02111-1307 USA. 
     
    2727#include "libfreebobavc/avc_extended_cmd_generic.h" 
    2828#include "libfreebob/xmlparser.h" 
    29  
    30 #include "bebob_light/bebob_light_avplug.h" 
    31 #include "bebob_light/bebob_light_avdevicesubunit.h" 
    3229 
    3330#include "libstreaming/AmdtpStreamProcessor.h" 
     
    4542class BounceDevice : public IAvDevice { 
    4643public: 
    47     BounceDevice( Ieee1394Service& ieee1394Service, 
     44    BounceDevice( std::auto_ptr<ConfigRom>( configRom ), 
     45                  Ieee1394Service& ieee1394Service, 
    4846                  int nodeId, 
    4947                  int verboseLevel ); 
    5048    virtual ~BounceDevice(); 
    5149 
     50    static bool probe( ConfigRom& configRom ); 
    5251    virtual bool discover(); 
    5352    virtual ConfigRom& getConfigRom() const; 
     
    5857        virtual int getSamplingFrequency( ); 
    5958     
    60     virtual bool setId(unsigned int id); 
    61          
    6259        virtual bool prepare(); 
    6360         
     
    7168     
    7269    virtual void showDevice() const; 
     70    virtual bool setId(unsigned int id); 
    7371 
    7472protected: 
     73    std::auto_ptr<ConfigRom>( m_configRom ); 
    7574    Ieee1394Service* m_1394Service; 
    76     ConfigRom*       m_configRom; 
    7775    int              m_nodeId; 
    7876    int              m_verboseLevel; 
  • branches/libfreebob-2.0/src/configrom.cpp

    r262 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    2626 
    2727#include <iostream> 
     28#include <iomanip> 
    2829 
    2930using namespace std; 
     
    5455//------------------------------------------------------------- 
    5556 
    56 ConfigRom::ConfigRom( Ieee1394Service* ieee1394service, fb_nodeid_t nodeId ) 
    57     : m_1394Service( ieee1394service ) 
     57ConfigRom::ConfigRom( Ieee1394Service& ieee1394service, fb_nodeid_t nodeId ) 
     58    : m_1394Service( &ieee1394service ) 
    5859    , m_nodeId( nodeId ) 
    5960    , m_avcDevice( false ) 
     
    6162    , m_vendorName( "" ) 
    6263    , m_modelName( "" ) 
     64    , m_vendorId( 0 ) 
     65    , m_modelId( 0 ) 
    6366    , m_unit_specifier_id( 0 ) 
    6467    , m_unit_version( 0 ) 
     68    , m_isIsoResourceManager( false ) 
     69    , m_isCycleMasterCapable( false ) 
     70    , m_isSupportIsoOperations( false ) 
     71    , m_isBusManagerCapable( false ) 
     72    , m_cycleClkAcc( 0 ) 
     73    , m_maxRec( 0 ) 
     74    , m_nodeVendorId( 0 ) 
     75    , m_chipIdHi( 0 ) 
     76    , m_chipIdLow( 0 ) 
    6577    , m_vendorNameKv( 0 ) 
    6678    , m_modelNameKv( 0 ) 
     
    8496                                 &csr_info ); 
    8597    if (!m_csr || csr1212_parse_csr( m_csr ) != CSR1212_SUCCESS) { 
    86         debugError( "Could not parse config rom" ); 
     98        debugError( "Could not parse config rom of node %d on port %d", m_nodeId, m_1394Service->getPort() ); 
    8799        if (m_csr) { 
    88100            csr1212_destroy_csr(m_csr); 
     
    92104    } 
    93105 
     106    // Process Bus_Info_Block 
     107    m_isIsoResourceManager = CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 31; 
     108    m_isCycleMasterCapable = ( CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 30 ) & 0x1; 
     109    m_isSupportIsoOperations = ( CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 29 ) & 0x1; 
     110    m_isBusManagerCapable = ( CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 28 ) & 0x1; 
     111    m_cycleClkAcc = ( CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 16 ) & 0xff; 
     112    m_maxRec = ( CSR1212_BE32_TO_CPU( m_csr->bus_info_data[2] ) >> 12 ) & 0xf; 
     113    m_nodeVendorId = ( CSR1212_BE32_TO_CPU( m_csr->bus_info_data[3] ) >> 8 ); 
     114    m_chipIdHi = ( CSR1212_BE32_TO_CPU( m_csr->bus_info_data[3] ) ) & 0xff; 
     115    m_chipIdLow = CSR1212_BE32_TO_CPU( m_csr->bus_info_data[4] ); 
     116 
     117    // Process Root Directory 
    94118    processRootDirectory(m_csr); 
    95119 
     
    151175} 
    152176 
    153 const bool 
    154 ConfigRom::isAvcDevice() const 
    155 { 
    156     return m_avcDevice; 
    157 } 
    158  
    159 // XXX This might work only for the M-Audio Audiophile 
    160 // but can easily extended. 
    161 #define VENDOR_ID_MAUDIO    0x00000d6c 
    162 #define MODEL_ID_MAUDIO_BOOTLOADER 0x00010060 
    163  
    164 const bool 
    165 ConfigRom::isBootloader() const 
    166 { 
    167     if ( ( m_vendorId == VENDOR_ID_MAUDIO ) 
    168          && ( m_modelId == MODEL_ID_MAUDIO_BOOTLOADER ) ) 
    169     { 
    170         return true; 
    171     } 
    172     return false; 
    173 } 
    174  
    175177static int 
    176178busRead( struct csr1212_csr* csr, 
     
    182184    struct config_csr_info* csr_info = (struct config_csr_info*) private_data; 
    183185 
    184     if ( csr_info->service->read( csr_info->nodeId, 
    185                                   addr, 
    186                                   length
    187                                   ( quadlet_t* )buffer) ) 
     186    if ( !csr_info->service->read( csr_info->nodeId, 
     187                                  addr, 
     188                                  length/4
     189                                  ( quadlet_t* )buffer) ) 
    188190    { 
    189 //         debugOutput( DEBUG_LEVEL_VERBOSE, "ConfigRom: Read failed\n"); 
     191        //debugOutput( DEBUG_LEVEL_VERBOSE, "ConfigRom: Read failed\n"); 
    190192        return -1; 
    191193    } 
     
    380382    return m_unit_version; 
    381383} 
     384 
     385bool 
     386ConfigRom::updatedNodeId() 
     387{ 
     388    struct csr1212_csr* csr = 0; 
     389    for ( fb_nodeid_t nodeId = 0; 
     390          nodeId < m_1394Service->getNodeCount(); 
     391          ++nodeId ) 
     392    { 
     393        struct config_csr_info csr_info; 
     394        csr_info.service = m_1394Service; 
     395        csr_info.nodeId = 0xffc0 | nodeId; 
     396 
     397        csr = csr1212_create_csr( &configrom_csr1212_ops, 
     398                                  5 * sizeof(fb_quadlet_t),   // XXX Why 5 ?!? 
     399                                  &csr_info ); 
     400 
     401        if (!csr || csr1212_parse_csr( csr ) != CSR1212_SUCCESS) { 
     402            if (csr) { 
     403                csr1212_destroy_csr(csr); 
     404            } 
     405            continue; 
     406        } 
     407 
     408 
     409        octlet_t guid = 
     410            ((u_int64_t)CSR1212_BE32_TO_CPU(csr->bus_info_data[3]) << 32) 
     411            | CSR1212_BE32_TO_CPU(csr->bus_info_data[4]); 
     412 
     413        if ( guid == getGuid() ) { 
     414            if ( nodeId != getNodeId() ) { 
     415                debugOutput( DEBUG_LEVEL_VERBOSE, 
     416                             "Device with GUID 0x%08x%08x changed node id " 
     417                             "from %d to %d\n", 
     418                             ( unsigned int ) ( getGuid() >> 32 ), 
     419                             ( unsigned int ) ( getGuid() & 0xffffffff ), 
     420                             getNodeId(), 
     421                             nodeId ); 
     422                m_nodeId = nodeId; 
     423            } 
     424            if (csr) { 
     425                csr1212_destroy_csr(csr); 
     426            } 
     427            return true; 
     428        } 
     429    } 
     430 
     431    if (csr) { 
     432        csr1212_destroy_csr(csr); 
     433    } 
     434 
     435    debugOutput( DEBUG_LEVEL_NORMAL, 
     436                 "Device with GUID 0x%08x%08x could not be found on " 
     437                 "the bus anymore (removed?)\n", 
     438                 m_guid >> 32, 
     439                 m_guid & 0xffffffff ); 
     440    return false; 
     441} 
     442 
     443void 
     444ConfigRom::printConfigRom() const 
     445{ 
     446    using namespace std; 
     447    printf( "Config ROM\n" ); 
     448    printf( "\tCurrent Node Id:\t%d\n",       getNodeId() ); 
     449    printf( "\tGUID:\t\t\t0x%08x%08x\n", 
     450            ( unsigned int )( getGuid() >> 32 ), 
     451            ( unsigned int ) ( getGuid() & 0xffffffff ) ); 
     452    printf( "\tVendor Name:\t\t%s\n",         getVendorName().c_str() ); 
     453    printf( "\tModel Name:\t\t%s\n",          getModelName().c_str() ); 
     454    printf( "\tNode Vendor ID:\t\t0x%06x\n",  getNodeVendorId() ); 
     455    printf( "\tModel Id:\t\t0x%08x\n",        getModelId() ); 
     456    printf( "\tISO resource manager:\t%d\n",  isIsoResourseManager() ); 
     457    printf( "\tCycle master capable:\t%d\n",  isSupportsIsoOperations() ); 
     458    printf( "\tBus manager capable:\t%d\n",   isBusManagerCapable() ); 
     459    printf( "\tCycle clock accurancy:\t%d\n", getCycleClockAccurancy() ); 
     460    printf( "\tMax rec:\t\t%d (max asy payload: %d bytes)\n", 
     461            getMaxRec(), getAsyMaxPayload() ); 
     462} 
     463 
     464unsigned short 
     465ConfigRom::getAsyMaxPayload() const 
     466{ 
     467    // XXX use pow instead? 
     468    return 1 << ( m_maxRec + 1 ); 
     469} 
  • branches/libfreebob-2.0/src/configrom.h

    r262 r336  
    22 * Copyright (C) 2005,06 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    3333class ConfigRom { 
    3434 public: 
    35     ConfigRom( Ieee1394Service* ieee1394service, fb_nodeid_t nodeId ); 
     35    ConfigRom( Ieee1394Service& ieee1394service, fb_nodeid_t nodeId ); 
    3636    virtual ~ConfigRom(); 
    3737 
    3838    bool initialize(); 
    3939 
    40     const bool isAvcDevice() const; 
    41     const bool isBootloader() const; 
    4240    const fb_nodeid_t getNodeId() const; 
    4341    const fb_octlet_t getGuid() const; 
    4442    const std::string getModelName() const; 
    4543    const std::string getVendorName() const; 
     44     
    4645    const unsigned int getModelId() const; 
    4746    const unsigned int getVendorId() const; 
    4847    const unsigned int getUnitSpecifierId() const; 
    4948    const unsigned int getUnitVersion() const; 
    50          
     49 
     50    bool isIsoResourseManager() const 
     51        { return m_isIsoResourceManager; } 
     52    bool isCycleMasterCapable() const 
     53        { return m_isCycleMasterCapable; } 
     54    bool isSupportsIsoOperations() const 
     55        { return m_isSupportIsoOperations; } 
     56    bool isBusManagerCapable() const 
     57        { return m_isBusManagerCapable; } 
     58    fb_byte_t getCycleClockAccurancy() const 
     59        { return m_cycleClkAcc; } 
     60    fb_byte_t getMaxRec() const 
     61        { return m_maxRec; } 
     62    unsigned short getAsyMaxPayload() const; 
     63 
     64    fb_quadlet_t getNodeVendorId() const 
     65        { return m_nodeVendorId; } 
     66 
     67    bool updatedNodeId(); 
     68 
     69    void printConfigRom() const; 
     70 
    5171 protected: 
    5272    void processUnitDirectory( struct csr1212_csr*    csr, 
     
    6686    unsigned int     m_unit_specifier_id; 
    6787    unsigned int     m_unit_version; 
     88    bool             m_isIsoResourceManager; 
     89    bool             m_isCycleMasterCapable; 
     90    bool             m_isSupportIsoOperations; 
     91    bool             m_isBusManagerCapable; 
     92    fb_byte_t        m_cycleClkAcc; 
     93    fb_byte_t        m_maxRec; 
     94    fb_quadlet_t     m_nodeVendorId; 
     95    fb_byte_t        m_chipIdHi; 
     96    fb_quadlet_t     m_chipIdLow; 
    6897 
    6998    /* only used during parsing */ 
  • branches/libfreebob-2.0/src/debugmodule/debugmodule.cpp

    r253 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/debugmodule/debugmodule.h

    r266 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
    5  * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     4 * This file is part of FreeBoB
     5 * 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    8282#define setDebugLevel( Level ) {                                    \ 
    8383                m_debugModule.setLevel( Level ); \ 
    84                 m_debugModule.print( Level,                        \ 
     84                                } 
     85 
     86/*                m_debugModule.print( eDL_Normal,                        \ 
    8587                                     __FILE__,                     \ 
    8688                                     __FUNCTION__,                 \ 
     
    8890                                     "Setting debug level to %d\n",  \ 
    8991                                     Level ); \ 
    90                                 } 
    91 #define getDebugLevel( Level )                                     \ 
     92                                }*/ 
     93 
     94#define getDebugLevel(  )                                     \ 
    9295                m_debugModule.getLevel( ) 
    9396 
     
    167170        eDL_Warning     = 2, 
    168171        eDL_Normal      = 3, 
    169         eDL_Verbose     = 4, 
    170         eDL_VeryVerbose = 5, 
     172        eDL_Info        = 4, 
     173        eDL_Verbose     = 5, 
     174        eDL_VeryVerbose = 6, 
    171175    } EDebugLevel; 
    172176 
     
    202206 
    203207#define DEBUG_LEVEL_NORMAL          DebugModule::eDL_Normal 
     208#define DEBUG_LEVEL_INFO            DebugModule::eDL_Info 
    204209#define DEBUG_LEVEL_VERBOSE         DebugModule::eDL_Verbose 
    205210#define DEBUG_LEVEL_VERY_VERBOSE    DebugModule::eDL_VeryVerbose 
  • branches/libfreebob-2.0/src/devicemanager.cpp

    r331 r336  
    1 /* devicemanager.cpp 
     1 /* devicemanager.cpp 
    22 * Copyright (C) 2005,06 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    2828#include "debugmodule/debugmodule.h" 
    2929#include "bebob/bebob_avdevice.h" 
    30 #include "bebob_light/bebob_light_avdevice.h" 
    3130#include "bounce/bounce_avdevice.h" 
    3231#include "motu/motu_avdevice.h" 
    3332#include "rme/rme_avdevice.h" 
     33#include "maudio/maudio_avdevice.h" 
    3434 
    3535#include <iostream> 
     
    5353    : m_1394Service( 0 ) 
    5454{ 
    55     m_probeList.push_back( probeBeBoB ); 
    56     m_probeList.push_back( probeMotu ); 
    57     m_probeList.push_back( probeRme ); 
    58     m_probeList.push_back( probeBounce ); 
     55 
    5956} 
    6057 
     
    9390DeviceManager::discover( int verboseLevel ) 
    9491{ 
    95     if ( verboseLevel ) { 
     92    switch ( verboseLevel ) { 
     93    case 3: 
     94        m_1394Service->setVerbose( true ); 
     95    case 1: 
    9696        setDebugLevel( DEBUG_LEVEL_VERBOSE ); 
    9797    } 
     98 
    9899    for ( IAvDeviceVectorIterator it = m_avDevices.begin(); 
    99100          it != m_avDevices.end(); 
     
    109110    { 
    110111        debugOutput( DEBUG_LEVEL_VERBOSE, "Probing node %d...\n", nodeId ); 
    111      
    112         ConfigRom configRom( m_1394Service, nodeId ); 
    113         if ( !configRom.initialize() ) { 
    114             // \todo If a PHY on the bus in power safe mode than 
     112         
     113        std::auto_ptr<ConfigRom> configRom = 
     114            std::auto_ptr<ConfigRom>( new ConfigRom( *m_1394Service, 
     115                                                     nodeId ) ); 
     116        if ( !configRom->initialize() ) { 
     117            // \todo If a PHY on the bus is in power safe mode then 
    115118            // the config rom is missing. So this might be just 
    116             // such a case and we can safely skip it. But it might 
     119            // such this case and we can safely skip it. But it might 
    117120            // be there is a real software problem on our side. 
    118121            // This should be handled more carefuly. 
     
    124127        } 
    125128 
    126         for ( ProbeFunctionVector::iterator it = m_probeList.begin(); 
    127               it != m_probeList.end(); 
    128               ++it ) 
    129         { 
    130             ProbeFunction func = *it; 
    131             IAvDevice* avDevice = func(*m_1394Service, configRom, nodeId, verboseLevel); 
    132             if ( avDevice ) { 
    133                 m_avDevices.push_back( avDevice ); 
    134                 if (!avDevice->setId(m_avDevices.size())) { 
    135                     debugError("Could not set Id of AvDevice\n"); 
    136                 } 
    137                 if ( verboseLevel ) { 
    138                     avDevice->showDevice(); 
    139                 } 
    140                 break; 
     129        IAvDevice* avDevice = getDriverForDevice( configRom, 
     130                                                  nodeId, 
     131                                                  verboseLevel ); 
     132        if ( avDevice ) { 
     133            debugOutput( DEBUG_LEVEL_NORMAL, 
     134                         "discover: driver found for device %d\n", 
     135                         nodeId ); 
     136 
     137            if ( !avDevice->discover() ) { 
     138                debugError( "discover: could not discover device\n" ); 
     139                delete avDevice; 
     140                continue; 
    141141            } 
    142         } 
    143  
     142 
     143            if ( !avDevice->setId( m_avDevices.size() ) ) { 
     144                debugError( "setting Id failed\n" ); 
     145            } 
     146            if ( verboseLevel ) { 
     147                avDevice->showDevice(); 
     148            } 
     149 
     150            m_avDevices.push_back( avDevice ); 
     151        } 
    144152    } 
    145153 
     
    149157 
    150158IAvDevice* 
    151 DeviceManager::probeBeBoB(Ieee1394Service& service, ConfigRom& configRom, int id, int level) 
    152 
    153     IAvDevice* avDevice; 
    154      
    155     // All BeBob devices have predictable unit specifier/version fields 
    156     if (configRom.getUnitSpecifierId() != BEBOB_AVCDEVICE_UNIT_SPECIFIER || 
    157         configRom.getUnitVersion() != BEBOB_AVCDEVICE_UNIT_VERSION) { 
    158         debugOutput( DEBUG_LEVEL_VERBOSE, "Not a BeBoB device, fails ConfigRom test...\n" ); 
    159         return NULL; 
    160     } 
    161  
    162     avDevice = new BeBoB_Light::AvDevice( service, id, level ); 
    163     if ( !avDevice ) { 
    164         return NULL; 
    165     } 
    166  
    167     if ( !avDevice->discover() ) { 
    168         delete avDevice; 
    169         debugOutput( DEBUG_LEVEL_VERBOSE, "Not a BeBoB device, fails discovery...\n" ); 
    170         return NULL; 
    171     } 
    172     debugOutput( DEBUG_LEVEL_VERBOSE, "BeBoB device discovered...\n" ); 
    173     return avDevice; 
    174 
    175  
    176 IAvDevice* 
    177 DeviceManager::probeBounce(Ieee1394Service& service, ConfigRom& configRom, int id, int level) 
    178 
    179     IAvDevice* avDevice; 
    180  
    181     // All Bounce devices have predictable unit specifier/version fields 
    182     if (configRom.getUnitSpecifierId() != BEBOB_AVCDEVICE_UNIT_SPECIFIER || 
    183         configRom.getUnitVersion() == BEBOB_AVCDEVICE_UNIT_VERSION) { 
    184         debugOutput( DEBUG_LEVEL_VERBOSE, "Not a Bounce device...\n" ); 
    185         return NULL; 
    186     } 
    187  
    188     avDevice = new Bounce::BounceDevice( service, id, level ); 
    189     if ( !avDevice ) { 
    190         return NULL; 
    191     } 
    192  
    193     if ( !avDevice->discover() ) { 
    194         debugOutput( DEBUG_LEVEL_VERBOSE, "Not a Bounce device...\n"); 
    195         delete avDevice; 
    196         return NULL; 
    197     } 
    198     debugOutput( DEBUG_LEVEL_VERBOSE, "Bounce device discovered...\n"); 
    199      
    200     return avDevice; 
    201 
    202  
    203 IAvDevice* 
    204 DeviceManager::probeMotu(Ieee1394Service& service, ConfigRom& configRom, int id, int level) 
    205 
    206     IAvDevice* avDevice; 
    207  
    208     // Do a first-pass test to see if it's likely that this device is a MOTU 
    209     if (configRom.getUnitSpecifierId() != MOTU_VENDOR_ID) { 
    210         debugOutput( DEBUG_LEVEL_VERBOSE, "Not a MOTU device...\n"); 
    211         return NULL; 
    212     }         
    213  
    214     avDevice = new Motu::MotuDevice( service, id, level ); 
    215     if ( !avDevice ) { 
    216         return NULL; 
    217     } 
    218  
    219     // MOTU's discover() needs to differentiate between different models, so 
    220     // for now keep all probing code in there since it's very intermingled.  
    221     // By this point it's fairly certain that we are dealing with a MOTU but 
    222     // in any case the code is robust in the event that the device isn't a 
    223     // MOTU, so at this stage there seems no reason to do otherwise. 
    224     if ( !avDevice->discover() ) { 
    225         debugOutput( DEBUG_LEVEL_VERBOSE, "Not a MOTU device...\n"); 
    226         delete avDevice; 
    227         return NULL; 
    228     } 
    229     debugOutput( DEBUG_LEVEL_VERBOSE, "MOTU device discovered...\n"); 
    230  
    231     return avDevice; 
    232 
    233  
    234 IAvDevice* 
    235 DeviceManager::probeRme(Ieee1394Service& service, ConfigRom& configRom, int id, int level) 
    236 
    237     IAvDevice* avDevice; 
    238  
    239     // Do a first-pass test to see if it's likely that this device is a RME 
    240     if (configRom.getUnitSpecifierId() != RME_VENDOR_ID) { 
    241         debugOutput( DEBUG_LEVEL_VERBOSE, "Not a RME device...\n"); 
    242         return NULL; 
    243     }         
    244  
    245     avDevice = new Rme::RmeDevice( service, id, level ); 
    246     if ( !avDevice ) { 
    247         return NULL; 
    248     } 
    249  
    250     // RME's discover() needs to differentiate between different models, so 
    251     // for now keep all probing code in there since that's how we had to  
    252     // do it for MOTU.  If RME turns out to be simpler we could move the 
    253     // logic into here. 
    254     if ( !avDevice->discover() ) { 
    255         debugOutput( DEBUG_LEVEL_VERBOSE, "Not a RME device...\n"); 
    256         delete avDevice; 
    257         return NULL; 
    258     } 
    259     debugOutput( DEBUG_LEVEL_VERBOSE, "RME device discovered...\n"); 
    260  
    261     return avDevice; 
     159DeviceManager::getDriverForDevice( std::auto_ptr<ConfigRom>( configRom ), 
     160                                   int id,  int level ) 
     161
     162    if ( BeBoB::AvDevice::probe( *configRom.get() ) ) { 
     163        return new BeBoB::AvDevice( configRom, *m_1394Service, id, level ); 
     164    } 
     165 
     166    if ( MAudio::AvDevice::probe( *configRom.get() ) ) { 
     167        return new MAudio::AvDevice( configRom, *m_1394Service, id, level ); 
     168    } 
     169 
     170    if ( Motu::MotuDevice::probe( *configRom.get() ) ) { 
     171        return new Motu::MotuDevice( configRom, *m_1394Service, id, level ); 
     172    } 
     173 
     174    if ( Rme::RmeDevice::probe( *configRom.get() ) ) { 
     175        return new Rme::RmeDevice( configRom, *m_1394Service, id, level ); 
     176    } 
     177 
     178    if ( Bounce::BounceDevice::probe( *configRom.get() ) ) { 
     179        return new Bounce::BounceDevice( configRom, *m_1394Service, id, level ); 
     180    } 
     181 
     182    return 0; 
    262183} 
    263184 
     
    338259    } 
    339260 
    340     xmlNodePtr rootNode = xmlNewNode( 0,  BAD_CAST "FreeBobConnectionInfo" ); 
     261    xmlNodePtr rootNode = xmlNewNode( 0,  BAD_CAST "FreeBoBConnectionInfo" ); 
    341262    if ( !rootNode ) { 
    342263        debugError( "Couldn't create root node\n" ); 
     
    369290            debugError( "Couldn't create 'NodeId' node" ); 
    370291            free(result); 
    371             return false; 
    372         } 
     292            return 0; 
     293        } 
     294        free( result ); 
    373295 
    374296        std::string res = "Connection Information for " 
     
    422344            xmlFreeDoc( doc ); 
    423345            xmlCleanupParser(); 
    424             free(result); 
    425             return false; 
    426         } 
     346             
     347            free(result); 
     348            return 0; 
     349        } 
     350        free( result ); 
     351 
    427352 
    428353        if ( !avDevice->addXmlDescription( deviceNode ) ) { 
  • branches/libfreebob-2.0/src/devicemanager.h

    r331 r336  
    1 /* template.cpp 
     1/* devicemanager.h 
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    2121#ifndef FREEBOBDEVICEMANAGER_H 
    2222#define FREEBOBDEVICEMANAGER_H 
    23  
    24 #include "configrom.h" 
    2523 
    2624#include "debugmodule/debugmodule.h" 
     
    3634typedef std::vector< IAvDevice* >::iterator IAvDeviceVectorIterator; 
    3735 
    38 typedef IAvDevice* (*ProbeFunction)(Ieee1394Service&, ConfigRom&, int, int); 
    39 typedef std::vector<ProbeFunction> ProbeFunctionVector; 
    40 typedef std::vector<ProbeFunction>::iterator ProbeFunctionVectorIterator; 
     36class ConfigRom; 
     37 
    4138 
    4239class DeviceManager{ 
     
    6158 
    6259protected: 
    63     static IAvDevice* probeBeBoB(Ieee1394Service& service, ConfigRom& configRom, int id, int level); 
    64     static IAvDevice* probeBounce(Ieee1394Service& service, ConfigRom& configRom, int id, int level); 
    65     static IAvDevice* probeMotu(Ieee1394Service& service, ConfigRom& configRom, int id, int level); 
    66     static IAvDevice* probeRme(Ieee1394Service& service, ConfigRom& configRom, int id, int level); 
     60    IAvDevice* getDriverForDevice( std::auto_ptr<ConfigRom>( configRom ), 
     61                                   int id, 
     62                                   int level ); 
    6763 
    6864protected: 
    6965    Ieee1394Service* m_1394Service; 
    7066    IAvDeviceVector  m_avDevices; 
    71     ProbeFunctionVector m_probeList; 
    7267 
    7368    DECLARE_DEBUG_MODULE; 
  • branches/libfreebob-2.0/src/fbtypes.h

    r125 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/freebob.cpp

    r248 r336  
    3939 
    4040DECLARE_GLOBAL_DEBUG_MODULE; 
    41 IMPL_GLOBAL_DEBUG_MODULE( FreeBob, DEBUG_LEVEL_VERBOSE ); 
     41IMPL_GLOBAL_DEBUG_MODULE( FreeBoB, DEBUG_LEVEL_VERBOSE ); 
    4242 
    4343#ifdef __cplusplus 
     
    6464    return PACKAGE_STRING; 
    6565} 
     66 
    6667 
    6768const int 
     
    162163    if ( avDevice ) { 
    163164        if ( avDevice->setSamplingFrequency( parseSampleRate( samplerate ) ) ) { 
    164             return freebob_handle->m_deviceManager->discover(0)? 1 : 0; 
    165         } else { 
    166             return -1; 
    167         } 
     165            return freebob_handle->m_deviceManager->discover(0)? 0 : -1; 
     166        } 
    168167    } 
    169168    return -1; 
  • branches/libfreebob-2.0/src/iavdevice.h

    r245 r336  
    22 * Copyright (C) 2006 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    188188         */ 
    189189        virtual int stopStreamByIndex(int i) = 0; 
    190          
     190 
    191191}; 
    192192 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_connect.cpp

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_connect.h

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_definitions.cpp

    r151 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_definitions.h

    r245 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    3535typedef byte_t function_block_type_t; 
    3636typedef byte_t function_block_id_t; 
     37typedef byte_t control_attribute_t; 
    3738typedef byte_t plug_direction_t; 
    3839typedef byte_t plug_address_mode_t; 
     
    6566typedef byte_t no_of_output_plugs_t; 
    6667typedef byte_t info_type_t; 
     68typedef byte_t audio_channel_number_t; 
     69typedef byte_t selector_length_t; 
     70typedef byte_t control_selector_t; 
     71typedef byte_t control_data_length_t; 
     72typedef byte_t input_fb_plug_number_t; 
     73typedef byte_t input_audio_channel_number_t; 
     74typedef byte_t output_audio_channel_number_t; 
     75typedef byte_t status_selector_t; 
    6776 
    6877typedef quadlet_t company_id_t; 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_extended_cmd_generic.cpp

    r172 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_extended_cmd_generic.h

    r172 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_extended_plug_info.cpp

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    626626    se.write( m_infoType, buf ); 
    627627 
     628    free(buf); 
     629     
    628630    switch ( m_infoType ) { 
    629631    case eIT_PlugType: 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_extended_plug_info.h

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_extended_stream_format.cpp

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_extended_stream_format.h

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_extended_subunit_info.cpp

    r183 r336  
    22 * Copyright (C) 2006 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_extended_subunit_info.h

    r183 r336  
    22 * Copyright (C) 2006 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_generic.cpp

    r242 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    2323#include "ieee1394service.h" 
    2424 
     25#include "debugmodule/debugmodule.h" 
     26 
    2527#include <netinet/in.h> 
    2628 
    27 #define DEBUG_EXTRA_VERBOSE 2 
     29#define DEBUG_EXTRA_VERBOSE 5 
     30 
     31IMPL_DEBUG_MODULE( AVCCommand, AVCCommand, DEBUG_LEVEL_NORMAL ); 
    2832 
    2933int AVCCommand::m_time = 0; 
     
    3741    , m_opcode( opcode ) 
    3842    , m_eResponse( eR_Unknown ) 
    39     , m_verboseLevel( 0 ) 
    40 
     43
     44 
    4145} 
    4246 
     
    4448AVCCommand::serialize( IOSSerialize& se ) 
    4549{ 
    46     se.write( m_ctype, "AVCCommand ctype" ); 
    4750    // XXX \todo improve IOSSerialize::write interface 
    4851    char* buf; 
     52    asprintf( &buf, "AVCCommand ctype ('%s')", 
     53              responseToString( static_cast<AVCCommand::EResponse>( m_ctype ) ) ); 
     54    se.write( m_ctype, buf ); 
     55    free( buf ); 
     56 
    4957    asprintf( &buf, "AVCCommand subunit (subunit_type = %d, subunit_id = %d)", 
    5058              getSubunitType(), getSubunitId() ); 
    5159    se.write( m_subunit, buf ); 
    52     free(buf); 
     60    free( buf ); 
     61 
    5362    se.write( m_opcode, "AVCCommand opcode" ); 
    5463    return true; 
     
    122131AVCCommand::setVerbose( int verboseLevel ) 
    123132{ 
    124     m_verboseLevel = verboseLevel
     133    setDebugLevel(verboseLevel)
    125134    return true; 
    126135} 
     
    129138AVCCommand::getVerboseLevel() 
    130139{ 
    131     return m_verboseLevel
     140    return getDebugLevel()
    132141} 
    133142 
     
    140149        if ( ( i % 16 ) == 0 ) { 
    141150            if ( i > 0 ) { 
    142                 printf( "\n" ); 
     151                debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "\n" ); 
    143152            } 
    144             printf( "  %3d:\t", i ); 
     153            debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "  %3d:\t", i ); 
    145154        } else if ( ( i % 4 ) == 0 ) { 
    146             printf( " " ); 
     155            debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, " " ); 
    147156        } 
    148         printf( "%02x ", buf[i] ); 
    149     } 
    150     printf( "\n" ); 
     157        debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%02x ", buf[i] ); 
     158    } 
     159    debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "\n" ); 
    151160} 
    152161 
     
    158167    BufferSerialize se( m_fcpFrame, sizeof( m_fcpFrame ) ); 
    159168    if ( !serialize( se ) ) { 
    160         printf(  "ExtendedPlugInfoCmd::fire: Could not serialize\n" ); 
     169        debugFatal(  "ExtendedPlugInfoCmd::fire: Could not serialize\n" ); 
    161170        return false; 
    162171    } 
     
    164173    unsigned short fcpFrameSize = se.getNrOfProducesBytes(); 
    165174 
    166     if ( getVerboseLevel() >= DEBUG_EXTRA_VERBOSE ) { 
    167         printf( "%s:\n", getCmdName() ); 
    168         puts( "  Request:"); 
     175    if (getDebugLevel() >= DEBUG_LEVEL_VERY_VERBOSE) { 
     176        debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "%s:\n", getCmdName() ); 
     177        debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "  Request:"); 
    169178        showFcpFrame( m_fcpFrame, fcpFrameSize ); 
    170  
    171         CoutSerializer se; 
    172         serialize( se ); 
     179     
     180        StringSerializer se_dbg; 
     181        serialize( se_dbg ); 
     182     
     183        debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s",  
     184                         se_dbg.getString().c_str()); 
    173185    } 
    174186 
     
    186198        switch ( m_eResponse ) 
    187199        { 
     200        case eR_Accepted: 
    188201        case eR_Implemented: 
    189202        case eR_Rejected: 
     
    193206            result = deserialize( de ); 
    194207 
    195             if ( getVerboseLevel() >= DEBUG_EXTRA_VERBOSE) { 
    196                 puts("  Response:"); 
    197                 showFcpFrame( buf, de.getNrOfConsumedBytes() ); 
    198  
    199                 CoutSerializer se; 
    200                 serialize( se ); 
    201             } 
     208            debugOutput( DEBUG_LEVEL_VERY_VERBOSE,"  Response:"); 
     209            showFcpFrame( buf, de.getNrOfConsumedBytes() ); 
     210 
     211            StringSerializer se_dbg; 
     212            serialize( se_dbg ); 
     213             
     214            debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s",  
     215                             se_dbg.getString().c_str()); 
    202216        } 
    203217        break; 
    204218        default: 
    205             printf( "unexpected response received (0x%x)\n", m_eResponse ); 
    206             if ( getVerboseLevel() >= DEBUG_EXTRA_VERBOSE) { 
    207                 puts("  Response:"); 
    208                 BufferDeserialize de( buf, resp_len ); 
    209                 deserialize( de ); 
    210  
    211                 showFcpFrame( buf, resp_len ); 
    212             } 
     219            debugWarning( "unexpected response received (0x%x)\n", m_eResponse ); 
     220            debugOutput( DEBUG_LEVEL_VERY_VERBOSE,"  Response:"); 
     221             
     222            BufferDeserialize de( buf, resp_len ); 
     223            deserialize( de ); 
     224 
     225            showFcpFrame( buf, de.getNrOfConsumedBytes() ); 
    213226 
    214227        } 
    215228    } else { 
    216         printf( "no response\n" ); 
    217     } 
    218  
    219     if ( getVerboseLevel() >= DEBUG_EXTRA_VERBOSE ) { 
    220         printf( "\n" ); 
    221     } 
     229           debugWarning( "no response\n" ); 
     230    } 
     231     
     232    debugOutputShort( DEBUG_LEVEL_VERY_VERBOSE, "\n" ); 
    222233 
    223234    m_1394Service->transactionBlockClose(); 
     
    264275    } 
    265276} 
     277 
     278const char* responseToStrings[] = 
     279{ 
     280    "control", 
     281    "status", 
     282    "specific inquiry", 
     283    "notify", 
     284    "general inquiry", 
     285    "reserved for future specification", 
     286    "reserved for future specification", 
     287    "reserved for future specification", 
     288    "not implemented", 
     289    "accepted", 
     290    "rejected", 
     291    "in transition", 
     292    "implemented/stable", 
     293    "changed" 
     294    "reserved for future specification", 
     295    "interim", 
     296}; 
     297 
     298const char* 
     299responseToString( AVCCommand::EResponse eResponse ) 
     300{ 
     301    if ( eResponse > ( int )( sizeof( responseToStrings ) / sizeof( responseToStrings[0] ) ) ) { 
     302        return "unknown"; 
     303    } 
     304    return responseToStrings[eResponse]; 
     305} 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_generic.h

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    2323 
    2424#include "avc_definitions.h" 
     25#include "debugmodule/debugmodule.h" 
    2526 
    2627#include "../fbtypes.h" 
     
    105106    bool setVerbose( int verboseLevel ); 
    106107    int getVerboseLevel(); 
    107  
     108     
    108109    virtual const char* getCmdName() const = 0; 
    109110 
     
    130131    opcode_t     m_opcode; 
    131132    EResponse    m_eResponse; 
    132     int          m_verboseLevel; 
    133133    ECommandType m_commandType; 
    134134    static int   m_time; 
     135     
     136    DECLARE_DEBUG_MODULE; 
    135137}; 
    136138 
    137139 
    138140const char* subunitTypeToString( subunit_type_t subunitType ); 
     141const char* responseToString( AVCCommand::EResponse eResponse ); 
    139142 
    140143#endif // AVCGeneric_h 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_plug_info.cpp

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_plug_info.h

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_signal_source.cpp

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_signal_source.h

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_subunit_info.cpp

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_subunit_info.h

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_unit_info.cpp

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/avc_unit_info.h

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/src/libfreebobavc/ieee1394service.cpp

    r242 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    2626 
    2727#include <iostream> 
    28  
    29 using namespace std; 
     28#include <iomanip> 
     29 
    3030 
    3131Ieee1394Service::Ieee1394Service() 
    3232    : m_handle( 0 ) 
    3333    , m_port( -1 ) 
    34 
     34    , m_verbose( false ) 
     35    , m_threadRunning( false ) 
     36
     37    pthread_mutex_init( &m_mutex, 0 ); 
    3538} 
    3639 
    3740Ieee1394Service::~Ieee1394Service() 
    3841{ 
    39     if (m_handle) { 
    40         raw1394_destroy_handle(m_handle); 
     42    stopRHThread(); 
     43 
     44    if ( m_handle ) { 
     45        raw1394_destroy_handle( m_handle ); 
     46    } 
     47    if ( m_resetHandle ) { 
     48        raw1394_destroy_handle( m_resetHandle ); 
    4149    } 
    4250} 
     
    4553Ieee1394Service::initialize( int port ) 
    4654{ 
     55    using namespace std; 
     56 
    4757    m_handle = raw1394_new_handle_on_port( port ); 
    4858    if ( !m_handle ) { 
     
    5666    } 
    5767 
     68    m_resetHandle = raw1394_new_handle_on_port( port ); 
     69    if ( !m_handle ) { 
     70        if ( !errno ) { 
     71            cerr << "libraw1394 not compatible" << endl; 
     72        } else { 
     73            perror( "Ieee1394Service::initialize: Could not get 1394 handle" ); 
     74            cerr << "Is ieee1394 and raw1394 driver loaded?" << endl; 
     75        } 
     76        return false; 
     77    } 
     78 
    5879    m_port = port; 
     80 
     81    raw1394_set_userdata( m_handle, this ); 
     82    raw1394_set_userdata( m_resetHandle, this ); 
     83    raw1394_set_bus_reset_handler( m_resetHandle, 
     84                                   this->resetHandlerLowLevel ); 
     85    startRHThread(); 
     86 
    5987    return true; 
    6088} 
     
    6997Ieee1394Service::read( fb_nodeid_t nodeId, 
    7098                       fb_nodeaddr_t addr, 
    71                        size_t size
     99                       size_t length
    72100                       fb_quadlet_t* buffer ) 
    73101{ 
    74     return raw1394_read( m_handle, nodeId, addr,  size,  buffer ) != 0; 
    75 
    76  
    77 bool 
    78 Ieee1394Service::write( fb_nodeid_t   nodeId, 
     102    using namespace std; 
     103    if ( raw1394_read( m_handle, nodeId, addr, length*4, buffer ) == 0 ) { 
     104 
     105        #ifdef DEBUG 
     106        if ( m_verbose ) { 
     107            cout << "read:  node 0x" << hex << nodeId <<", addr = 0x" 
     108                 << setfill( '0' ) << setw( 16 ) << addr 
     109                 << ", length = " << dec << length << " quadlets" << endl; 
     110            printBuffer( length, buffer ); 
     111        } 
     112        #endif 
     113 
     114        return true; 
     115    } else { 
     116        #ifdef DEBUG 
     117        if ( m_verbose ) { 
     118            cerr << "raw1394_read failed: node 0x" << hex << nodeId 
     119                 << ", addr 0x" << setfill( '0' ) << setw( 16 ) << addr 
     120                 << ", length = " << dec << length << " quadlets" << endl; 
     121        } 
     122        #endif 
     123 
     124        return false; 
     125    } 
     126
     127 
     128 
     129bool 
     130Ieee1394Service::read_quadlet( fb_nodeid_t nodeId, 
     131                               fb_nodeaddr_t addr, 
     132                               fb_quadlet_t* buffer ) 
     133
     134    return read( nodeId,  addr, sizeof( *buffer )/4, buffer ); 
     135
     136 
     137bool 
     138Ieee1394Service::read_octlet( fb_nodeid_t nodeId, 
     139                              fb_nodeaddr_t addr, 
     140                              fb_octlet_t* buffer ) 
     141
     142    return read( nodeId, addr, sizeof( *buffer )/4, 
     143                 reinterpret_cast<fb_quadlet_t*>( buffer ) ); 
     144
     145 
     146 
     147bool 
     148Ieee1394Service::write( fb_nodeid_t nodeId, 
    79149                        fb_nodeaddr_t addr, 
    80                         size_t        length, 
    81                         fb_quadlet_t  *data ) 
    82 
    83     return raw1394_write( m_handle, nodeId, addr, length, data ) != 0; 
     150                        size_t length, 
     151                        fb_quadlet_t* data ) 
     152
     153    using namespace std; 
     154 
     155    #ifdef DEBUG 
     156    if ( m_verbose ) { 
     157        cout << "write: node 0x" << hex << nodeId << ", addr = 0x" 
     158             << setfill( '0' ) << setw( 16 ) << addr 
     159             << ", length = " << dec << length << " quadlets" << endl; 
     160        printBuffer( length, data ); 
     161    } 
     162    #endif 
     163 
     164    return raw1394_write( m_handle, nodeId, addr, length*4, data ) == 0; 
     165
     166 
     167 
     168bool 
     169Ieee1394Service::write_quadlet( fb_nodeid_t nodeId, 
     170                                fb_nodeaddr_t addr, 
     171                                fb_quadlet_t data ) 
     172
     173    return write( nodeId, addr, sizeof( data )/4, &data ); 
     174
     175 
     176bool 
     177Ieee1394Service::write_octlet( fb_nodeid_t nodeId, 
     178                               fb_nodeaddr_t addr, 
     179                               fb_octlet_t data ) 
     180
     181    return write( nodeId, addr, sizeof( data )/4, 
     182                  reinterpret_cast<fb_quadlet_t*>( &data ) ); 
    84183} 
    85184 
     
    93192        buf[i] = ntohl( buf[i] ); 
    94193    } 
     194 
     195    #ifdef DEBUG 
     196    if ( m_verbose ) { 
     197        printf( "pre avc1394_transaction_block2\n" ); 
     198        printBuffer( len, buf ); 
     199    } 
     200    #endif 
    95201 
    96202    fb_quadlet_t* result = 
     
    102208                                    10 ); 
    103209 
     210    #ifdef DEBUG 
     211    if ( m_verbose ) { 
     212        printf( "post avc1394_transaction_block2\n" ); 
     213        printBuffer( *resp_len, result ); 
     214    } 
     215    #endif 
     216 
    104217    for ( unsigned int i = 0; i < *resp_len; ++i ) { 
    105218        result[i] = htonl( result[i] ); 
     
    116229    return true; 
    117230} 
     231 
     232void 
     233Ieee1394Service::setVerbose( bool isVerbose ) 
     234{ 
     235    m_verbose = isVerbose; 
     236} 
     237 
     238void 
     239Ieee1394Service::printBuffer( size_t length, fb_quadlet_t* buffer ) const 
     240{ 
     241    using namespace std; 
     242 
     243    for ( unsigned int i=0; i < length; ++i ) { 
     244        if ( ( i % 4 ) == 0 ) { 
     245            if ( i > 0 ) { 
     246                cout << endl; 
     247            } 
     248            cout << setfill( ' ' ) << setw( 4 ) << i*4 << ": "; 
     249        } 
     250        cout << setfill( '0' ) << setw( 8 ) << hex << buffer[i] << " "; 
     251    } 
     252    cout << endl; 
     253} 
     254 
     255int 
     256Ieee1394Service::resetHandlerLowLevel( raw1394handle_t handle, 
     257                                       unsigned int generation ) 
     258{ 
     259    raw1394_update_generation ( handle, generation ); 
     260    Ieee1394Service* instance 
     261        = (Ieee1394Service*) raw1394_get_userdata( handle ); 
     262    instance->resetHandler( generation ); 
     263 
     264    return 0; 
     265} 
     266 
     267bool 
     268Ieee1394Service::resetHandler( unsigned int generation ) 
     269{ 
     270    m_generation = generation; 
     271 
     272    for ( reset_handler_vec_t::iterator it = m_busResetHandlers.begin(); 
     273          it != m_busResetHandlers.end(); 
     274          ++it ) 
     275    { 
     276        Functor* func = *it; 
     277        ( *func )(); 
     278    } 
     279 
     280    return true; 
     281} 
     282 
     283bool 
     284Ieee1394Service::startRHThread() 
     285{ 
     286    if ( m_threadRunning ) { 
     287        return true; 
     288    } 
     289    pthread_mutex_lock( &m_mutex ); 
     290    pthread_create( &m_thread, 0, rHThread, this ); 
     291    pthread_mutex_unlock( &m_mutex ); 
     292    m_threadRunning = true; 
     293 
     294    return true; 
     295} 
     296 
     297void 
     298Ieee1394Service::stopRHThread() 
     299{ 
     300    if ( m_threadRunning ) { 
     301        pthread_mutex_lock (&m_mutex); 
     302        pthread_cancel (m_thread); 
     303        pthread_join (m_thread, 0); 
     304        pthread_mutex_unlock (&m_mutex); 
     305        m_threadRunning = false; 
     306    } 
     307} 
     308 
     309void* 
     310Ieee1394Service::rHThread( void* arg ) 
     311{ 
     312    Ieee1394Service* pIeee1394Service = (Ieee1394Service*) arg; 
     313 
     314    while (true) { 
     315        raw1394_loop_iterate (pIeee1394Service->m_resetHandle); 
     316        pthread_testcancel (); 
     317    } 
     318 
     319    return 0; 
     320} 
     321 
     322bool 
     323Ieee1394Service::addBusResetHandler( Functor* functor ) 
     324{ 
     325    m_busResetHandlers.push_back( functor ); 
     326    return true; 
     327} 
     328 
     329bool 
     330Ieee1394Service::remBusResetHandler( Functor* functor ) 
     331{ 
     332    for ( reset_handler_vec_t::iterator it = m_busResetHandlers.begin(); 
     333          it != m_busResetHandlers.end(); 
     334          ++it ) 
     335    { 
     336        if ( *it == functor ) { 
     337            m_busResetHandlers.erase( it ); 
     338            return true; 
     339        } 
     340    } 
     341    return false; 
     342} 
  • branches/libfreebob-2.0/src/libfreebobavc/ieee1394service.h

    r221 r336  
    11/* Ieee1394Service.cpp 
    2  * Copyright (C) 2005 by Daniel Wagner 
     2 * Copyright (C) 2005,06 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    2323 
    2424#include "fbtypes.h" 
     25#include "threads.h" 
    2526 
    2627#include <libraw1394/raw1394.h> 
     28#include <pthread.h> 
     29 
     30#include <vector> 
    2731 
    2832class Ieee1394Service{ 
     
    4953   /** 
    5054    * read - send async read request to a node and wait for response. 
    51     * @node: target node 
     55    * @node: target node (\XXX needs 0xffc0 stuff) 
    5256    * @addr: address to read from 
    5357    * @length: amount of data to read in quadlets 
     
    5660    * This does the complete transaction and will return when it's finished. 
    5761    * 
    58     * Returns: truee on success or false on failure (sets errno) 
     62    * Returns: true on success or false on failure (sets errno) 
    5963    */ 
    6064    bool read( fb_nodeid_t nodeId, 
    6165               fb_nodeaddr_t addr, 
    62                size_t size
     66               size_t length
    6367               fb_quadlet_t* buffer ); 
    6468 
    65    /** 
     69    bool read_quadlet( fb_nodeid_t nodeId, 
     70                       fb_nodeaddr_t addr, 
     71                       fb_quadlet_t* buffer ); 
     72 
     73    bool read_octlet( fb_nodeid_t nodeId, 
     74                      fb_nodeaddr_t addr, 
     75                      fb_octlet_t* buffer ); 
     76 
     77    /** 
    6678    * write - send async write request to a node and wait for response. 
    67     * @node: target node 
     79    * @node: target node (\XXX needs 0xffc0 stuff) 
    6880    * @addr: address to write to 
    6981    * @length: amount of data to write in quadlets 
     
    7486    * Returns: true on success or false on failure (sets errno) 
    7587    */ 
    76     bool write( fb_nodeid_t   nodeId, 
     88    bool write( fb_nodeid_t nodeId, 
    7789                fb_nodeaddr_t addr, 
    78                 size_t        length, 
    79                 fb_quadlet_t  *data ); 
     90                size_t length, 
     91                fb_quadlet_t* data ); 
    8092 
     93    bool write_quadlet( fb_nodeid_t nodeId, 
     94                        fb_nodeaddr_t addr, 
     95                        fb_quadlet_t data ); 
     96 
     97    bool write_octlet(  fb_nodeid_t nodeId, 
     98                        fb_nodeaddr_t addr, 
     99                        fb_octlet_t data ); 
    81100 
    82101    fb_quadlet_t* transactionBlock( fb_nodeid_t nodeId, 
     
    89108    raw1394handle_t getHandle() {return m_handle;}; 
    90109 
    91      
     110    void setVerbose( bool isVerbose ); 
     111 
     112 
     113    bool addBusResetHandler( Functor* functor ); 
     114    bool remBusResetHandler( Functor* functor ); 
     115 
    92116private: 
     117 
     118    bool startRHThread(); 
     119    void stopRHThread(); 
     120    static void* rHThread( void* arg ); 
     121 
     122    void printBuffer( size_t length, fb_quadlet_t* buffer ) const; 
     123 
     124    static int resetHandlerLowLevel( raw1394handle_t handle, 
     125                                     unsigned int generation ); 
     126    bool resetHandler( unsigned int generation ); 
     127 
    93128    raw1394handle_t m_handle; 
     129    raw1394handle_t m_resetHandle; 
    94130    int             m_port; 
     131    bool            m_verbose; 
     132    unsigned int    m_generation; 
     133 
     134    pthread_t       m_thread; 
     135    pthread_mutex_t m_mutex; 
     136    bool            m_threadRunning; 
     137 
     138    typedef std::vector< Functor* > reset_handler_vec_t; 
     139    reset_handler_vec_t m_busResetHandlers; 
    95140}; 
    96141 
  • branches/libfreebob-2.0/src/libfreebobavc/serialize.cpp

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    3939{ 
    4040    printf( "  %3d:\t0x%08x\t%s\n", m_cnt, d, name ); 
     41    m_cnt += sizeof( quadlet_t ); 
     42    return true; 
     43} 
     44 
     45////////////////////////////////////////////////// 
     46 
     47bool 
     48StringSerializer::write( byte_t d, const char* name ) 
     49{ 
     50    char* result; 
     51    asprintf( &result, "  %3d:\t0x%02x\t%s\n", m_cnt, d, name ); 
     52     
     53    m_string += result; 
     54    free( result ); 
     55     
     56    m_cnt += sizeof( byte_t ); 
     57 
     58    return true; 
     59} 
     60 
     61bool 
     62StringSerializer::write( quadlet_t d, const char* name ) 
     63{ 
     64    char* result; 
     65    asprintf( &result, "  %3d:\t0x%08x\t%s\n", m_cnt, d, name ); 
     66     
     67    m_string += result; 
     68    free( result ); 
     69     
    4170    m_cnt += sizeof( quadlet_t ); 
    4271    return true; 
     
    97126    bool result = false; 
    98127    if ( isCurPosValid() ) { 
    99         *value = *m_curPos
     128        *value = *( ( quadlet_t* )m_curPos )
    100129        m_curPos += sizeof( quadlet_t ); 
    101130        result = true; 
  • branches/libfreebob-2.0/src/libfreebobavc/serialize.h

    r183 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    2323 
    2424#include <libraw1394/raw1394.h> // byte_t and quadlet_t declaration 
     25#include <string> 
    2526 
    2627// Interfaces 
     
    6162private: 
    6263    unsigned int m_cnt; 
     64 
     65}; 
     66 
     67class StringSerializer: public IOSSerialize { 
     68public: 
     69    StringSerializer() 
     70        : IOSSerialize() 
     71        , m_cnt( 0 ) 
     72        {} 
     73    virtual ~StringSerializer() {} 
     74 
     75    virtual bool write( byte_t value, const char* name = "" ); 
     76    virtual bool write( quadlet_t value,  const char* name = "" ); 
     77    virtual std::string getString( ) { return m_string;}; 
     78 
     79private: 
     80    unsigned int m_cnt; 
     81    std::string m_string; 
    6382 
    6483}; 
  • branches/libfreebob-2.0/src/libstreaming/freebob_streaming.cpp

    r302 r336  
    118118 
    119119        // discover the devices on the bus 
    120         if(!dev->m_deviceManager->discover(DEBUG_LEVEL_VERBOSE)) { 
     120        if(!dev->m_deviceManager->discover(DEBUG_LEVEL_NORMAL)) { 
    121121                debugOutput(DEBUG_LEVEL_VERBOSE, "Could not discover devices\n"); 
    122122                return 0; 
  • branches/libfreebob-2.0/src/Makefile.am

    r331 r336  
    33# Copyright (C) 2006 by Pieter Palmers. 
    44# 
    5 # This file is part of FreeBob
     5# This file is part of FreeBoB
    66# 
    7 # FreeBob is free software; you can redistribute it and/or modify 
     7# FreeBoB is free software; you can redistribute it and/or modify 
    88# it under the terms of the GNU General Public License as published by 
    99# the Free Software Foundation; either version 2 of the License, or 
    1010# (at your option) any later version. 
    11 # FreeBob is distributed in the hope that it will be useful, 
     11# FreeBoB is distributed in the hope that it will be useful, 
    1212# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1313# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414# GNU General Public License for more details. 
    1515# You should have received a copy of the GNU General Public License 
    16 # along with FreeBob; if not, write to the Free Software 
     16# along with FreeBoB; if not, write to the Free Software 
    1717# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1818 
    19 SUBDIRS = debugmodule libfreebobavc libstreaming libutil 
    20  
    21 INCLUDES = $(LIBSIGC_CFLAGS) $(LIBRAW1394_CFLAGS) $(LIBIEC61883_CFLAGS) \ 
    22         $(LIBAVC1394_CFLAGS) $(LIBLO_CFLAGS) $(LIBXML_CFLAGS) \ 
     19INCLUDES =                                              \ 
     20        $(LIBRAW1394_CFLAGS) $(LIBIEC61883_CFLAGS)      \ 
     21        $(LIBAVC1394_CFLAGS) $(LIBXML_CFLAGS)           \ 
    2322        -I$(top_srcdir) -I$(top_srcdir)/src 
    2423 
     
    2928        devicemanager.h                                 \ 
    3029        fbtypes.h                                       \ 
    31         bebob_light/bebob_light_avdevice.h              \ 
    32         bebob_light/bebob_light_avdevicesubunit.h       \ 
    33         bebob_light/bebob_light_avplug.h                \ 
    3430        bounce/bounce_avdevice.h                        \ 
    3531        motu/motu_avdevice.h                            \ 
    3632        rme/rme_avdevice.h 
    37 #       bebob/bebob_avdevice.h                          \ 
    38 #       bebob/bebob_avdevice_subunit.h                  \ 
    39 #       bebob/bebob_avplug.h                            \ 
    40 #       bebob/bebob_functionblock.h                      
    4133 
    4234libfreebob_la_SOURCES =                                 \ 
     35        iavdevice.h                                     \ 
    4336        configrom.cpp                                   \ 
    4437        csr1212.c                                       \ 
     
    4639        freebob.cpp                                     \ 
    4740        xmlparser.c                                     \ 
    48         bebob_light/bebob_light_avdevice.cpp            \ 
    49         bebob_light/bebob_light_avdevicesubunit.cpp     \ 
    50         bebob_light/bebob_light_avplug.cpp              \ 
    51         bounce/bounce_avdevice.cpp                      \ 
     41        threads.h                                       \ 
     42        bebob/bebob_avdevice.h                          \ 
     43        bebob/bebob_avdevice.cpp                        \ 
     44        bebob/bebob_avdevice_xml.cpp                    \ 
     45        bebob/bebob_avdevice_subunit.h                  \ 
     46        bebob/bebob_avdevice_subunit.cpp                \ 
     47        bebob/bebob_avplug.h                            \ 
     48        bebob/bebob_avplug.cpp                          \ 
     49        bebob/bebob_avplug_xml.cpp                      \ 
     50        bebob/bebob_functionblock.h                     \ 
     51        bebob/bebob_functionblock.cpp                   \ 
     52        bebob/bebob_dl_mgr.h                            \ 
     53        bebob/bebob_dl_mgr.cpp                          \ 
     54        bebob/bebob_dl_codes.h                          \ 
     55        bebob/bebob_dl_codes.cpp                        \ 
     56        bebob/bebob_dl_bcd.h                            \ 
     57        bebob/bebob_dl_bcd.cpp                          \ 
    5258        motu/motu_avdevice.cpp                          \ 
    53         rme/rme_avdevice.cpp 
     59        motu/motu_avdevice.h                            \ 
     60        rme/rme_avdevice.cpp                            \ 
     61        rme/rme_avdevice.h                              \ 
     62        bounce/bounce_avdevice.h                        \ 
     63        bounce/bounce_avdevice.cpp                      \ 
     64        maudio/maudio_avdevice.h                        \ 
     65        maudio/maudio_avdevice.cpp                      \ 
     66        libfreebobavc/avc_connect.cpp                   \ 
     67        libfreebobavc/avc_definitions.cpp               \ 
     68        libfreebobavc/avc_extended_cmd_generic.cpp      \ 
     69        libfreebobavc/avc_extended_plug_info.cpp        \ 
     70        libfreebobavc/avc_extended_stream_format.cpp    \ 
     71        libfreebobavc/avc_extended_subunit_info.cpp     \ 
     72        libfreebobavc/avc_function_block.cpp            \ 
     73        libfreebobavc/avc_function_block.h              \ 
     74        libfreebobavc/avc_generic.cpp                   \ 
     75        libfreebobavc/avc_plug_info.cpp                 \ 
     76        libfreebobavc/avc_signal_source.cpp             \ 
     77        libfreebobavc/avc_subunit_info.cpp              \ 
     78        libfreebobavc/avc_unit_info.cpp                 \ 
     79        libfreebobavc/ieee1394service.cpp               \ 
     80        libfreebobavc/serialize.cpp                     \ 
     81        libfreebobavc/avc_connect.h                     \ 
     82        libfreebobavc/avc_definitions.h                 \ 
     83        libfreebobavc/avc_extended_cmd_generic.h        \ 
     84        libfreebobavc/avc_extended_plug_info.h          \ 
     85        libfreebobavc/avc_extended_stream_format.h      \ 
     86        libfreebobavc/avc_extended_subunit_info.h       \ 
     87        libfreebobavc/avc_generic.h                     \ 
     88        libfreebobavc/avc_plug_info.h                   \ 
     89        libfreebobavc/avc_signal_source.h               \ 
     90        libfreebobavc/avc_subunit_info.h                \ 
     91        libfreebobavc/avc_unit_info.h                   \ 
     92        libfreebobavc/ieee1394service.h                 \ 
     93        libfreebobavc/serialize.h                       \ 
     94        debugmodule/debugmodule.h                       \ 
     95        debugmodule/debugmodule.cpp                     \ 
     96        libstreaming/cip.c      \ 
     97        libstreaming/freebob_streaming.cpp      \ 
     98        libstreaming/IsoHandler.cpp     \ 
     99        libstreaming/IsoHandlerManager.cpp      \ 
     100        libstreaming/IsoStream.cpp      \ 
     101        libstreaming/PacketBuffer.cpp   \ 
     102        libstreaming/PortManager.cpp    \ 
     103        libstreaming/Port.cpp   \ 
     104        libstreaming/StreamProcessor.cpp        \ 
     105        libstreaming/StreamProcessorManager.cpp \ 
     106        libstreaming/AmdtpPortInfo.cpp  \ 
     107        libstreaming/AmdtpPort.cpp      \ 
     108        libstreaming/AmdtpStreamProcessor.cpp   \ 
     109        libstreaming/ringbuffer.c       \ 
     110        libstreaming/streamstatistics.cpp       \ 
     111        libstreaming/MotuStreamProcessor.cpp    \ 
     112        libstreaming/MotuPort.cpp       \ 
     113        libstreaming/MotuPortInfo.cpp \ 
     114        libutil/DelayLockedLoop.h       \ 
     115        libutil/Atomic.h        \ 
     116        libutil/PosixThread.h   \ 
     117        libutil/Thread.h        \ 
     118        libutil/DelayLockedLoop.cpp     \ 
     119        libutil/PosixThread.cpp  
    54120 
    55 #       bebob/bebob_avdevice.cpp                        \ 
    56 #       bebob/bebob_avdevice_xml.cpp                    \ 
    57 #       bebob/bebob_avdevice_subunit.cpp                \ 
    58 #       bebob/bebob_avplug.cpp                          \ 
    59 #       bebob/bebob_avplug_xml.cpp                      \ 
    60 #       bebob/bebob_functionblock.cpp                    
     121libfreebob_la_LDFLAGS =                                 \ 
     122        -version-info $(LT_VERSION) $(LIBRAW1394_LIBS)  \ 
     123        $(LIBIEC61883_LIBS) $(LIBAVC1394_LIBS)          \ 
     124        $(LIBXML_LIBS) -lpthread 
    61125 
    62 libfreebob_la_LDFLAGS = -version-info $(LT_VERSION) -lpthread $(LIBSIGC_LIBS)
    63         $(LIBRAW1394_LIBS) $(LIBIEC61883_LIBS) $(LIBAVC1394_LIBS)
    64         $(LIBLO_LIBS) $(LIBXML_LIBS) -safe-temps 
     126nobase_dist_pkgdata_DATA =                             
     127        maudio/refdesign.xml                           
     128        maudio/fw410.xml 
    65129 
    66 libfreebob_la_LIBADD = debugmodule/libdebugmodule.la libfreebobavc/libfreebobavc.la \ 
    67         libstreaming/libstreaming.la libutil/libutil.la 
     130bin_PROGRAMS = freebob_downloader freebob_sync 
    68131 
     132freebob_downloader_SOURCES =    \ 
     133        freebob-downloader.cpp 
     134freebob_downloader_LDADD =      \ 
     135        libfreebob.la           \ 
     136        $(LIBRAW1394_LIBS)      \ 
     137        $(LIBIEC61883_LIBS)     \ 
     138        $(LIBAVC1394_LIBS)      \ 
     139        -lpthread 
     140 
     141freebob_sync_SOURCES =    \ 
     142        freebob-sync.cpp 
     143freebob_sync_LDADD =      \ 
     144        libfreebob.la           \ 
     145        $(LIBRAW1394_LIBS)      \ 
     146        $(LIBIEC61883_LIBS)     \ 
     147        $(LIBAVC1394_LIBS)      \ 
     148        -lpthread 
     149 
     150noinst_PROGRAMS = test-dll test-debugmodule 
     151 
     152test_dll_SOURCES = libutil/test-dll.cpp 
     153test_dll_LDADD = libfreebob.la 
     154 
     155test_debugmodule_SOURCES = debugmodule/test_debugmodule.cpp 
     156test_debugmodule_LDADD = libfreebob.la 
  • branches/libfreebob-2.0/src/maudio/maudio_avdevice.cpp

    r319 r336  
    4646    , m_iVerboseLevel( iVerboseLevel ) 
    4747    , m_pFilename( 0 ) 
    48 
    49     if ( m_iVerboseLevel ) { 
    50         setDebugLevel( DEBUG_LEVEL_VERBOSE ); 
    51     } 
     48    , m_id(0) 
     49    , m_receiveProcessor ( 0 ) 
     50    , m_receiveProcessorBandwidth ( -1 ) 
     51    , m_transmitProcessor ( 0 ) 
     52    , m_transmitProcessorBandwidth ( -1 ) 
     53
     54    setDebugLevel( iVerboseLevel ); 
     55     
    5256    debugOutput( DEBUG_LEVEL_VERBOSE, "Created MAudio::AvDevice (NodeID %d)\n", 
    5357                 iNodeId ); 
     
    124128    return false; 
    125129} 
     130 
     131int AvDevice::getSamplingFrequency( ) { 
     132    return 44100; 
     133} 
     134 
    126135 
    127136void 
     
    219228} 
    220229 
     230bool AvDevice::setId( unsigned int id) 
     231{ 
     232    // FIXME: decent ID system nescessary 
     233    m_id=id; 
     234    return true; 
     235} 
     236 
    221237bool 
    222 AvDevice::setId(unsigned int id) 
    223 
    224     return true; 
    225 
    226  
    227 
     238AvDevice::prepare() { 
     239/*    /////////// 
     240    // get plugs 
     241 
     242    AvPlug* inputplug = getPlugById( m_pcrPlugs, AvPlug::eAPD_Input, 0 ); 
     243    if ( !inputplug ) { 
     244        debugError( "setSampleRate: Could not retrieve iso input plug 0\n" ); 
     245        return false; 
     246    } 
     247    AvPlug* outputPlug = getPlugById( m_pcrPlugs, AvPlug::eAPD_Output, 0 ); 
     248    if ( !inputplug ) { 
     249        debugError( "setSampleRate: Could not retrieve iso output plug 0\n" ); 
     250        return false; 
     251    } 
     252 
     253    int samplerate=outputPlug->getSampleRate(); 
     254    m_receiveProcessor=new FreebobStreaming::AmdtpReceiveStreamProcessor( 
     255                             m_p1394Service->getPort(), 
     256                             samplerate, 
     257                             outputPlug->getNrOfChannels()); 
     258 
     259    if(!m_receiveProcessor->init()) { 
     260        debugFatal("Could not initialize receive processor!\n"); 
     261        return false; 
     262    } 
     263 
     264    if (!addPlugToProcessor(*outputPlug,m_receiveProcessor,  
     265        FreebobStreaming::AmdtpAudioPort::E_Capture)) { 
     266        debugFatal("Could not add plug to processor!\n"); 
     267        return false; 
     268    } 
     269 
     270    // do the transmit processor 
     271//     if (m_snoopMode) { 
     272//         // we are snooping, so these are receive too. 
     273//         samplerate=inputPlug->getSampleRate(); 
     274//         m_receiveProcessor2=new FreebobStreaming::AmdtpReceiveStreamProcessor( 
     275//                                   channel, 
     276//                                   m_p1394Service->getPort(), 
     277//                                   samplerate, 
     278//                                   inputPlug->getNrOfChannels()); 
     279//          
     280//         if(!m_receiveProcessor2->init()) { 
     281//             debugFatal("Could not initialize snooping receive processor!\n"); 
     282//             return false; 
     283//         } 
     284//         if (!addPlugToProcessor(*inputPlug,m_receiveProcessor2,  
     285//             FreebobStreaming::AmdtpAudioPort::E_Capture)) { 
     286//             debugFatal("Could not add plug to processor!\n"); 
     287//             return false; 
     288//         } 
     289//     } else { 
     290        // do the transmit processor 
     291        samplerate=inputPlug->getSampleRate(); 
     292        m_transmitProcessor=new FreebobStreaming::AmdtpTransmitStreamProcessor( 
     293                                m_p1394Service->getPort(), 
     294                                samplerate, 
     295                                inputPlug->getNrOfChannels()); 
     296                                 
     297        if(!m_transmitProcessor->init()) { 
     298            debugFatal("Could not initialize transmit processor!\n"); 
     299            return false; 
     300         
     301        } 
     302         
     303        // FIXME: do this the proper way! 
     304        m_transmitProcessor->syncmaster=m_receiveProcessor; 
     305     
     306        if (!addPlugToProcessor(*inputPlug,m_transmitProcessor,  
     307            FreebobStreaming::AmdtpAudioPort::E_Playback)) { 
     308            debugFatal("Could not add plug to processor!\n"); 
     309            return false; 
     310        } 
     311//     } 
     312 
     313    return true;*/ 
     314
     315 
     316// bool 
     317// AvDevice::addPlugToProcessor( 
     318//     AvPlug& plug,  
     319//     FreebobStreaming::StreamProcessor *processor,  
     320//     FreebobStreaming::AmdtpAudioPort::E_Direction direction) { 
     321//  
     322//     AvPlug::ClusterInfoVector& clusterInfos = plug.getClusterInfos(); 
     323//     for ( AvPlug::ClusterInfoVector::const_iterator it = clusterInfos.begin(); 
     324//           it != clusterInfos.end(); 
     325//           ++it ) 
     326//     { 
     327//         const AvPlug::ClusterInfo* clusterInfo = &( *it ); 
     328//  
     329//         AvPlug::ChannelInfoVector channelInfos = clusterInfo->m_channelInfos; 
     330//         for ( AvPlug::ChannelInfoVector::const_iterator it = channelInfos.begin(); 
     331//               it != channelInfos.end(); 
     332//               ++it ) 
     333//         { 
     334//             const AvPlug::ChannelInfo* channelInfo = &( *it ); 
     335//             std::ostringstream portname; 
     336//              
     337//             portname << "dev" << m_id << "_" << channelInfo->m_name; 
     338//              
     339//             FreebobStreaming::Port *p=NULL; 
     340//             switch(clusterInfo->m_portType) { 
     341//             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Speaker: 
     342//             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Headphone: 
     343//             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Microphone: 
     344//             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Line: 
     345//             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Analog: 
     346//                 p=new FreebobStreaming::AmdtpAudioPort( 
     347//                         portname.str(), 
     348//                         direction,  
     349//                         // \todo: streaming backend expects indexing starting from 0 
     350//                         // but bebob reports it starting from 1. Decide where 
     351//                         // and how to handle this (pp: here) 
     352//                         channelInfo->m_streamPosition - 1,  
     353//                         channelInfo->m_location,  
     354//                         FreebobStreaming::AmdtpPortInfo::E_MBLA,  
     355//                         clusterInfo->m_portType 
     356//                 ); 
     357//                 break; 
     358//  
     359//             case ExtendedPlugInfoClusterInfoSpecificData::ePT_MIDI: 
     360//                 p=new FreebobStreaming::AmdtpMidiPort( 
     361//                         portname.str(), 
     362//                         direction,  
     363//                         // \todo: streaming backend expects indexing starting from 0 
     364//                         // but bebob reports it starting from 1. Decide where 
     365//                         // and how to handle this (pp: here) 
     366//                         channelInfo->m_streamPosition - 1,  
     367//                         channelInfo->m_location,  
     368//                         FreebobStreaming::AmdtpPortInfo::E_Midi,  
     369//                         clusterInfo->m_portType 
     370//                 ); 
     371//  
     372//                 break; 
     373//             case ExtendedPlugInfoClusterInfoSpecificData::ePT_SPDIF: 
     374//             case ExtendedPlugInfoClusterInfoSpecificData::ePT_ADAT: 
     375//             case ExtendedPlugInfoClusterInfoSpecificData::ePT_TDIF: 
     376//             case ExtendedPlugInfoClusterInfoSpecificData::ePT_MADI: 
     377//             case ExtendedPlugInfoClusterInfoSpecificData::ePT_Digital: 
     378//             case ExtendedPlugInfoClusterInfoSpecificData::ePT_NoType: 
     379//             default: 
     380//             // unsupported 
     381//                 break; 
     382//             } 
     383//  
     384//             if (!p) { 
     385//                 debugOutput(DEBUG_LEVEL_VERBOSE, "Skipped port %s\n",channelInfo->m_name.c_str()); 
     386//             } else { 
     387//          
     388//                 if (!processor->addPort(p)) { 
     389//                     debugWarning("Could not register port with stream processor\n"); 
     390//                     return false; 
     391//                 } 
     392//             } 
     393//          } 
     394//     } 
     395//     return true; 
     396// } 
     397 
     398int  
     399AvDevice::getStreamCount() { 
     400    return 0; 
     401//     return 2; // one receive, one transmit 
     402
     403 
     404FreebobStreaming::StreamProcessor * 
     405AvDevice::getStreamProcessorByIndex(int i) { 
     406    switch (i) { 
     407    case 0: 
     408        return m_receiveProcessor; 
     409    case 1: 
     410//         if (m_snoopMode) { 
     411//             return m_receiveProcessor2; 
     412//         } else { 
     413            return m_transmitProcessor; 
     414//         } 
     415    default: 
     416        return NULL; 
     417    } 
     418    return 0; 
     419
     420 
     421int 
     422AvDevice::startStreamByIndex(int i) { 
     423    int iso_channel=0; 
     424    int plug=0; 
     425    int hostplug=-1; 
     426     
     427//     if (m_snoopMode) { 
     428//      
     429//         switch (i) { 
     430//         case 0: 
     431//             // snooping doesn't use CMP, but obtains the info of the channel 
     432//             // from the target plug 
     433//              
     434//             // TODO: get isochannel from plug 
     435//              
     436//             // set the channel obtained by the connection management 
     437//             m_receiveProcessor->setChannel(iso_channel); 
     438//             break; 
     439//         case 1: 
     440//             // snooping doesn't use CMP, but obtains the info of the channel 
     441//             // from the target plug 
     442//              
     443//             // TODO: get isochannel from plug 
     444//              
     445//             // set the channel obtained by the connection management 
     446//             m_receiveProcessor2->setChannel(iso_channel); 
     447//  
     448//             break; 
     449//         default: 
     450//             return 0; 
     451//         } 
     452//     } else { 
     453     
     454        switch (i) { 
     455        case 0: 
     456            // do connection management: make connection 
     457            iso_channel = iec61883_cmp_connect( 
     458                m_p1394Service->getHandle(),  
     459                m_iNodeId | 0xffc0,  
     460                &plug, 
     461                raw1394_get_local_id (m_p1394Service->getHandle()),  
     462                &hostplug,  
     463                &m_receiveProcessorBandwidth); 
     464             
     465            // set the channel obtained by the connection management 
     466            m_receiveProcessor->setChannel(iso_channel); 
     467            break; 
     468        case 1: 
     469            // do connection management: make connection 
     470            iso_channel = iec61883_cmp_connect( 
     471                m_p1394Service->getHandle(),  
     472                raw1394_get_local_id (m_p1394Service->getHandle()),  
     473                &hostplug,  
     474                m_iNodeId | 0xffc0,  
     475                &plug, 
     476                &m_transmitProcessorBandwidth); 
     477             
     478            // set the channel obtained by the connection management 
     479            m_transmitProcessor->setChannel(iso_channel); 
     480            break; 
     481        default: 
     482            return 0; 
     483        } 
     484//     } 
     485     
     486    return 0; 
     487 
     488
     489 
     490int 
     491AvDevice::stopStreamByIndex(int i) { 
     492    // do connection management: break connection 
     493 
     494    int plug=0; 
     495    int hostplug=-1; 
     496//     if (m_snoopMode) { 
     497//         switch (i) { 
     498//         case 0: 
     499//             // do connection management: break connection 
     500//      
     501//             break; 
     502//         case 1: 
     503//             // do connection management: break connection 
     504//  
     505//             break; 
     506//         default: 
     507//             return 0; 
     508//         } 
     509//     } else { 
     510        switch (i) { 
     511        case 0: 
     512            // do connection management: break connection 
     513            iec61883_cmp_disconnect( 
     514                m_p1394Service->getHandle(),  
     515                m_iNodeId | 0xffc0,  
     516                plug, 
     517                raw1394_get_local_id (m_p1394Service->getHandle()),  
     518                hostplug,  
     519                m_receiveProcessor->getChannel(), 
     520                m_receiveProcessorBandwidth); 
     521     
     522            break; 
     523        case 1: 
     524            // do connection management: break connection 
     525            iec61883_cmp_disconnect( 
     526                m_p1394Service->getHandle(),  
     527                raw1394_get_local_id (m_p1394Service->getHandle()),  
     528                hostplug,  
     529                m_iNodeId | 0xffc0,  
     530                plug, 
     531                m_transmitProcessor->getChannel(), 
     532                m_transmitProcessorBandwidth); 
     533 
     534            break; 
     535        default: 
     536            return 0; 
     537        } 
     538//     } 
     539     
     540    return 0; 
     541
     542 
     543
  • branches/libfreebob-2.0/src/maudio/maudio_avdevice.h

    r298 r336  
    2222#define MAUDIODEVICE_H 
    2323 
    24 #include "iavdevice.h" 
    25  
    2624#include "debugmodule/debugmodule.h" 
    2725#include "libfreebobavc/avc_definitions.h" 
    2826#include "libfreebobavc/avc_extended_cmd_generic.h" 
    2927#include "libfreebob/xmlparser.h" 
     28 
     29#include "libstreaming/AmdtpStreamProcessor.h" 
     30#include "libstreaming/AmdtpPort.h" 
     31#include "libstreaming/AmdtpPortInfo.h" 
     32 
     33#include "iavdevice.h" 
    3034 
    3135class ConfigRom; 
     
    4650    virtual ConfigRom& getConfigRom() const; 
    4751    virtual bool addXmlDescription( xmlNodePtr pDeviceNode ); 
    48     virtual bool setSamplingFrequency( ESamplingFrequency eSamplingFrequency ); 
    4952    virtual void showDevice() const; 
    50     virtual bool setId(unsigned int iId); 
     53     
     54    virtual bool setSamplingFrequency( ESamplingFrequency samplingFrequency ); 
     55    virtual int getSamplingFrequency( ); 
     56         
     57    virtual bool setId(unsigned int id); 
     58 
     59    virtual int getStreamCount(); 
     60    virtual FreebobStreaming::StreamProcessor *getStreamProcessorByIndex(int i); 
     61 
     62    virtual bool prepare(); 
     63 
     64    virtual int startStreamByIndex(int i); 
     65    virtual int stopStreamByIndex(int i); 
    5166 
    5267protected: 
     
    5671    int              m_iVerboseLevel; 
    5772    const char*      m_pFilename; 
     73     
     74    unsigned int m_id; 
    5875 
     76    // streaming stuff 
     77    FreebobStreaming::AmdtpReceiveStreamProcessor *m_receiveProcessor; 
     78    int m_receiveProcessorBandwidth; 
     79 
     80    FreebobStreaming::AmdtpTransmitStreamProcessor *m_transmitProcessor; 
     81    int m_transmitProcessorBandwidth; 
     82     
    5983    DECLARE_DEBUG_MODULE; 
    6084}; 
  • branches/libfreebob-2.0/src/motu/motu_avdevice.cpp

    r312 r336  
    9696/* ======================================================================= */ 
    9797 
    98 MotuDevice::MotuDevice( Ieee1394Service& ieee1394service, 
    99                         int nodeId, 
    100                         int verboseLevel ) 
    101     : m_1394Service( &ieee1394service ) 
     98MotuDevice::MotuDevice( std::auto_ptr< ConfigRom >( configRom ), 
     99                    Ieee1394Service& ieee1394service, 
     100                    int nodeId, 
     101                    int verboseLevel ) 
     102    : m_configRom( configRom ) 
     103    , m_1394Service( &ieee1394service ) 
    102104    , m_motu_model( MOTUFW_MODEL_NONE ) 
    103105    , m_nodeId( nodeId ) 
     
    111113     
    112114{ 
    113     if ( m_verboseLevel ) { 
    114         setDebugLevel( DEBUG_LEVEL_VERBOSE ); 
    115     } 
     115    setDebugLevel( verboseLevel ); 
     116     
    116117    debugOutput( DEBUG_LEVEL_VERBOSE, "Created Motu::MotuDevice (NodeID %d)\n", 
    117118                 nodeId ); 
    118     m_configRom = new ConfigRom( m_1394Service, m_nodeId ); 
    119     m_configRom->initialize(); 
    120119 
    121120} 
     
    136135                                debugOutput(DEBUG_LEVEL_VERBOSE, "Could not free send iso channel %d\n", m_iso_send_channel); 
    137136        } 
    138         delete m_configRom; 
    139137} 
    140138 
     
    143141{ 
    144142    return *m_configRom; 
     143} 
     144 
     145struct VendorModelEntry { 
     146    unsigned int vendor_id; 
     147    unsigned int model_id; 
     148}; 
     149 
     150static VendorModelEntry supportedDeviceList[] = 
     151{ 
     152    {0x000000, 0x000001f2},  // Motu device, model entry not used 
     153 
     154}; 
     155 
     156bool 
     157MotuDevice::probe( ConfigRom& configRom ) 
     158{ 
     159    unsigned int vendorId = configRom.getNodeVendorId(); 
     160    unsigned int modelId = configRom.getModelId(); 
     161 
     162    for ( unsigned int i = 0; 
     163          i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) ); 
     164          ++i ) 
     165    { 
     166        if ( ( supportedDeviceList[i].vendor_id == vendorId ) 
     167             //&& ( supportedDeviceList[i].model_id == modelId )  
     168             ) 
     169        { 
     170            switch (configRom.getUnitVersion()) { 
     171                case MOTUFW_UNITVER_828mkII:  
     172                    return true; 
     173                case MOTUFW_UNITVER_TRAVELER: 
     174                    return true; 
     175            } 
     176        } 
     177    } 
     178 
     179    return false; 
    145180} 
    146181 
  • branches/libfreebob-2.0/src/motu/motu_avdevice.h

    r310 r336  
    8181    }; 
    8282 
    83     MotuDevice( Ieee1394Service& ieee1394Service, 
     83    MotuDevice( std::auto_ptr<ConfigRom>( configRom ), 
     84          Ieee1394Service& ieee1394Service, 
    8485                  int nodeId, 
    8586                  int verboseLevel ); 
    8687    virtual ~MotuDevice(); 
    8788 
     89    static bool probe( ConfigRom& configRom ); 
    8890    virtual bool discover(); 
    8991    virtual ConfigRom& getConfigRom() const; 
     
    115117   
    116118protected: 
     119    std::auto_ptr<ConfigRom>( m_configRom ); 
    117120    Ieee1394Service* m_1394Service; 
    118     ConfigRom*       m_configRom; 
     121     
    119122    signed int       m_motu_model; 
    120123    int              m_nodeId; 
  • branches/libfreebob-2.0/src/rme/rme_avdevice.cpp

    r332 r336  
    9696/* ======================================================================= */ 
    9797 
    98 RmeDevice::RmeDevice( Ieee1394Service& ieee1394service, 
    99                         int nodeId, 
    100                         int verboseLevel ) 
    101     : m_1394Service( &ieee1394service ) 
     98RmeDevice::RmeDevice( std::auto_ptr< ConfigRom >( configRom ), 
     99                    Ieee1394Service& ieee1394service, 
     100                    int nodeId, 
     101                    int verboseLevel ) 
     102    : m_configRom( configRom ) 
     103    , m_1394Service( &ieee1394service ) 
    102104    , m_rme_model( RME_MODEL_NONE ) 
    103105    , m_nodeId( nodeId ) 
     
    111113     
    112114{ 
    113     if ( m_verboseLevel ) { 
    114         setDebugLevel( DEBUG_LEVEL_VERBOSE ); 
    115     } 
     115    setDebugLevel( verboseLevel ); 
     116     
    116117    debugOutput( DEBUG_LEVEL_VERBOSE, "Created Rme::RmeDevice (NodeID %d)\n", 
    117118                 nodeId ); 
    118     m_configRom = new ConfigRom( m_1394Service, m_nodeId ); 
    119     m_configRom->initialize(); 
    120119 
    121120} 
     
    136135                                debugOutput(DEBUG_LEVEL_VERBOSE, "Could not free send iso channel %d\n", m_iso_send_channel); 
    137136        } 
    138         delete m_configRom; 
     137 
    139138} 
    140139 
     
    143142{ 
    144143    return *m_configRom; 
     144} 
     145 
     146struct VendorModelEntry { 
     147    unsigned int vendor_id; 
     148    unsigned int model_id; 
     149}; 
     150 
     151static VendorModelEntry supportedDeviceList[] = 
     152{ 
     153    {0x0001, 0x00000a35},  // RME Fireface-800 
     154 
     155}; 
     156 
     157bool 
     158RmeDevice::probe( ConfigRom& configRom ) 
     159{ 
     160    unsigned int vendorId = configRom.getNodeVendorId(); 
     161    unsigned int modelId = configRom.getModelId(); 
     162 
     163    for ( unsigned int i = 0; 
     164          i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) ); 
     165          ++i ) 
     166    { 
     167        if ( ( supportedDeviceList[i].vendor_id == vendorId ) 
     168             && ( supportedDeviceList[i].model_id == modelId )  
     169           ) 
     170        { 
     171            return true; 
     172        } 
     173    } 
     174 
     175    return false; 
    145176} 
    146177 
  • branches/libfreebob-2.0/src/rme/rme_avdevice.h

    r332 r336  
    4343    }; 
    4444 
    45     RmeDevice( Ieee1394Service& ieee1394Service, 
     45    RmeDevice( std::auto_ptr<ConfigRom>( configRom ), 
     46              Ieee1394Service& ieee1394Service, 
    4647                  int nodeId, 
    4748                  int verboseLevel ); 
    4849    virtual ~RmeDevice(); 
    4950 
     51    static bool probe( ConfigRom& configRom ); 
    5052    virtual bool discover(); 
    5153    virtual ConfigRom& getConfigRom() const; 
     
    7577   
    7678protected: 
     79    std::auto_ptr<ConfigRom>( m_configRom ); 
    7780    Ieee1394Service* m_1394Service; 
    78     ConfigRom*       m_configRom; 
     81     
    7982    signed int       m_rme_model; 
    8083    int              m_nodeId; 
  • branches/libfreebob-2.0/src/xmlparser.c

    r153 r336  
    177177        ConnectionSpecParseNode( "Dimension", dimension ); 
    178178        ConnectionSpecParseNode( "Samplerate", samplerate ); 
    179         ConnectionSpecParseNode( "IsoChannel", iso_channel ); 
     179        ConnectionSpecParseNode( "IsoChannel", iso_channel ); 
     180        ConnectionSpecParseNode( "Master", is_master ); 
    180181 
    181182        if ( !xmlStrcmp( cur->name, (const xmlChar*) "Streams" ) ) { 
     
    673674    } 
    674675 
    675     if ( xmlStrcmp( base->name, (const xmlChar*) "FreeBobConnectionInfo") ) { 
     676    if ( xmlStrcmp( base->name, (const xmlChar*) "FreeBoBConnectionInfo") ) { 
    676677        fprintf( stderr, 
    677678                 "document of the wrong type, root node " 
    678                  "!= FreeBobConnectionInfo\n" ); 
     679                 "!= FreeBoBConnectionInfo\n" ); 
    679680        return 0; 
    680681    } 
     
    712713        int nb_devices=freebob_xmlparse_get_nb_devices(doc, base); 
    713714                 
    714       fprintf( stderr, 
     715/*    fprintf( stderr, 
    715716                 "Nb devices %d\n", 
    716                  nb_devices ); 
     717                 nb_devices );*/ 
    717718                                         
    718719        for(device_nr=0;device_nr<nb_devices;device_nr++) { 
     
    754755    } 
    755756 
    756     if ( xmlStrcmp( base->name, (const xmlChar*) "FreeBobConnectionInfo") ) { 
     757    if ( xmlStrcmp( base->name, (const xmlChar*) "FreeBoBConnectionInfo") ) { 
    757758        fprintf( stderr, 
    758759                 "document of the wrong type, root node " 
    759                  "!= FreeBobConnectionInfo\n" ); 
     760                 "!= FreeBoBConnectionInfo\n" ); 
    760761        return 0; 
    761762    } 
  • branches/libfreebob-2.0/tests/Makefile.am

    r262 r336  
    11# Makefile.am - Makefile template 
    2 # Copyright (C) 2005 by Daniel Wagner. 
     2# Copyright (C) 2005,06 by Daniel Wagner. 
    33# 
    4 # This file is part of FreeBob
     4# This file is part of FreeBoB
    55# 
    6 # FreeBob is free software; you can redistribute it and/or modify 
     6# FreeBoB is free software; you can redistribute it and/or modify 
    77# it under the terms of the GNU General Public License as published by 
    88# the Free Software Foundation; either version 2 of the License, or 
    99# (at your option) any later version. 
    10 # FreeBob is distributed in the hope that it will be useful, 
     10# FreeBoB is distributed in the hope that it will be useful, 
    1111# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1313# GNU General Public License for more details. 
    1414# You should have received a copy of the GNU General Public License 
    15 # along with FreeBob; if not, write to the Free Software 
     15# along with FreeBoB; if not, write to the Free Software 
    1616# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1717 
     
    2121        $(LIBAVC1394_CFLAGS) 
    2222 
    23 # noinst_PROGRAMS = # test-freebob test-extplugcmd freebob-server 
    24 noinst_PROGRAMS = test-freebob 
     23noinst_PROGRAMS = test-freebob test-extplugcmd test-fw410 freebob-server \ 
     24        test-volume test-mixer 
    2525noinst_HEADERS =  
    2626 
     
    2828test_freebob_LDADD   = $(top_builddir)/src/libfreebob.la \ 
    2929        $(LIBXML_LIBS) $(LIBAVC1394_LIBS) $(LIBIEC61883_LIBS) 
    30 #  
    31 # test_extplugcmd_SOURCES = test-extplugcmd.cpp 
    32 # test_extplugcmd_LDADD = $(top_builddir)/src/libfreebobavc/libfreebobavc.la \ 
    33 #       $(LIBAVC1394_LIBS) 
    34 #  
    35 # freebob_server_SOURCES = freebob-server.c 
    36 # freebob_server_LDADD   = $(top_builddir)/src/libfreebob.la $(LIBXML_LIBS) \ 
    37 #       $(LIBAVC1394_LIBS) $(LIBIEC61883_LIBS) -lrom1394 
     30 
     31test_extplugcmd_SOURCES = test-extplugcmd.cpp 
     32test_extplugcmd_LDADD = $(top_builddir)/src/libfreebob.la \ 
     33        $(LIBAVC1394_LIBS) 
     34 
     35test_volume_SOURCES = test-volume.cpp 
     36test_volume_LDADD = $(top_builddir)/src/libfreebob.la \ 
     37        $(LIBAVC1394_LIBS) 
     38 
     39test_mixer_SOURCES = test-mixer.cpp 
     40test_mixer_LDADD = $(top_builddir)/src/libfreebob.la \ 
     41        $(LIBAVC1394_LIBS) 
     42 
     43test_fw410_SOURCES = test-fw410.cpp 
     44test_fw410_LDADD   = $(LIBAVC1394_LIBS) $(LIBIEC61883_LIBS) -lrom1394 
     45 
     46freebob_server_SOURCES = freebob-server.c 
     47freebob_server_LDADD   = $(top_builddir)/src/libfreebob.la $(LIBXML_LIBS) \ 
     48        $(LIBAVC1394_LIBS) $(LIBIEC61883_LIBS) -lrom1394 
    3849 
    3950 
    40 # TESTS_ENVIRONMENT 
     51#TESTS_ENVIRONMENT 
    4152TEST = test-freebob 
  • branches/libfreebob-2.0/tests/test-extplugcmd.cpp

    r155 r336  
    22 * Copyright (C) 2005,06 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
  • branches/libfreebob-2.0/tests/test-freebob.c

    r199 r336  
    22 * Copyright (C) 2005 by Daniel Wagner 
    33 * 
    4  * This file is part of FreeBob
     4 * This file is part of FreeBoB
    55 * 
    6  * FreeBob is free software; you can redistribute it and/or modify 
     6 * FreeBoB is free software; you can redistribute it and/or modify 
    77 * it under the terms of the GNU General Public License as published by 
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  * FreeBob is distributed in the hope that it will be useful, 
     10 * FreeBoB is distributed in the hope that it will be useful, 
    1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     
    1414 * 
    1515 * You should have received a copy of the GNU General Public License 
    16  * along with FreeBob; if not, write to the Free Software 
     16 * along with FreeBoB; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    1818 * MA 02111-1307 USA. 
     
    2929#include <string.h> 
    3030 
     31#define FREEBOB_BOUNCE_SERVER_GETXMLDESCRIPTION_CMD 
     32#define AVC1394_SUBUNIT_TYPE_FREEBOB_BOUNCE_SERVER      0x0D 
     33 
    3134const char *argp_program_version = PACKAGE_STRING; 
    3235const char *argp_program_bug_address = PACKAGE_BUGREPORT; 
    3336 
    3437// Program documentation. 
    35 static char doc[] = "FreeBob -- a driver for BeBob devices (test application)\n\n" 
     38static char doc[] = "FreeBoB -- a driver for BeBoB devices (test application)\n\n" 
    3639                    "OPERATION: discover\n" 
    3740                    "           odisocver\n" 
     
    260263         
    261264        if(arguments.node_id_set) { 
    262             if (! freebob_set_samplerate(fb_handle, arguments.node_id, samplerate)) { 
    263                fprintf( stderr, "Could not set samplerate\n" ); 
    264                freebob_destroy_handle( fb_handle ); 
    265                return -1; 
    266            } 
     265            if (freebob_set_samplerate(fb_handle, arguments.node_id, samplerate) != 0) { 
     266            fprintf( stderr, "Could not set samplerate\n" ); 
     267            freebob_destroy_handle( fb_handle ); 
     268            return -1; 
     269        } 
    267270 
    268271        } else { 
     
    273276                         
    274277            for(i=0;i<devices_on_bus;i++) { 
    275                int node_id=freebob_get_device_node_id(fb_handle, i); 
    276                printf("  set samplerate for device = %d, node = %d\n", i, node_id); 
    277                                  
    278                if (! freebob_set_samplerate(fb_handle, node_id, samplerate)) { 
    279                    fprintf( stderr, "Could not set samplerate\n" ); 
    280                    freebob_destroy_handle( fb_handle ); 
    281                    return -1; 
    282                
    283            } 
     278            int node_id=freebob_get_device_node_id(fb_handle, i); 
     279            printf("  set samplerate for device = %d, node = %d\n", i, node_id); 
     280 
     281            if (freebob_set_samplerate(fb_handle, node_id, samplerate) != 0) { 
     282                fprintf( stderr, "Could not set samplerate\n" ); 
     283                freebob_destroy_handle( fb_handle ); 
     284                return -1; 
     285           
     286        } 
    284287 
    285288        }