]> git.vomp.tv Git - vompclient.git/blob - recinfo.cc
Update for windows
[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   Log::getInstance()->log("RecInfo", Log::CRAZY, "Deleting recinfo: %lu, %s", numComponents, summary);
40
41   if (summary) delete[] summary;
42
43   for (ULONG i = 0; i < numComponents; i++)
44   {
45     Log::getInstance()->log("RecInfo", Log::CRAZY, "i: %lu, languages[i]=%p:%s", i, languages[i], languages[i]);
46     Log::getInstance()->log("RecInfo", Log::CRAZY, "i: %lu, descripti[i]=%p:%s", i, descriptions[i], descriptions[i]);
47     if (languages[i]) delete[] (languages[i]);
48     if (descriptions[i]) delete[] (descriptions[i]);
49   }
50
51   if (numComponents)
52   {
53     delete[] languages;
54     delete[] descriptions;
55
56     delete[] streams;
57     delete[] types;
58   }
59
60   timerStart = 0;
61   timerEnd = 0;
62   resumePoint = 0;
63   summary = NULL;
64
65   numComponents = 0;
66   streams = NULL;
67   types = NULL;
68   languages = NULL;
69   descriptions = NULL;
70 }
71
72 void RecInfo::setNumComponents(ULONG tnumComponents)
73 {
74   numComponents = tnumComponents;
75   languages = new char*[numComponents];
76   descriptions = new char*[numComponents];
77   streams = new UCHAR[numComponents];
78   types = new UCHAR[numComponents];
79 }
80
81 void RecInfo::addComponent(ULONG componentNum, UCHAR tstream, UCHAR ttype, char* tlanguage, char* tdescription)
82 {
83   if (componentNum >= numComponents) return;
84   streams[componentNum] = tstream;
85   types[componentNum] = ttype;
86   languages[componentNum] = tlanguage;
87   descriptions[componentNum] = tdescription;
88 }
89
90 void RecInfo::print()
91 {
92   Log* logger = Log::getInstance();
93
94   logger->log("RecInfo", Log::DEBUG, "timerStart %lu", timerStart);
95   logger->log("RecInfo", Log::DEBUG, "timerEnd %lu", timerEnd);
96   logger->log("RecInfo", Log::DEBUG, "resumePoint %lu", resumePoint);
97   logger->log("RecInfo", Log::DEBUG, "Summary: %s", summary);
98   logger->log("RecInfo", Log::DEBUG, "numComponents: %lu", numComponents);
99
100   for (ULONG i = 0; i < numComponents; i++)
101   {
102     logger->log("RecInfo", Log::DEBUG, "streams[%lu]: %u", i, streams[i]);
103     logger->log("RecInfo", Log::DEBUG, "types[%lu]: %u", i, types[i]);
104     logger->log("RecInfo", Log::DEBUG, "languages[%lu]: %s", i, languages[i]);
105     logger->log("RecInfo", Log::DEBUG, "descriptions[%lu]: %s", i, descriptions[i]);
106   }
107 }
108
109 bool RecInfo::hasNoVideo()
110 {
111   // If no info (numComponents == 0) assume there is video
112   if (!numComponents) return false;
113
114   // video = 1, audio = 2
115
116   for (ULONG i = 0; i < numComponents; i++)
117     if (streams[i] == 1) return false;
118
119   return true;
120 }