Index: /trunk/freebob/src/avdescriptor.h =================================================================== --- /trunk/freebob/src/avdescriptor.h (revision 21) +++ /trunk/freebob/src/avdescriptor.h (revision 25) @@ -41,4 +41,5 @@ bool isOpen(); bool canWrite(); + bool isValid(); protected: @@ -48,4 +49,5 @@ bool bLoaded; bool bOpen; + bool bValid; unsigned int iAccessType; unsigned int iLength; Index: /trunk/freebob/src/avmusicstatusdescriptor.h =================================================================== --- /trunk/freebob/src/avmusicstatusdescriptor.h (revision 21) +++ /trunk/freebob/src/avmusicstatusdescriptor.h (revision 25) @@ -31,4 +31,7 @@ +class AvGeneralMusicInfoBlock; +class AvOutputPlugStatusInfoBlock; + class AvMusicStatusDescriptor : public AvDescriptor { public: @@ -39,4 +42,6 @@ protected: + AvGeneralMusicInfoBlock *cGeneralMusicInfoBlock; + AvOutputPlugStatusInfoBlock *cOutputPlugStatusInfoBlock; private: Index: /trunk/freebob/src/avdescriptor.cpp =================================================================== --- /trunk/freebob/src/avdescriptor.cpp (revision 24) +++ /trunk/freebob/src/avdescriptor.cpp (revision 25) @@ -42,4 +42,5 @@ bOpen=false; iAccessType=0; + bValid=false; // don't know yet what I'm going to do with this in the generic descriptor } @@ -248,4 +249,5 @@ if (((response[0] & 0xFF000000)==AVC1394_RESPONSE_NOT_IMPLEMENTED) || ((response[1] & 0xFF000000)==0x04)) { fprintf(stderr,"Descriptor not present.\n"); + bValid=false; return false; } @@ -263,4 +265,9 @@ return bLoaded; } + +bool AvDescriptor::isValid() { + return bValid; +} + unsigned int AvDescriptor::getLength() { Index: /trunk/freebob/src/ieee1394service.cpp =================================================================== --- /trunk/freebob/src/ieee1394service.cpp (revision 24) +++ /trunk/freebob/src/ieee1394service.cpp (revision 25) @@ -223,5 +223,5 @@ debugPrint (DEBUG_LEVEL_INFO, " Created...\n"); testdesc_mid2->printCapabilities(); - +#if 0 // test the AvInfoBlock debugPrint (DEBUG_LEVEL_INFO, " Trying to create an AvInfoBlock...\n"); @@ -312,5 +312,5 @@ delete testblock8; - +#endif debugPrint (DEBUG_LEVEL_INFO, " Deleting AvMusicStatusDescriptor...\n"); delete testdesc_mid2; Index: /trunk/freebob/src/avmusicstatusdescriptor.cpp =================================================================== --- /trunk/freebob/src/avmusicstatusdescriptor.cpp (revision 24) +++ /trunk/freebob/src/avmusicstatusdescriptor.cpp (revision 25) @@ -21,5 +21,14 @@ #include "avdevice.h" #include "avdescriptor.h" +#include "avmusicidentifierdescriptor.h" #include "avmusicstatusdescriptor.h" +#include "avinfoblock.h" +#include "avgeneralmusicstatusinfoblock.h" +#include "avnameinfoblock.h" +#include "avaudioinfoblock.h" +#include "avmidiinfoblock.h" +#include "avaudiosyncinfoblock.h" +#include "avsourcepluginfoblock.h" +#include "avoutputplugstatusinfoblock.h" AvMusicStatusDescriptor::AvMusicStatusDescriptor(AvDevice *parent) : AvDescriptor(parent, AVC1394_SUBUNIT_TYPE_MUSIC | AVC1394_SUBUNIT_ID_0,0x80) { @@ -38,8 +47,9 @@ if (!(this->AvDescriptor::isOpen())) { - fprintf(stderr,"AvMusicStatusDescriptor: Opening descriptor...\n"); + debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: Opening descriptor...\n"); this->AvDescriptor::OpenReadOnly(); if (!(this->AvDescriptor::isOpen()) ) { fprintf(stderr,"AvMusicStatusDescriptor: Failed!\n"); + bValid=false; return; } @@ -47,18 +57,59 @@ if (!(this->AvDescriptor::isLoaded())) { - fprintf(stderr,"AvMusicStatusDescriptor: Loading descriptor...\n"); + debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: Loading descriptor...\n"); this->AvDescriptor::Load(); if (!(this->AvDescriptor::isLoaded())) { fprintf(stderr,"AvMusicStatusDescriptor: Failed!\n"); + bValid=false; return; } } - fprintf(stderr,"AvMusicStatusDescriptor: \n"); - // PP: calculate the offset to accomodate for the presence of root lists [not implemented] + unsigned int offset=0; // update offset when beginning at a new table in the specs for easy reading + cGeneralMusicInfoBlock=NULL; + cOutputPlugStatusInfoBlock=NULL; - //int offset=2; // update offset when beginning at a new table in the specs for easy reading + debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: Creating AvGeneralMusicStatusInfoBlock... (offset=0x%04X)\n",offset); + cGeneralMusicInfoBlock=new AvGeneralMusicInfoBlock(this,offset); + if (!(cGeneralMusicInfoBlock) || !(cGeneralMusicInfoBlock->isValid())) { + debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: AvGeneralMusicStatusInfoBlock not found!\n"); + bValid=false; + return; + } + debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: AvGeneralMusicStatusInfoBlock found: length=0x%04X\n",cGeneralMusicInfoBlock->getLength()); - // start parsing the optional capability stuff + offset += cGeneralMusicInfoBlock->getLength()+2; + + + debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: Creating AvOutputPlugStatusInfoBlock... (offset=0x%04X)\n",offset); + cOutputPlugStatusInfoBlock=new AvOutputPlugStatusInfoBlock(this,offset); + if (!(cOutputPlugStatusInfoBlock) || !(cOutputPlugStatusInfoBlock->isValid())) { + debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: AvOutputPlugStatusInfoBlock not found!\n"); + bValid=false; + return; + } + debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: AvOutputPlugStatusInfoBlock found: length=0x%04X\n",cOutputPlugStatusInfoBlock->getLength()); + + offset += cOutputPlugStatusInfoBlock->getLength()+2; + + // start parsing the optional infoblock(s) + AvInfoBlock *tmpInfoBlock = NULL; + debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: Parsing optional infoblocks...\n"); + + while (offset < getLength()) { + debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: Optional block found...\n"); + tmpInfoBlock = new AvInfoBlock(this,offset); + if (tmpInfoBlock && tmpInfoBlock->isValid()) { + debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: Optional block of type 0x%04X with length 0x%04X found\n",tmpInfoBlock->getType(), tmpInfoBlock->getLength()); + + offset += tmpInfoBlock->getLength()+2; + } else { + debugPrint (DEBUG_LEVEL_INFO, "AvMusicStatusDescriptor: error parsing optional infoblock\n"); + bValid=false; + return; + } + + } + }