]> git.vomp.tv Git - vompclient.git/blob - recinfo.cc
New recinfo system - not finished just yet!
[vompclient.git] / recinfo.cc
1 /*
2     Copyright 2006 Chris Tallon
3
4     This file is part of VOMP.
5
6     VOMP 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
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 #include "recinfo.h"
22
23 RecInfo::RecInfo()
24 {
25   timerStart = 0;
26   timerEnd = 0;
27   resumePoint = 0;
28   summary = NULL;
29
30   numComponents = 0;
31   streams = NULL;
32   types = NULL;
33   languages = NULL;
34   descriptions = NULL;
35 }
36
37 RecInfo::~RecInfo()
38 {
39   if (summary) delete[] summary;
40
41   for (ULONG i = 0; i < numComponents; i++)
42   {
43     delete[] languages[i];
44     delete[] descriptions[i];
45   }
46
47   if (numComponents)
48   {
49     delete[] languages;
50     delete[] descriptions;
51
52     delete[] streams;
53     delete[] types;
54   }
55
56   timerStart = 0;
57   timerEnd = 0;
58   resumePoint = 0;
59   summary = NULL;
60
61   numComponents = 0;
62   streams = NULL;
63   types = NULL;
64   languages = NULL;
65   descriptions = NULL;
66 }
67
68 void RecInfo::setNumComponents(ULONG tnumComponents)
69 {
70   numComponents = tnumComponents;
71   languages = new char*[numComponents];
72   descriptions = new char*[numComponents];
73   streams = new UCHAR[numComponents];
74   types = new UCHAR[numComponents];
75 }
76
77 void RecInfo::addComponent(ULONG componentNum, UCHAR tstream, UCHAR ttype, char* tlanguage, char* tdescription)
78 {
79   if (componentNum >= numComponents) return;
80   streams[componentNum] = tstream;
81   types[componentNum] = ttype;
82   languages[componentNum] = tlanguage;
83   descriptions[componentNum] = tdescription;
84 }
85
86 void RecInfo::print()
87 {
88   Log* logger = Log::getInstance();
89
90   logger->log("RecInfo", Log::DEBUG, "timerStart %lu", timerStart);
91   logger->log("RecInfo", Log::DEBUG, "timerEnd %lu", timerEnd);
92   logger->log("RecInfo", Log::DEBUG, "resumePoint %lu", resumePoint);
93   logger->log("RecInfo", Log::DEBUG, "Summary: %s", summary);
94   logger->log("RecInfo", Log::DEBUG, "numComponents: %lu", numComponents);
95
96   for (ULONG i = 0; i < numComponents; i++)
97   {
98     logger->log("RecInfo", Log::DEBUG, "streams[%lu]: %u", i, streams[i]);
99     logger->log("RecInfo", Log::DEBUG, "types[%lu]: %u", i, types[i]);
100     logger->log("RecInfo", Log::DEBUG, "languages[%lu]: %s", i, languages[i]);
101     logger->log("RecInfo", Log::DEBUG, "descriptions[%lu]: %s", i, descriptions[i]);
102   }
103 }