Changeset 25
- Timestamp:
- 11/27/04 08:55:32 (18 years ago)
- Files:
-
- trunk/freebob/src/avdescriptor.cpp (modified) (3 diffs)
- trunk/freebob/src/avdescriptor.h (modified) (2 diffs)
- trunk/freebob/src/avmusicstatusdescriptor.cpp (modified) (3 diffs)
- trunk/freebob/src/avmusicstatusdescriptor.h (modified) (2 diffs)
- trunk/freebob/src/ieee1394service.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/freebob/src/avdescriptor.cpp
r24 r25 42 42 bOpen=false; 43 43 iAccessType=0; 44 bValid=false; // don't know yet what I'm going to do with this in the generic descriptor 44 45 } 45 46 … … 248 249 if (((response[0] & 0xFF000000)==AVC1394_RESPONSE_NOT_IMPLEMENTED) || ((response[1] & 0xFF000000)==0x04)) { 249 250 fprintf(stderr,"Descriptor not present.\n"); 251 bValid=false; 250 252 return false; 251 253 } … … 263 265 return bLoaded; 264 266 } 267 268 bool AvDescriptor::isValid() { 269 return bValid; 270 } 271 265 272 266 273 unsigned int AvDescriptor::getLength() { trunk/freebob/src/avdescriptor.h
r21 r25 41 41 bool isOpen(); 42 42 bool canWrite(); 43 bool isValid(); 43 44 44 45 protected: … … 48 49 bool bLoaded; 49 50 bool bOpen; 51 bool bValid; 50 52 unsigned int iAccessType; 51 53 unsigned int iLength; trunk/freebob/src/avmusicstatusdescriptor.cpp
r24 r25 21 21 #include "avdevice.h" 22 22 #include "avdescriptor.h" 23 #include "avmusicidentifierdescriptor.h" 23 24 #include "avmusicstatusdescriptor.h" 25 #include "avinfoblock.h" 26 #include "avgeneralmusicstatusinfoblock.h" 27 #include "avnameinfoblock.h" 28 #include "avaudioinfoblock.h" 29 #include "avmidiinfoblock.h" 30 #include "avaudiosyncinfoblock.h" 31 #include "avsourcepluginfoblock.h" 32 #include "avoutputplugstatusinfoblock.h" 24 33 25 34 AvMusicStatusDescriptor::AvMusicStatusDescriptor(AvDevice *parent) : AvDescriptor(parent, AVC1394_SUBUNIT_TYPE_MUSIC | AVC1394_SUBUNIT_ID_0,0x80) { … … 38 47 39 48 if (!(this->AvDescriptor::isOpen())) { 40 fprintf(stderr,"AvMusicStatusDescriptor: Opening descriptor...\n");49 debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: Opening descriptor...\n"); 41 50 this->AvDescriptor::OpenReadOnly(); 42 51 if (!(this->AvDescriptor::isOpen()) ) { 43 52 fprintf(stderr,"AvMusicStatusDescriptor: Failed!\n"); 53 bValid=false; 44 54 return; 45 55 } … … 47 57 48 58 if (!(this->AvDescriptor::isLoaded())) { 49 fprintf(stderr,"AvMusicStatusDescriptor: Loading descriptor...\n");59 debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: Loading descriptor...\n"); 50 60 this->AvDescriptor::Load(); 51 61 if (!(this->AvDescriptor::isLoaded())) { 52 62 fprintf(stderr,"AvMusicStatusDescriptor: Failed!\n"); 63 bValid=false; 53 64 return; 54 65 } 55 66 } 56 67 57 fprintf(stderr,"AvMusicStatusDescriptor: \n"); 58 // PP: calculate the offset to accomodate for the presence of root lists [not implemented] 68 unsigned int offset=0; // update offset when beginning at a new table in the specs for easy reading 69 cGeneralMusicInfoBlock=NULL; 70 cOutputPlugStatusInfoBlock=NULL; 59 71 60 //int offset=2; // update offset when beginning at a new table in the specs for easy reading 72 debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: Creating AvGeneralMusicStatusInfoBlock... (offset=0x%04X)\n",offset); 73 cGeneralMusicInfoBlock=new AvGeneralMusicInfoBlock(this,offset); 74 if (!(cGeneralMusicInfoBlock) || !(cGeneralMusicInfoBlock->isValid())) { 75 debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: AvGeneralMusicStatusInfoBlock not found!\n"); 76 bValid=false; 77 return; 78 } 79 debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: AvGeneralMusicStatusInfoBlock found: length=0x%04X\n",cGeneralMusicInfoBlock->getLength()); 61 80 62 // start parsing the optional capability stuff 81 offset += cGeneralMusicInfoBlock->getLength()+2; 82 83 84 debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: Creating AvOutputPlugStatusInfoBlock... (offset=0x%04X)\n",offset); 85 cOutputPlugStatusInfoBlock=new AvOutputPlugStatusInfoBlock(this,offset); 86 if (!(cOutputPlugStatusInfoBlock) || !(cOutputPlugStatusInfoBlock->isValid())) { 87 debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: AvOutputPlugStatusInfoBlock not found!\n"); 88 bValid=false; 89 return; 90 } 91 debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: AvOutputPlugStatusInfoBlock found: length=0x%04X\n",cOutputPlugStatusInfoBlock->getLength()); 92 93 offset += cOutputPlugStatusInfoBlock->getLength()+2; 94 95 // start parsing the optional infoblock(s) 96 AvInfoBlock *tmpInfoBlock = NULL; 97 debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: Parsing optional infoblocks...\n"); 98 99 while (offset < getLength()) { 100 debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: Optional block found...\n"); 101 tmpInfoBlock = new AvInfoBlock(this,offset); 102 if (tmpInfoBlock && tmpInfoBlock->isValid()) { 103 debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: Optional block of type 0x%04X with length 0x%04X found\n",tmpInfoBlock->getType(), tmpInfoBlock->getLength()); 104 105 offset += tmpInfoBlock->getLength()+2; 106 } else { 107 debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: error parsing optional infoblock\n"); 108 bValid=false; 109 return; 110 } 111 112 } 113 63 114 64 115 } trunk/freebob/src/avmusicstatusdescriptor.h
r21 r25 31 31 32 32 33 class AvGeneralMusicInfoBlock; 34 class AvOutputPlugStatusInfoBlock; 35 33 36 class AvMusicStatusDescriptor : public AvDescriptor { 34 37 public: … … 39 42 40 43 protected: 44 AvGeneralMusicInfoBlock *cGeneralMusicInfoBlock; 45 AvOutputPlugStatusInfoBlock *cOutputPlugStatusInfoBlock; 41 46 42 47 private: trunk/freebob/src/ieee1394service.cpp
r24 r25 223 223 debugPrint (DEBUG_LEVEL_INFO, " Created...\n"); 224 224 testdesc_mid2->printCapabilities(); 225 225 #if 0 226 226 // test the AvInfoBlock 227 227 debugPrint (DEBUG_LEVEL_INFO, " Trying to create an AvInfoBlock...\n"); … … 312 312 313 313 delete testblock8; 314 314 #endif 315 315 debugPrint (DEBUG_LEVEL_INFO, " Deleting AvMusicStatusDescriptor...\n"); 316 316 delete testdesc_mid2;