Changeset 15
- Timestamp:
- 10/01/04 15:09:00 (18 years ago)
- Files:
-
- trunk/freebob/configure.ac (modified) (3 diffs)
- trunk/freebob/src/cmhandler.cpp (modified) (2 diffs)
- trunk/freebob/src/cmhandler.h (modified) (1 diff)
- trunk/freebob/src/ieee1394service.cpp (modified) (8 diffs)
- trunk/freebob/src/ieee1394service.h (modified) (4 diffs)
- trunk/freebob/src/streamprocess.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/freebob/configure.ac
r14 r15 23 23 AM_INIT_AUTOMAKE 24 24 AM_MAINTAINER_MODE 25 AC_CONFIG_SRCDIR([src/ freebob.cpp])25 AC_CONFIG_SRCDIR([src/main.cpp]) 26 26 AC_CONFIG_HEADER([config.h]) 27 27 AC_GNU_SOURCE 28 AC_LANG(C++) 28 29 29 30 maintainer_mode=${enable_maintainer_mode-no} … … 85 86 86 87 # Checks for library functions. 87 PKG_CHECK_MODULES(LIBSIGC, sigc++-2.0 >= 2.0.3)88 88 PKG_CHECK_MODULES(LIBRAW1394, libraw1394 >= 0.10) 89 89 PKG_CHECK_MODULES(LIBIEC61883, libiec61883 >= 0.1.0) 90 AC_CHECK_HEADER(boost/signals.hpp, , [ 91 AC_MSG_ERROR([cannot find boost headers. Make sure boost (http://www.boost.org) is installed; if the headers are in a non-standard location, set the CPPFLAGS environment variable to contain -I<headerdir>])]) 92 AC_HAVE_LIBRARY(boost_signals, , [ 93 AC_MSG_ERROR([cannot find boost libraries. Make sure boost (http://www.boost.org) is installed; if the libraries are in a non-standard location, set the LDFLAGS environment variable to contain -L<librarydir>])]) 94 90 95 91 96 AC_SUBST([LIBSIGC_CFLAGS]) … … 109 114 Source directory: $srcdir 110 115 Installation prefix: $prefix 111 C compiler: $CC $XTRA_CFLAGS $WARN_CFLAGS $CFLAGS112 116 C++ compiler: $CXX $XTRA_CXXFLAGS $WARN_CXXFLAGS $CXXFLAGS 113 117 ]) trunk/freebob/src/cmhandler.cpp
r14 r15 32 32 CMHandler::~CMHandler() 33 33 { 34 if ( m_pIeee1394Service ) { 35 m_pIeee1394Service->shutdown(); 36 } 37 m_pInstance = 0; 34 38 } 35 39 … … 54 58 } 55 59 60 void 61 CMHandler::shutdown() 62 { 63 delete this; 64 } 65 56 66 CMHandler* 57 67 CMHandler::instance() trunk/freebob/src/cmhandler.h
r14 r15 33 33 34 34 FBReturnCodes initialize(); 35 void shutdown(); 35 36 36 37 static CMHandler* instance(); trunk/freebob/src/ieee1394service.cpp
r14 r15 20 20 21 21 #include <errno.h> 22 #include <libavc1394/avc1394.h> 23 #include <libavc1394/avc1394_vcr.h> 22 24 #include "ieee1394service.h" 23 25 #include "debugmodule.h" … … 36 38 { 37 39 stopRHThread(); 38 if ( !m_handle ) { 40 41 if ( m_rhHandle ) { 42 raw1394_destroy_handle( m_rhHandle ); 43 m_rhHandle = 0; 44 } 45 46 if ( m_handle ) { 39 47 raw1394_destroy_handle( m_handle ); 40 48 m_handle = 0; 41 49 } 50 51 m_pInstance = 0; 42 52 } 43 53 … … 46 56 { 47 57 if ( !m_bInitialised ) { 58 m_rhHandle = raw1394_new_handle(); 48 59 m_handle = raw1394_new_handle(); 49 if ( !m_ handle ) {60 if ( !m_rhHandle || !m_handle ) { 50 61 if ( !errno ) { 51 62 fprintf( stderr, "libraw1394 not compatible.\n" ); … … 60 71 // to be able to retrieve the instance in the pure C bus reset 61 72 // call back function. 62 raw1394_set_userdata( m_handle, this ); 73 raw1394_set_userdata( m_rhHandle, this ); 74 75 if ( raw1394_set_port( m_rhHandle, m_iPort ) < 0 ) { 76 perror( "Could not set port" ); 77 return eFBRC_Setting1394PortFailed; 78 } 63 79 64 80 if ( raw1394_set_port( m_handle, m_iPort ) < 0 ) { … … 67 83 } 68 84 69 raw1394_set_bus_reset_handler( m_ handle, this->resetHandler );85 raw1394_set_bus_reset_handler( m_rhHandle, this->resetHandler ); 70 86 71 87 startRHThread(); … … 77 93 } 78 94 95 void 96 Ieee1394Service::shutdown() 97 { 98 delete this; 99 } 100 79 101 Ieee1394Service* 80 102 Ieee1394Service::instance() … … 89 111 Ieee1394Service::discoveryDevices() 90 112 { 113 //scan bus 114 int iNodeCount = raw1394_get_nodecount( m_handle ); 115 for ( int iNodeId = 0; iNodeId < iNodeCount; ++iNodeId ) { 116 rom1394_directory romDir; 117 rom1394_get_directory( m_handle, iNodeId, &romDir ); 118 printRomDirectory( iNodeId, &romDir ); 119 120 switch (rom1394_get_node_type( &romDir )) { 121 case ROM1394_NODE_TYPE_UNKNOWN: 122 debugPrint (DEBUG_LEVEL_INFO, 123 "Node %d has node type UNKNOWN\n", iNodeId); 124 break; 125 case ROM1394_NODE_TYPE_DC: 126 debugPrint (DEBUG_LEVEL_INFO, 127 "Node %d has node type DC\n", iNodeId); 128 break; 129 case ROM1394_NODE_TYPE_AVC: 130 debugPrint (DEBUG_LEVEL_INFO, 131 "Node %d has node type AVC\n", iNodeId); 132 printAvcUnitInfo( iNodeId ); 133 134 if ( avc1394_check_subunit_type( m_handle, iNodeId, 135 AVC1394_SUBUNIT_TYPE_AUDIO ) ) { 136 // XXX 137 // create avcDevice which discovers itself :) 138 } 139 break; 140 case ROM1394_NODE_TYPE_SBP2: 141 debugPrint( DEBUG_LEVEL_INFO, 142 "Node %d has node type SBP2\n", iNodeId); 143 break; 144 case ROM1394_NODE_TYPE_CPU: 145 debugPrint( DEBUG_LEVEL_INFO, 146 "Node %d has node type CPU\n", iNodeId); 147 break; 148 default: 149 debugPrint( DEBUG_LEVEL_INFO, 150 "No matching node type found for node %d\n", iNodeId); 151 } 152 } 91 153 return eFBRC_Success; 154 } 155 156 void 157 Ieee1394Service::printAvcUnitInfo( int iNodeId ) 158 { 159 printf( "AVC: video monitor?......%s\n", 160 avc1394_check_subunit_type( m_handle, iNodeId, 161 AVC1394_SUBUNIT_TYPE_VIDEO_MONITOR ) ? 162 "yes":"no" ); 163 printf( "AVC: audio?..............%s\n", 164 avc1394_check_subunit_type( m_handle, iNodeId, 165 AVC1394_SUBUNIT_TYPE_AUDIO ) ? 166 "yes":"no" ); 167 printf( "AVC; printer?............%s\n", 168 avc1394_check_subunit_type( m_handle, iNodeId, 169 AVC1394_SUBUNIT_TYPE_PRINTER ) ? 170 "yes":"no" ); 171 printf( "AVC: disk recorder?......%s\n", 172 avc1394_check_subunit_type( m_handle, iNodeId, 173 AVC1394_SUBUNIT_TYPE_DISC_RECORDER ) ? 174 "yes":"no" ); 175 printf( "AVC: video recorder?.....%s\n", 176 avc1394_check_subunit_type( m_handle, iNodeId, 177 AVC1394_SUBUNIT_TYPE_TAPE_RECORDER ) ? 178 "yes":"no" ); 179 printf( "AVC: vcr?................%s\n", 180 avc1394_check_subunit_type( m_handle, iNodeId, 181 AVC1394_SUBUNIT_TYPE_VCR ) ? 182 "yes":"no" ); 183 printf( "AVC: tuner?..............%s\n", 184 avc1394_check_subunit_type( m_handle, iNodeId, 185 AVC1394_SUBUNIT_TYPE_TUNER ) ? 186 "yes":"no" ); 187 printf( "AVC: CA?.................%s\n", 188 avc1394_check_subunit_type( m_handle, iNodeId, 189 AVC1394_SUBUNIT_TYPE_CA ) ? 190 "yes":"no" ); 191 printf( "AVC: video camera?.......%s\n", 192 avc1394_check_subunit_type( m_handle, iNodeId, 193 AVC1394_SUBUNIT_TYPE_VIDEO_CAMERA ) ? 194 "yes":"no" ); 195 printf( "AVC: panel?..............%s\n", 196 avc1394_check_subunit_type(m_handle, iNodeId, 197 AVC1394_SUBUNIT_TYPE_PANEL ) ? 198 "yes":"no" ); 199 printf( "AVC: camera storage?.....%s\n", 200 avc1394_check_subunit_type( m_handle, iNodeId, 201 AVC1394_SUBUNIT_TYPE_CAMERA_STORAGE ) ? 202 "yes":"no" ); 203 printf( "AVC: bulletin board?.....%s\n", 204 avc1394_check_subunit_type( m_handle, iNodeId, 205 AVC1394_SUBUNIT_TYPE_BULLETIN_BOARD ) ? 206 "yes":"no" ); 207 printf( "AVC: vendor specificr?...%s\n", 208 avc1394_check_subunit_type( m_handle, iNodeId, 209 AVC1394_SUBUNIT_TYPE_VENDOR_UNIQUE ) ? 210 "yes":"no" ); 211 printf( "AVC: extended?...........%s\n", 212 avc1394_check_subunit_type( m_handle, iNodeId, 213 AVC1394_SUBUNIT_TYPE_EXTENDED ) ? 214 "yes":"no" ); 215 printf( "AVC: unit?...............%s\n", 216 avc1394_check_subunit_type( m_handle, iNodeId, 217 AVC1394_SUBUNIT_TYPE_UNIT ) ? 218 "yes":"no" ); 219 } 220 221 void 222 Ieee1394Service::printRomDirectory( int iNodeId, rom1394_directory* pRomDir ) 223 { 224 int iBusInfoBlockLength 225 = rom1394_get_bus_info_block_length( m_handle, iNodeId ); 226 int iBusId = rom1394_get_bus_id( m_handle, iNodeId ); 227 octlet_t oGuid = rom1394_get_guid( m_handle, iNodeId ); 228 rom1394_bus_options busOptions; 229 rom1394_get_bus_options( m_handle, iNodeId, &busOptions ); 230 231 printf ( "\nNode %d: \n", iNodeId); 232 printf ( "-------------------------------------------------\n"); 233 printf ("bus info block length = %d\n", iBusInfoBlockLength); 234 printf ("bus id = 0x%08x\n", iBusId); 235 printf ("bus options:\n"); 236 printf (" isochronous resource manager capable: %d\n", busOptions.irmc); 237 printf (" cycle master capable : %d\n", busOptions.cmc); 238 printf (" isochronous capable : %d\n", busOptions.isc); 239 printf (" bus manager capable : %d\n", busOptions.bmc); 240 printf (" cycle master clock accuracy : %d ppm\n", busOptions.cyc_clk_acc); 241 printf (" maximum asynchronous record size : %d bytes\n", busOptions.max_rec); 242 printf ("GUID: 0x%08x%08x\n", (quadlet_t) (oGuid>>32), 243 (quadlet_t) (oGuid & 0xffffffff)); 244 printf ("directory:\n"); 245 printf (" node capabilities : 0x%08x\n", pRomDir->node_capabilities); 246 printf (" vendor id : 0x%08x\n", pRomDir->vendor_id); 247 printf (" unit spec id : 0x%08x\n", pRomDir->unit_spec_id); 248 printf (" unit software version: 0x%08x\n", pRomDir->unit_sw_version); 249 printf (" model id : 0x%08x\n", pRomDir->model_id); 250 printf (" textual leaves : %s\n", pRomDir->label); 92 251 } 93 252 … … 140 299 141 300 while (true) { 142 raw1394_loop_iterate (pIeee1394Service->m_ handle);301 raw1394_loop_iterate (pIeee1394Service->m_rhHandle); 143 302 pthread_testcancel (); 144 303 } trunk/freebob/src/ieee1394service.h
r14 r15 23 23 #include <libraw1394/raw1394.h> 24 24 #include <libavc1394/rom1394.h> 25 #include < sigc++/sigc++.h>25 #include <boost/signals.hpp> 26 26 27 27 #include "freebob.h" 28 28 29 typedef unsigned int GenerationT; 29 /* XXX: add those to avc1394.h */ 30 #define AVC1394_SUBUNIT_TYPE_AUDIO (1 <<19) 31 #define AVC1394_SUBUNIT_TYPE_PRINTER (2 <<19) 32 #define AVC1394_SUBUNIT_TYPE_CA (6 <<19) 33 #define AVC1394_SUBUNIT_TYPE_PANEL (9 <<19) 34 #define AVC1394_SUBUNIT_TYPE_BULLETIN_BOARD (0xA <<19) 35 #define AVC1394_SUBUNIT_TYPE_CAMERA_STORAGE (0xB <<19) 30 36 31 37 class Ieee1394Service { … … 35 41 36 42 FBReturnCodes initialize(); 43 void shutdown(); 37 44 38 45 static Ieee1394Service* instance(); … … 44 51 * If the count is increased a bus reset has occurred. 45 52 */ 46 sigc::signal<void,GenerationT>sigGenerationCount;53 boost::signal<void (unsigned int)>sigGenerationCount; 47 54 48 55 protected: … … 53 60 void stopRHThread(); 54 61 static void* rHThread( void* arg ); 62 63 void printAvcUnitInfo( int iNodeId ); 64 void printRomDirectory( int iNodeId, rom1394_directory* pRomDir ); 55 65 private: 56 66 static Ieee1394Service* m_pInstance; 57 67 raw1394handle_t m_handle; 68 raw1394handle_t m_rhHandle; 58 69 int m_iPort; 59 70 bool m_bInitialised; trunk/freebob/src/streamprocess.cpp
r14 r15 55 55 printf( "\n" ); 56 56 57 m_pCMHandler->shutdown(); 57 58 }