1 |
/* avaudioinfoblock.cpp |
---|
2 |
* Copyright (C) 2004 by Pieter Palmers |
---|
3 |
* |
---|
4 |
* This file is part of FreeBob. |
---|
5 |
* |
---|
6 |
* FreeBob is free software; you can redistribute it and/or modify |
---|
7 |
* it under the terms of the GNU General Public License as published by |
---|
8 |
* the Free Software Foundation; either version 2 of the License, or |
---|
9 |
* (at your option) any later version. |
---|
10 |
* FreeBob is distributed in the hope that it will be useful, |
---|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 |
* GNU General Public License for more details. |
---|
14 |
* |
---|
15 |
* You should have received a copy of the GNU General Public License |
---|
16 |
* along with FreeBob; if not, write to the Free Software |
---|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
---|
18 |
* MA 02111-1307 USA. |
---|
19 |
*/ |
---|
20 |
|
---|
21 |
|
---|
22 |
#include <string.h> |
---|
23 |
#include <errno.h> |
---|
24 |
#include <libavc1394/avc1394.h> |
---|
25 |
#include <libavc1394/avc1394_vcr.h> |
---|
26 |
#include "debugmodule.h" |
---|
27 |
|
---|
28 |
#include "avdescriptor.h" |
---|
29 |
#include "avinfoblock.h" |
---|
30 |
#include "avnameinfoblock.h" |
---|
31 |
#include "avaudioinfoblock.h" |
---|
32 |
|
---|
33 |
AvAudioInfoBlock::AvAudioInfoBlock(AvDescriptor *parent, int address) : AvInfoBlock(parent,address) { |
---|
34 |
// do some more valid checks |
---|
35 |
if (getType() != 0x8103) { |
---|
36 |
bValid=false; |
---|
37 |
} |
---|
38 |
|
---|
39 |
// PP: I assume that there is only an audio block, no optional blocks. |
---|
40 |
cNameInfoBlock=new AvNameInfoBlock(parent, address+7); |
---|
41 |
|
---|
42 |
} |
---|
43 |
|
---|
44 |
AvAudioInfoBlock::~AvAudioInfoBlock() { |
---|
45 |
|
---|
46 |
if(cNameInfoBlock) { |
---|
47 |
delete cNameInfoBlock; |
---|
48 |
} |
---|
49 |
} |
---|
50 |
|
---|
51 |
unsigned int AvAudioInfoBlock::getNbStreams() { |
---|
52 |
if(isValid()) { |
---|
53 |
return readByte(6); |
---|
54 |
} else { |
---|
55 |
return 0; |
---|
56 |
} |
---|
57 |
} |
---|
58 |
|
---|
59 |
unsigned char *AvAudioInfoBlock::getName() { |
---|
60 |
if (cNameInfoBlock && cNameInfoBlock->isValid()) { |
---|
61 |
unsigned char * name=cNameInfoBlock->getName(); |
---|
62 |
return name; |
---|
63 |
} |
---|
64 |
return NULL; |
---|
65 |
} |
---|