root/trunk/libfreebob/src/bebob/bebob_avdevice_xml.cpp

Revision 187, 3.6 kB (checked in by wagi, 18 years ago)

2006-05-04 Daniel Wagner <wagi@monom.org>

  • configure.ac: Version bumped to 0.7.2
  • src/bebob: Some cleanup on naming and
    namespaces.
Line 
1 /* bebob_avdevice_xml.cpp
2  * Copyright (C) 2006 by Daniel Wagner
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 // AvDevice XML stuff
22
23 #include "bebob/bebob_avdevice.h"
24 #include "configrom.h"
25
26 #include "libfreebobavc/ieee1394service.h"
27
28 namespace BeBoB {
29
30 bool
31 AvDevice::addXmlDescription( xmlNodePtr deviceNode )
32 {
33     // connection set
34     //  direction
35     //  connection
36     //    id
37     //    port
38     //    node
39     //    plug
40     //    dimension
41     //    samplerate
42     //    streams
43     //      stream
44
45
46     ///////////
47     // get plugs
48
49     AvPlug* inputPlug = getPlugById( m_pcrPlugs, AvPlug::eAPD_Input, 0 );
50     if ( !inputPlug ) {
51         debugError( "addXmlDescription: No iso input plug found with id 0\n" );
52         return false;
53     }
54     AvPlug* outputPlug = getPlugById( m_pcrPlugs, AvPlug::eAPD_Output, 0 );
55     if ( !outputPlug ) {
56         debugError( "addXmlDescription: No iso output plug found with id 0\n" );
57         return false;
58     }
59
60     ///////////
61     // add connection set output
62
63     xmlNodePtr connectionSet = xmlNewChild( deviceNode, 0,
64                                             BAD_CAST "ConnectionSet", 0 );
65     if ( !connectionSet ) {
66         debugError( "addXmlDescription:: Could not create 'ConnnectionSet' node for "
67                     "direction 1 (playback)\n" );
68         return false;
69     }
70
71     if ( !inputPlug->addXmlDescription( connectionSet ) ) {
72         debugError( "addXmlDescription: Could not add iso input plug 0 to XML description\n" );
73         return false;
74     }
75
76     // add connection set input
77
78     connectionSet = xmlNewChild( deviceNode, 0,
79                                  BAD_CAST "ConnectionSet", 0 );
80     if ( !connectionSet ) {
81         debugError( "addXmlDescription: Couldn't create 'ConnectionSet' node for "
82                     "direction 0 (recorder)\n" );
83         return false;
84     }
85
86     if ( !outputPlug->addXmlDescription( connectionSet ) ) {
87         debugError( "addXmlDescription: Could not add iso output plug 0 to XML description\n" );
88         return false;
89     }
90
91     ////////////
92     // add stream format
93
94     xmlNodePtr streamFormatNode = xmlNewChild( deviceNode, 0,
95                                                BAD_CAST "StreamFormats", 0 );
96     if ( !streamFormatNode ) {
97         debugError( "addXmlDescription: Could not create 'StreamFormats' node\n" );
98         return false;
99     }
100
101     if ( !inputPlug->addXmlDescriptionStreamFormats( streamFormatNode ) ) {
102         debugError( "addXmlDescription:: Could not add stream format info\n" );
103         return false;
104     }
105
106     streamFormatNode= xmlNewChild( deviceNode, 0,
107                                  BAD_CAST "StreamFormats", 0 );
108     if ( !streamFormatNode ) {
109         debugError( "addXmlDescription: Could not create 'StreamFormat' node\n" );
110         return false;
111     }
112
113     if ( !outputPlug->addXmlDescriptionStreamFormats( streamFormatNode ) ) {
114         debugError( "addXmlDescription:: Could not add stream format info\n" );
115         return false;
116     }
117
118     return true;
119 }
120
121 }
Note: See TracBrowser for help on using the browser.