Changeset 46

Show
Ignore:
Timestamp:
01/10/05 14:56:42 (19 years ago)
Author:
wagi
Message:

- Debug output level lowered
- Registering/unregistering AvDevice? instance at pool
- Exchanged more of the shift and & stuff with the AVC1394_GET_RESPONSE_OPERAND

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/freebob/src/avdevice.cpp

    r43 r46  
    2222#include <libavc1394/avc1394_vcr.h> 
    2323#include "avdevice.h" 
     24#include "avdevicepool.h" 
    2425#include "avdevicesubunit.h" 
    2526#include "avdeviceaudiosubunit.h" 
    2627#include "avdevicemusicsubunit.h" 
     28 
     29#undef AVC1394_GET_RESPONSE_OPERAN 
     30#define AVC1394_GET_RESPONSE_OPERAND(x, n) (((x) & (0xFF000000 >> (((n)%4)*8))) >> (((3-(n))%4)*8)) 
    2731 
    2832AvDevice::AvDevice(octlet_t oGuid) 
     
    4145    , m_iNbExtSourcePlugs( 0 ) 
    4246{ 
    43     setDebugLevel( DEBUG_LEVEL_ALL ); 
     47    setDebugLevel( DEBUG_LEVEL_MODERATE ); 
     48    AvDevicePool::instance()->registerAvDevice( this ); 
     49
     50 
     51 
     52AvDevice::~AvDevice() 
     53
     54    vector<AvDeviceSubunit *>::iterator it; 
     55    for( it = cSubUnits.begin(); it != cSubUnits.end(); it++ ) { 
     56        delete *it; 
     57    } 
     58 
     59    if ( m_handle ) { 
     60        raw1394_destroy_handle( m_handle ); 
     61        m_handle = 0; 
     62    } 
     63    AvDevicePool::instance()->unregisterAvDevice( this ); 
    4464} 
    4565 
     
    6888{ 
    6989    return m_bInitialised; 
    70 } 
    71  
    72 AvDevice::~AvDevice() 
    73 { 
    74     vector<AvDeviceSubunit *>::iterator it; 
    75     for( it = cSubUnits.begin(); it != cSubUnits.end(); it++ ) { 
    76         delete *it; 
    77     } 
    78  
    79     if ( m_handle ) { 
    80         raw1394_destroy_handle( m_handle ); 
    81         m_handle = 0; 
    82     } 
    8390} 
    8491 
     
    135142    response = request; 
    136143    if ( response ) { 
    137  
    138144        m_iNbIsoDestinationPlugs 
    139145            = AVC1394_GET_RESPONSE_OPERAND( response[1], 0 ); 
     
    144150        m_iNbExtSourcePlugs 
    145151            = AVC1394_GET_RESPONSE_OPERAND( response[1], 3 ); 
    146  
    147         /* 
    148         m_iNbIsoDestinationPlugs = (unsigned char) ((response[1]>>24) & 0xff); 
    149         m_iNbIsoSourcePlugs = (unsigned char) ((response[1]>>16) & 0xff); 
    150         m_iNbExtDestinationPlugs = (unsigned char) ((response[1]>>8) & 0xff); 
    151         m_iNbExtSourcePlugs = (unsigned char) ((response[1]>>0) & 0xff); 
    152         */ 
    153152    } 
    154153 
     
    159158                 | 0x01; 
    160159    request[1] = 0xFFFFFFFF; 
    161     response = avcExecuteTransaction(request, 2, 2); 
    162     if (response != NULL) { 
    163         m_iNbAsyncDestinationPlugs= (unsigned char) ((response[1]>>24) & 0xff); 
    164         m_iNbAsyncSourcePlugs= (unsigned char) ((response[1]>>16) & 0xff); 
     160    response = avcExecuteTransaction( request, 2, 2 ); 
     161    if ( response != NULL ) { 
     162        m_iNbAsyncDestinationPlugs 
     163            = AVC1394_GET_RESPONSE_OPERAND( response[1], 0 ); 
     164        m_iNbAsyncSourcePlugs 
     165            = AVC1394_GET_RESPONSE_OPERAND( response[1], 1 ); 
    165166    } 
    166167