Changeset 24
- Timestamp:
- 11/27/04 08:21:40 (19 years ago)
- Files:
-
- trunk/freebob/src/avdescriptor.cpp (modified) (3 diffs)
- trunk/freebob/src/avmusicstatusdescriptor.cpp (modified) (1 diff)
- trunk/freebob/src/avnameinfoblock.cpp (modified) (2 diffs)
- trunk/freebob/src/avoutputplugstatusinfoblock.cpp (modified) (1 diff)
- trunk/freebob/src/avsourcepluginfoblock.cpp (modified) (2 diffs)
- trunk/freebob/src/avsourcepluginfoblock.h (modified) (1 diff)
- trunk/freebob/src/ieee1394service.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/freebob/src/avdescriptor.cpp
r22 r24 168 168 aContents=new unsigned char[iLength]; 169 169 170 /* there is a gap in the read data, because of the two bytes 171 * that are before the third quadlet (why did 1394TA do that?) 172 * 173 * proposed solution: 174 * 1) the first read is OK, because the length of the descriptor is in these two bytes, 175 * so execute a read from address 0 with length=iLength 176 * 2) process the bytes starting from response[3] 177 * 3) the next reads should start from the end of the previous read minus 2. this way we 178 * can discard these two problem bytes, because they are already read in the previous 179 * run. 180 */ 181 182 // first read 183 if(bytes_read<iLength) { 184 fprintf(stderr,"."); 185 // apparently the lib modifies the request, so redefine it completely 186 request[0] = AVC1394_CTYPE_CONTROL | qTarget 187 | AVC1394_COMMAND_READ_DESCRIPTOR | (iType & 0xFF); 188 // the amount of bytes we want to read is: 189 // total descriptor length + 2 bytes of the descriptor length field (i.e. the overlap bytes for this read) 190 request[1] = 0xFFFF0000 | (iLength)&0xFFFF; 191 request[2] = ((0) << 16) |0x0000FFFF; 192 193 response = cParent->avcExecuteTransaction(request, 3, 3); 194 data_length_read=(response[1]&0xFFFF); 195 read_result_status=((response[1]>>24)&0xFF); 196 197 databuffer=(unsigned char *)(response+3); 198 199 // the buffer starting at databuffer is two bytes smaller that the amount of bytes read 200 for (i=0;(i<data_length_read-2) && (bytes_read < iLength);i++) { 201 *(aContents+bytes_read)=*(databuffer+i); 202 bytes_read++; 203 } 204 205 } 206 207 // now do the remaining reads 170 208 while(bytes_read<iLength) { 171 209 fprintf(stderr,"."); … … 173 211 request[0] = AVC1394_CTYPE_CONTROL | qTarget 174 212 | AVC1394_COMMAND_READ_DESCRIPTOR | (iType & 0xFF); 175 request[1] = 0xFFFF0000 | (iLength-bytes_read)&0xFFFF; 213 // the amount of bytes we want to read is: 214 // (total descriptor length - number of bytes already read) + 2 overlap with previous read 215 request[1] = 0xFFFF0000 | (iLength-bytes_read+2)&0xFFFF; 176 216 request[2] = (((bytes_read)&0xFFFF) << 16) |0x0000FFFF; 217 177 218 response = cParent->avcExecuteTransaction(request, 3, 3); 178 219 data_length_read=(response[1]&0xFFFF); 179 220 read_result_status=((response[1]>>24)&0xFF); 221 180 222 databuffer=(unsigned char *)(response+3); 181 223 182 for (i=0;(i<data_length_read ) && (bytes_read < iLength);i++) {224 for (i=0;(i<data_length_read-2) && (bytes_read < iLength);i++) { 183 225 *(aContents+bytes_read)=*(databuffer+i); 184 226 bytes_read++; 185 227 } 228 186 229 } 187 230 fprintf(stderr,"\n"); … … 256 299 } 257 300 } 258 trunk/freebob/src/avmusicstatusdescriptor.cpp
r21 r24 58 58 // PP: calculate the offset to accomodate for the presence of root lists [not implemented] 59 59 60 int offset=2; // update offset when beginning at a new table in the specs for easy reading60 //int offset=2; // update offset when beginning at a new table in the specs for easy reading 61 61 62 62 // start parsing the optional capability stuff trunk/freebob/src/avnameinfoblock.cpp
r22 r24 50 50 // PP: Can't find this in the specs I have... going to look around a bit for the spec this is in. 51 51 // (AV/C Information Block Types Specification Version 1.0) 52 unsigned int namelen;53 52 unsigned int readlen=0; 54 53 if (isValid()) { … … 57 56 // PP: for my device apparently one block is sufficient. 58 57 // PP: one strange thing remains, that is that there are some NULL characters in the buffer. 59 unsigned int length_of_textblock_1=readWord(0x0A);60 unsigned int type_of_textblock_1=readWord(0x0C); // = 0x000A ?58 // unsigned int length_of_textblock_1=readWord(0x0A); 59 // unsigned int type_of_textblock_1=readWord(0x0C); // = 0x000A ? 61 60 unsigned int primary_field_length_textblock_1=readWord(0x0E); // ?? I guess ?? 62 61 trunk/freebob/src/avoutputplugstatusinfoblock.cpp
r23 r24 42 42 43 43 debugPrint(DEBUG_LEVEL_INFO,"AvOutputPlugStatusInfoBlock: Creating... length=0x%04X\n",getLength()); 44 debugPrint(DEBUG_LEVEL_INFO,"AvOutputPlugStatusInfoBlock: Number of source plugs=%d\n",nb_sourceplugs); 44 45 45 46 if (nb_sourceplugs>0) { 46 47 for (unsigned int i=0;i<nb_sourceplugs;i++) { 48 debugPrint(DEBUG_LEVEL_INFO,"AvOutputPlugStatusInfoBlock: source plug=%d\n",i); 47 49 tmpAvSourcePlugInfoBlock=new AvSourcePlugInfoBlock(parent, next_block_position); 48 50 49 51 if (tmpAvSourcePlugInfoBlock && (tmpAvSourcePlugInfoBlock->isValid())) { 52 //debugPrint(DEBUG_LEVEL_INFO,"AvOutputPlugStatusInfoBlock: source plug type=0x%04X\n",tmpAvSourcePlugInfoBlock->getType()); 50 53 next_block_position+=tmpAvSourcePlugInfoBlock->getLength()+2; // the 2 is due to the fact that the length of the length field of the infoblock isn't accounted for; 51 54 52 55 // add to child list 53 56 cSourcePlugs.push_back(tmpAvSourcePlugInfoBlock); 57 58 tmpAvSourcePlugInfoBlock->printContents(); 59 54 60 } else { 55 61 debugPrint(DEBUG_LEVEL_INFO,"AvOutputPlugStatusInfoBlock: Invalid block... parse error!\n"); trunk/freebob/src/avsourcepluginfoblock.cpp
r23 r24 48 48 49 49 // parse the child info blocks 50 while ((next_block_position< getLength())) {50 while ((next_block_position<address+getLength())) { 51 51 debugPrint(DEBUG_LEVEL_INFO,"AvSourcePlugInfoBlock: Creating tmpInfoBlock\n"); 52 52 … … 132 132 } 133 133 } 134 135 void AvSourcePlugInfoBlock::printContents() { 136 if(cAudioInfoBlock) { 137 debugPrint(DEBUG_LEVEL_INFO,"AvSourcePlugInfoBlock: AudioInfoBlock: %s\n",cAudioInfoBlock->getName()); 138 } 139 if(cMidiInfoBlock) { 140 debugPrint(DEBUG_LEVEL_INFO,"AvSourcePlugInfoBlock: MidiInfoBlock %d streams\n",cMidiInfoBlock->getNbStreams()); 141 for (unsigned int i=0;i<cMidiInfoBlock->getNbStreams();i++) { 142 debugPrint(DEBUG_LEVEL_INFO,"AvSourcePlugInfoBlock: MidiInfoBlock stream %d: %s\n",i,cMidiInfoBlock->getName(i)); 143 } 144 } 145 if(cAudioSyncInfoBlock) { 146 debugPrint(DEBUG_LEVEL_INFO,"AvSourcePlugInfoBlock: AudioSyncInfoBlock can sync to: Bus? %s / External? %s\n", 147 cAudioSyncInfoBlock->canSyncBus()?"yes":"no", 148 cAudioSyncInfoBlock->canSyncExternal()?"yes":"no" 149 ); 150 } 151 } trunk/freebob/src/avsourcepluginfoblock.h
r23 r24 45 45 unsigned int getPlugNumber(); 46 46 47 void printContents(); // to debug the parse process 48 47 49 protected: 48 50 //vector<AvNameInfoBlock*> cNameInfoBlocks; trunk/freebob/src/ieee1394service.cpp
r23 r24 272 272 debugPrint (DEBUG_LEVEL_INFO, " Trying to create an AvMidiInfoBlock...\n"); 273 273 274 AvMidiInfoBlock *testblock5=new AvMidiInfoBlock(testdesc_mid2,0x09 7);274 AvMidiInfoBlock *testblock5=new AvMidiInfoBlock(testdesc_mid2,0x099); 275 275 debugPrint (DEBUG_LEVEL_INFO, " isValid? %s\n",(testblock5->isValid()?"yes":"no")); 276 276 debugPrint (DEBUG_LEVEL_INFO, " Length? 0x%04X (%d)\n",testblock5->getLength(),testblock5->getLength()); … … 282 282 283 283 debugPrint (DEBUG_LEVEL_INFO, " Trying to create an AvAudioSyncInfoBlock...\n"); 284 AvAudioSyncInfoBlock *testblock6=new AvAudioSyncInfoBlock(testdesc_mid2,0x026 0);284 AvAudioSyncInfoBlock *testblock6=new AvAudioSyncInfoBlock(testdesc_mid2,0x0262); 285 285 debugPrint (DEBUG_LEVEL_INFO, " isValid? %s\n",(testblock6->isValid()?"yes":"no")); 286 286 debugPrint (DEBUG_LEVEL_INFO, " canSyncBus? %s\n",(testblock6->canSyncBus()?"yes":"no"));