Index: /trunk/freebob/src/avgeneralmusicstatusinfoblock.cpp =================================================================== --- /trunk/freebob/src/avgeneralmusicstatusinfoblock.cpp (revision 22) +++ /trunk/freebob/src/avgeneralmusicstatusinfoblock.cpp (revision 22) @@ -0,0 +1,83 @@ +/* avgeneralmusicstatusinfoblock.cpp + * Copyright (C) 2004 by Pieter Palmers + * + * This file is part of FreeBob. + * + * FreeBob is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * FreeBob is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with FreeBob; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA. + */ + +#include "avdescriptor.h" +#include "avinfoblock.h" +#include "avgeneralmusicstatusinfoblock.h" + +#include +#include +#include +#include +#include "debugmodule.h" + +AvGeneralMusicInfoBlock::AvGeneralMusicInfoBlock(AvDescriptor *parent, int address) : AvInfoBlock(parent,address) { + // do some more valid checks + if (getType() != 0x8100) { + bValid=false; + } +} + +AvGeneralMusicInfoBlock::~AvGeneralMusicInfoBlock() { + +} + +bool AvGeneralMusicInfoBlock::canTransmitBlocking() { + if(isValid()) { + unsigned char transmit_capability=readByte(6); + return (transmit_capability & AVC1394_SUBUNIT_MUSIC_CAPABILITY_BLOCKING); + } else { + return false; + } +} + +bool AvGeneralMusicInfoBlock::canTransmitNonblocking() { + if(isValid()) { + unsigned char transmit_capability=readByte(6); + return (transmit_capability & AVC1394_SUBUNIT_MUSIC_CAPABILITY_NONBLOCKING); + + } else { + return false; + } + +} + +bool AvGeneralMusicInfoBlock::canReceiveBlocking() { + if(isValid()) { + unsigned char receive_capability=readByte(7); + return (receive_capability & AVC1394_SUBUNIT_MUSIC_CAPABILITY_BLOCKING); + + } else { + return false; + } + +} + +bool AvGeneralMusicInfoBlock::canReceiveNonblocking() { + if(isValid()) { + unsigned char receive_capability=readByte(7); + return (receive_capability & AVC1394_SUBUNIT_MUSIC_CAPABILITY_NONBLOCKING); + + } else { + return false; + } + +} + Index: /trunk/freebob/src/avnameinfoblock.h =================================================================== --- /trunk/freebob/src/avnameinfoblock.h (revision 22) +++ /trunk/freebob/src/avnameinfoblock.h (revision 22) @@ -0,0 +1,46 @@ +/* avnameinfoblock.h + * Copyright (C) 2004 by Pieter Palmers + * + * This file is part of FreeBob. + * + * FreeBob is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * FreeBob is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with FreeBob; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA. + */ + +#include +#include +#include +#include +#include "debugmodule.h" + +#include "avdevice.h" +#include "avdescriptor.h" +#include "avinfoblock.h" + +#ifndef AVNAMEINFOBLOCK_H +#define AVNAMEINFOBLOCK_H + +class AvNameInfoBlock : public AvInfoBlock { +public: + AvNameInfoBlock(AvDescriptor *parent, int address); // read an infoblock from a parent starting from a specific position + virtual ~AvNameInfoBlock(); + unsigned char * getName(); + +protected: + unsigned char *nameBuffer; +private: + +}; + +#endif Index: /trunk/freebob/src/avmidiinfoblock.h =================================================================== --- /trunk/freebob/src/avmidiinfoblock.h (revision 22) +++ /trunk/freebob/src/avmidiinfoblock.h (revision 22) @@ -0,0 +1,51 @@ +/* avmidiinfoblock.h + * Copyright (C) 2004 by Pieter Palmers + * + * This file is part of FreeBob. + * + * FreeBob is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * FreeBob is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with FreeBob; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA. + */ + +#include +#include +#include +#include +#include +using std::vector; + +#include "debugmodule.h" + +#include "avdevice.h" +#include "avdescriptor.h" +#include "avinfoblock.h" +#include "avnameinfoblock.h" + +#ifndef AVMIDIINFOBLOCK_H +#define AVMIDIINFOBLOCK_H + +class AvMidiInfoBlock : public AvInfoBlock { +public: + AvMidiInfoBlock(AvDescriptor *parent, int address); // read an infoblock from a parent starting from a specific position + virtual ~AvMidiInfoBlock(); + unsigned int getNbStreams(); + unsigned char *getName(unsigned int streamIndex); + +protected: + vector cNameInfoBlocks; +private: + +}; + +#endif Index: /trunk/freebob/src/avaudiosyncinfoblock.h =================================================================== --- /trunk/freebob/src/avaudiosyncinfoblock.h (revision 22) +++ /trunk/freebob/src/avaudiosyncinfoblock.h (revision 22) @@ -0,0 +1,47 @@ +/* avaudiosyncinfoblock.h + * Copyright (C) 2004 by Pieter Palmers + * + * This file is part of FreeBob. + * + * FreeBob is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * FreeBob is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with FreeBob; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA. + */ + + +#include +#include +#include +#include +#include "debugmodule.h" +#include "avdevice.h" +#include "avdescriptor.h" +#include "avinfoblock.h" + +#ifndef AVAUDIOSYNCINFOBLOCK_H +#define AVAUDIOSYNCINFOBLOCK_H + +class AvAudioSyncInfoBlock : public AvInfoBlock { +public: + AvAudioSyncInfoBlock(AvDescriptor *parent, int address); // read an infoblock from a parent starting from a specific position + virtual ~AvAudioSyncInfoBlock(); + bool canSyncExternal(); + bool canSyncBus(); + +protected: + +private: + +}; + +#endif Index: /trunk/freebob/src/avaudioinfoblock.h =================================================================== --- /trunk/freebob/src/avaudioinfoblock.h (revision 22) +++ /trunk/freebob/src/avaudioinfoblock.h (revision 22) @@ -0,0 +1,48 @@ +/* avaudioinfoblock.h + * Copyright (C) 2004 by Pieter Palmers + * + * This file is part of FreeBob. + * + * FreeBob is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * FreeBob is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with FreeBob; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA. + */ + +#include +#include +#include +#include +#include "debugmodule.h" + +#include "avdevice.h" +#include "avdescriptor.h" +#include "avinfoblock.h" +#include "avnameinfoblock.h" + +#ifndef AVAUDIOINFOBLOCK_H +#define AVAUDIOINFOBLOCK_H + +class AvAudioInfoBlock : public AvInfoBlock { +public: + AvAudioInfoBlock(AvDescriptor *parent, int address); // read an infoblock from a parent starting from a specific position + virtual ~AvAudioInfoBlock(); + unsigned int getNbStreams(); + unsigned char *getName(); + +protected: + AvNameInfoBlock *cNameInfoBlock; +private: + +}; + +#endif Index: /trunk/freebob/src/avnameinfoblock.cpp =================================================================== --- /trunk/freebob/src/avnameinfoblock.cpp (revision 22) +++ /trunk/freebob/src/avnameinfoblock.cpp (revision 22) @@ -0,0 +1,78 @@ +/* avnameinfoblock.cpp + * Copyright (C) 2004 by Pieter Palmers + * + * This file is part of FreeBob. + * + * FreeBob is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * FreeBob is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with FreeBob; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA. + */ + + +#include +#include +#include +#include +#include "debugmodule.h" + +#include "avdescriptor.h" +#include "avinfoblock.h" +#include "avnameinfoblock.h" + +AvNameInfoBlock::AvNameInfoBlock(AvDescriptor *parent, int address) : AvInfoBlock(parent,address) { + // do some more valid checks + if (getType() != 0x000B) { + bValid=false; + } + nameBuffer=NULL; + +} + +AvNameInfoBlock::~AvNameInfoBlock() { + + if(nameBuffer) { + delete nameBuffer; + } +} + +unsigned char * AvNameInfoBlock::getName() { + + // PP: Can't find this in the specs I have... going to look around a bit for the spec this is in. + // (AV/C Information Block Types Specification Version 1.0) + unsigned int namelen; + unsigned int readlen=0; + if (isValid()) { + // PP: we should parse some raw_text_info_blocks here, but the music spec indicates that there are maximum 3 of these + // so I do it manually here. + // PP: for my device apparently one block is sufficient. + // PP: one strange thing remains, that is that there are some NULL characters in the buffer. + unsigned int length_of_textblock_1=readWord(0x0A); + unsigned int type_of_textblock_1=readWord(0x0C); // = 0x000A ? + unsigned int primary_field_length_textblock_1=readWord(0x0E); // ?? I guess ?? + + if (nameBuffer) { + delete nameBuffer; + } + nameBuffer=new unsigned char[primary_field_length_textblock_1]; + + if((readlen=readBuffer(0x10,primary_field_length_textblock_1,nameBuffer)) +#include +#include +#include +#include "debugmodule.h" + +#include "avdescriptor.h" +#include "avinfoblock.h" +#include "avnameinfoblock.h" +#include "avmidiinfoblock.h" + +AvMidiInfoBlock::AvMidiInfoBlock(AvDescriptor *parent, int address) : AvInfoBlock(parent,address) { + // do some more valid checks + if (getType() != 0x8104) { + bValid=false; + } + + unsigned int nb_streams=readByte(6); + unsigned int position=0; + AvNameInfoBlock *tmpNameBlock; + + if (nb_streams>0) { + position=address+7; + for (unsigned int i=0;iisValid())) { + position+=tmpNameBlock->getLength()+2; // the 2 is due to the fact that the length of the length field of the infoblock isn't accounted for; + + // add to child list + cNameInfoBlocks.push_back(tmpNameBlock); + } else { + debugPrint(DEBUG_LEVEL_INFO,"Invalid name block in Midi info Block...\n"); + bValid=false; + break; // what to do now? + } + } + + } + + // no optional info blocks please... + +} + +AvMidiInfoBlock::~AvMidiInfoBlock() { + + vector::iterator it; + for( it = cNameInfoBlocks.begin(); it != cNameInfoBlocks.end(); it++ ) { + delete *it; + } + +} + +unsigned int AvMidiInfoBlock::getNbStreams() { + if(isValid()) { + return readByte(6); + } else { + return 0; + } +} + +unsigned char *AvMidiInfoBlock::getName(unsigned int streamIdx) { + AvNameInfoBlock *tmpNameBlock; + + if ((streamIdxgetName(); + } else { + return NULL; + } + } + return NULL; +} Index: /trunk/freebob/src/avinfoblock.h =================================================================== --- /trunk/freebob/src/avinfoblock.h (revision 21) +++ /trunk/freebob/src/avinfoblock.h (revision 22) @@ -33,5 +33,5 @@ public: AvInfoBlock(AvDescriptor *parent, int address); // read an infoblock from a parent starting from a specific position - ~AvInfoBlock(); + virtual ~AvInfoBlock(); bool isValid(); @@ -39,7 +39,7 @@ unsigned int getType(); - unsigned char readByte(unsigned int address); - unsigned int readWord(unsigned int address); - unsigned int readBuffer(unsigned int address, unsigned int length, unsigned char *buffer); + virtual unsigned char readByte(unsigned int address); + virtual unsigned int readWord(unsigned int address); + virtual unsigned int readBuffer(unsigned int address, unsigned int length, unsigned char *buffer); protected: Index: /trunk/freebob/src/avdescriptor.cpp =================================================================== --- /trunk/freebob/src/avdescriptor.cpp (revision 21) +++ /trunk/freebob/src/avdescriptor.cpp (revision 22) @@ -249,5 +249,5 @@ length=iLength-address; } - memcpy((void*)buffer, (void*)aContents, length); + memcpy((void*)buffer, (void*)(aContents+address), length); return length; Index: /trunk/freebob/src/avgeneralmusicstatusinfoblock.h =================================================================== --- /trunk/freebob/src/avgeneralmusicstatusinfoblock.h (revision 22) +++ /trunk/freebob/src/avgeneralmusicstatusinfoblock.h (revision 22) @@ -0,0 +1,47 @@ +/* avgeneralmusicstatusinfoblock.h + * Copyright (C) 2004 by Pieter Palmers + * + * This file is part of FreeBob. + * + * FreeBob is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * FreeBob is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with FreeBob; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA. + */ + + #include "avdevice.h" +#include "avdescriptor.h" +#include +#include +#include +#include +#include "debugmodule.h" + +#ifndef AVGENERALMUSICSTATUSINFOBLOCK_H +#define AVGENERALMUSICSTATUSINFOBLOCK_H + +class AvGeneralMusicInfoBlock : public AvInfoBlock { +public: + AvGeneralMusicInfoBlock(AvDescriptor *parent, int address); // read an infoblock from a parent starting from a specific position + virtual ~AvGeneralMusicInfoBlock(); + bool canTransmitBlocking(); + bool canTransmitNonblocking(); + bool canReceiveBlocking(); + bool canReceiveNonblocking(); + //int getLatency(); +protected: + +private: + +}; + +#endif Index: /trunk/freebob/src/ieee1394service.cpp =================================================================== --- /trunk/freebob/src/ieee1394service.cpp (revision 21) +++ /trunk/freebob/src/ieee1394service.cpp (revision 22) @@ -30,4 +30,9 @@ #include "avmusicstatusdescriptor.h" #include "avinfoblock.h" +#include "avgeneralmusicstatusinfoblock.h" +#include "avnameinfoblock.h" +#include "avaudioinfoblock.h" +#include "avmidiinfoblock.h" +#include "avaudiosyncinfoblock.h" Ieee1394Service* Ieee1394Service::m_pInstance = 0; @@ -228,9 +233,66 @@ debugPrint (DEBUG_LEVEL_INFO, " Length: 0x%04X (%d) Type: 0x%04X\n",testblock2->getLength(),testblock2->getLength(),testblock2->getType()); - + + // test the general status info block + debugPrint (DEBUG_LEVEL_INFO, " Trying to create an AvGeneralMusicStatusInfoBlock...\n"); + AvGeneralMusicInfoBlock *testblock3=new AvGeneralMusicInfoBlock(testdesc_mid2,0); + + // PP: the next tests could fail because of the difference in hardware. + // these classes are intended to be used in the parser. I use hardcoded addresses in the test code, + // instead of derived addresses based on the parent descriptors. + // this is only intended to debug the base classes before using them in the parser. + + + // this one should be valid (on my config) + debugPrint (DEBUG_LEVEL_INFO, " isValid? %s\n",(testblock3->isValid()?"yes":"no")); + debugPrint (DEBUG_LEVEL_INFO, " canTransmitBlocking? %s\n",(testblock3->canTransmitBlocking()?"yes":"no")); + debugPrint (DEBUG_LEVEL_INFO, " canTransmitNonblocking? %s\n",(testblock3->canTransmitNonblocking()?"yes":"no")); + debugPrint (DEBUG_LEVEL_INFO, " canReceiveBlocking? %s\n",(testblock3->canReceiveBlocking()?"yes":"no")); + debugPrint (DEBUG_LEVEL_INFO, " canReceiveNonblocking? %s\n",(testblock3->canReceiveNonblocking()?"yes":"no")); + + delete testblock3; + // this one shouldn't be valid + testblock3=new AvGeneralMusicInfoBlock(testdesc_mid2,2+testblock1->getLength()); + debugPrint (DEBUG_LEVEL_INFO, " isValid? %s\n",(testblock3->isValid()?"yes":"no")); + debugPrint (DEBUG_LEVEL_INFO, " canTransmitBlocking? %s\n",(testblock3->canTransmitBlocking()?"yes":"no")); + debugPrint (DEBUG_LEVEL_INFO, " canTransmitNonblocking? %s\n",(testblock3->canTransmitNonblocking()?"yes":"no")); + debugPrint (DEBUG_LEVEL_INFO, " canReceiveBlocking? %s\n",(testblock3->canReceiveBlocking()?"yes":"no")); + debugPrint (DEBUG_LEVEL_INFO, " canReceiveNonblocking? %s\n",(testblock3->canReceiveNonblocking()?"yes":"no")); + + debugPrint (DEBUG_LEVEL_INFO, " Trying to create an AvAudioInfoBlock...\n"); + + AvAudioInfoBlock *testblock4=new AvAudioInfoBlock(testdesc_mid2,0x01A); + debugPrint (DEBUG_LEVEL_INFO, " isValid? %s\n",(testblock4->isValid()?"yes":"no")); + debugPrint (DEBUG_LEVEL_INFO, " Length? 0x%04X (%d)\n",testblock4->getLength(),testblock4->getLength()); + debugPrint (DEBUG_LEVEL_INFO, " streams: %d\n",testblock4->getNbStreams()); + debugPrint (DEBUG_LEVEL_INFO, " Name: %s\n",testblock4->getName()); + + debugPrint (DEBUG_LEVEL_INFO, " Trying to create an AvMidiInfoBlock...\n"); + + AvMidiInfoBlock *testblock5=new AvMidiInfoBlock(testdesc_mid2,0x097); + debugPrint (DEBUG_LEVEL_INFO, " isValid? %s\n",(testblock5->isValid()?"yes":"no")); + debugPrint (DEBUG_LEVEL_INFO, " Length? 0x%04X (%d)\n",testblock5->getLength(),testblock5->getLength()); + unsigned int nb_midi_streams=testblock5->getNbStreams(); + debugPrint (DEBUG_LEVEL_INFO, " streams: %d\n",nb_midi_streams); + for (unsigned int i=0;igetName(i)); + } + + debugPrint (DEBUG_LEVEL_INFO, " Trying to create an AvAudioSyncInfoBlock...\n"); + AvAudioSyncInfoBlock *testblock6=new AvAudioSyncInfoBlock(testdesc_mid2,0x0260); + debugPrint (DEBUG_LEVEL_INFO, " isValid? %s\n",(testblock6->isValid()?"yes":"no")); + debugPrint (DEBUG_LEVEL_INFO, " canSyncBus? %s\n",(testblock6->canSyncBus()?"yes":"no")); + debugPrint (DEBUG_LEVEL_INFO, " canSyncExternal? %s\n",(testblock6->canSyncExternal()?"yes":"no")); + + debugPrint (DEBUG_LEVEL_INFO, " Deleting AvInfoBlocks...\n"); + delete testblock1; delete testblock2; - + delete testblock3; + delete testblock4; + delete testblock5; + delete testblock6; + debugPrint (DEBUG_LEVEL_INFO, " Deleting AvMusicStatusDescriptor...\n"); delete testdesc_mid2; Index: /trunk/freebob/src/avaudiosyncinfoblock.cpp =================================================================== --- /trunk/freebob/src/avaudiosyncinfoblock.cpp (revision 22) +++ /trunk/freebob/src/avaudiosyncinfoblock.cpp (revision 22) @@ -0,0 +1,61 @@ +/* avaudiosyncinfoblock.cpp + * Copyright (C) 2004 by Pieter Palmers + * + * This file is part of FreeBob. + * + * FreeBob is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * FreeBob is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with FreeBob; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA. + */ + + +#include +#include +#include +#include +#include "debugmodule.h" + +#include "avdescriptor.h" +#include "avinfoblock.h" +#include "avaudiosyncinfoblock.h" + +AvAudioSyncInfoBlock::AvAudioSyncInfoBlock(AvDescriptor *parent, int address) : AvInfoBlock(parent,address) { + // do some more valid checks + if (getType() != 0x8107) { + bValid=false; + } +} + +AvAudioSyncInfoBlock::~AvAudioSyncInfoBlock() { + +} + +bool AvAudioSyncInfoBlock::canSyncBus() { + if(isValid()) { + unsigned char capability=readByte(6); + return (capability & AVC1394_SUBUNIT_MUSIC_CAPABILITY_AUDIOSYNC_BUS); + } else { + return false; + } +} + +bool AvAudioSyncInfoBlock::canSyncExternal() { + if(isValid()) { + unsigned char capability=readByte(6); + return (capability & AVC1394_SUBUNIT_MUSIC_CAPABILITY_AUDIOSYNC_EXTERNAL); + + } else { + return false; + } + +} Index: /trunk/freebob/src/avaudioinfoblock.cpp =================================================================== --- /trunk/freebob/src/avaudioinfoblock.cpp (revision 22) +++ /trunk/freebob/src/avaudioinfoblock.cpp (revision 22) @@ -0,0 +1,65 @@ +/* avaudioinfoblock.cpp + * Copyright (C) 2004 by Pieter Palmers + * + * This file is part of FreeBob. + * + * FreeBob is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * FreeBob is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with FreeBob; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA. + */ + + +#include +#include +#include +#include +#include "debugmodule.h" + +#include "avdescriptor.h" +#include "avinfoblock.h" +#include "avnameinfoblock.h" +#include "avaudioinfoblock.h" + +AvAudioInfoBlock::AvAudioInfoBlock(AvDescriptor *parent, int address) : AvInfoBlock(parent,address) { + // do some more valid checks + if (getType() != 0x8103) { + bValid=false; + } + + // PP: I assume that there is only an audio block, no optional blocks. + cNameInfoBlock=new AvNameInfoBlock(parent, address+7); + +} + +AvAudioInfoBlock::~AvAudioInfoBlock() { + + if(cNameInfoBlock) { + delete cNameInfoBlock; + } +} + +unsigned int AvAudioInfoBlock::getNbStreams() { + if(isValid()) { + return readByte(6); + } else { + return 0; + } +} + +unsigned char *AvAudioInfoBlock::getName() { + if (cNameInfoBlock && cNameInfoBlock->isValid()) { + unsigned char * name=cNameInfoBlock->getName(); + return name; + } + return NULL; +} Index: /trunk/freebob/src/Makefile.am =================================================================== --- /trunk/freebob/src/Makefile.am (revision 21) +++ /trunk/freebob/src/Makefile.am (revision 22) @@ -43,4 +43,14 @@ avinfoblock.h \ avinfoblock.cpp \ + avgeneralmusicstatusinfoblock.h \ + avgeneralmusicstatusinfoblock.cpp \ + avnameinfoblock.h \ + avnameinfoblock.cpp \ + avaudioinfoblock.h \ + avaudioinfoblock.cpp \ + avmidiinfoblock.h \ + avmidiinfoblock.cpp \ + avaudiosyncinfoblock.h \ + avaudiosyncinfoblock.cpp \ debugmodule.cpp \ main.cpp