1 | Check the return values of function calls. |
---|
2 | |
---|
3 | From: Erik Hovland <erik@hovland.org> |
---|
4 | |
---|
5 | |
---|
6 | --- |
---|
7 | |
---|
8 | mythtv/libs/libmythtv/channelbase.cpp | 4 |
---|
9 | mythtv/libs/libmythtv/channelgroup.cpp | 18 + |
---|
10 | mythtv/libs/libmythtv/channelgroupsettings.cpp | 9 + |
---|
11 | mythtv/libs/libmythtv/channelutil.cpp | 38 ++- |
---|
12 | mythtv/libs/libmythtv/dvbchannel.cpp | 4 |
---|
13 | mythtv/libs/libmythtv/iptv/iptvchannelfetcher.cpp | 26 +- |
---|
14 | mythtv/libs/libmythtv/jobqueue.cpp | 3 |
---|
15 | mythtv/libs/libmythtv/previewgenerator.cpp | 12 + |
---|
16 | mythtv/libs/libmythtv/profilegroup.cpp | 10 + |
---|
17 | mythtv/libs/libmythtv/tv_play.cpp | 273 +++++++++++---------- |
---|
18 | mythtv/libs/libmythtv/tv_rec.cpp | 2 |
---|
19 | mythtv/libs/libmythtv/tvremoteutil.cpp | 18 + |
---|
20 | mythtv/libs/libmythtv/util-opengl.cpp | 39 +-- |
---|
21 | mythtv/libs/libmythtv/videodisplayprofile.cpp | 9 + |
---|
22 | mythtv/libs/libmythtv/videoout_opengl.cpp | 4 |
---|
23 | 15 files changed, 257 insertions(+), 212 deletions(-) |
---|
24 | |
---|
25 | |
---|
26 | diff --git a/mythtv/libs/libmythtv/channelbase.cpp b/mythtv/libs/libmythtv/channelbase.cpp |
---|
27 | index a884aa5..f527508 100644 |
---|
28 | --- a/mythtv/libs/libmythtv/channelbase.cpp |
---|
29 | +++ b/mythtv/libs/libmythtv/channelbase.cpp |
---|
30 | @@ -751,7 +751,9 @@ int ChannelBase::GetChanID() const |
---|
31 | if (query.size() <= 0) |
---|
32 | return -1; |
---|
33 | |
---|
34 | - query.next(); |
---|
35 | + if (!query.next()) |
---|
36 | + return -1; |
---|
37 | + |
---|
38 | return query.value(0).toInt(); |
---|
39 | } |
---|
40 | |
---|
41 | diff --git a/mythtv/libs/libmythtv/channelgroup.cpp b/mythtv/libs/libmythtv/channelgroup.cpp |
---|
42 | index 1a517a9..e75d25d 100644 |
---|
43 | --- a/mythtv/libs/libmythtv/channelgroup.cpp |
---|
44 | +++ b/mythtv/libs/libmythtv/channelgroup.cpp |
---|
45 | @@ -48,7 +48,9 @@ bool ChannelGroup::ToggleChannel(uint chanid, int changrpid, int delete_chan) |
---|
46 | else if ((query.size() > 0) && delete_chan) |
---|
47 | { |
---|
48 | // We have a record...Remove it to toggle... |
---|
49 | - query.next(); |
---|
50 | + if (!query.next()) |
---|
51 | + return false; |
---|
52 | + |
---|
53 | QString id = query.value(0).toString(); |
---|
54 | query.prepare( |
---|
55 | QString("DELETE FROM channelgroup " |
---|
56 | @@ -124,7 +126,9 @@ bool ChannelGroup::DeleteChannel(uint chanid, int changrpid) |
---|
57 | else if (query.size() > 0) |
---|
58 | { |
---|
59 | // We have a record...Remove it to toggle... |
---|
60 | - query.next(); |
---|
61 | + if (!query.next()) |
---|
62 | + return false; |
---|
63 | + |
---|
64 | QString id = query.value(0).toString(); |
---|
65 | query.prepare( |
---|
66 | QString("DELETE FROM channelgroup " |
---|
67 | @@ -213,11 +217,11 @@ QString ChannelGroup::GetChannelGroupName(int grpid) |
---|
68 | MythDB::DBError("ChannelGroup::GetChannelGroups", query); |
---|
69 | else if (query.size() > 0) |
---|
70 | { |
---|
71 | - query.next(); |
---|
72 | - return query.value(0).toString(); |
---|
73 | + if (query.next()) |
---|
74 | + return query.value(0).toString(); |
---|
75 | } |
---|
76 | |
---|
77 | - return ""; |
---|
78 | + return QString(); |
---|
79 | } |
---|
80 | |
---|
81 | int ChannelGroup::GetChannelGroupId(QString changroupname) |
---|
82 | @@ -237,7 +241,9 @@ int ChannelGroup::GetChannelGroupId(QString changroupname) |
---|
83 | MythDB::DBError("ChannelGroup::GetChannelGroups", query); |
---|
84 | else if (query.size() > 0) |
---|
85 | { |
---|
86 | - query.next(); |
---|
87 | + if (!query.next()) |
---|
88 | + return -1; |
---|
89 | + |
---|
90 | return query.value(0).toUInt(); |
---|
91 | } |
---|
92 | |
---|
93 | diff --git a/mythtv/libs/libmythtv/channelgroupsettings.cpp b/mythtv/libs/libmythtv/channelgroupsettings.cpp |
---|
94 | index 2bfce78..db86a32 100644 |
---|
95 | --- a/mythtv/libs/libmythtv/channelgroupsettings.cpp |
---|
96 | +++ b/mythtv/libs/libmythtv/channelgroupsettings.cpp |
---|
97 | @@ -46,7 +46,9 @@ void ChannelGroupStorage::Load(void) |
---|
98 | MythDB::DBError("ChannelGroupStorage::Load", query); |
---|
99 | else |
---|
100 | { |
---|
101 | - query.next(); |
---|
102 | + if (!query.next()) |
---|
103 | + MythDB::DBError("ChannelGroupStorage::Load", query); |
---|
104 | + |
---|
105 | grpid = query.value(0).toUInt(); |
---|
106 | |
---|
107 | qstr = "SELECT * FROM channelgroup WHERE grpid = :GRPID AND chanid = :CHANID"; |
---|
108 | @@ -190,7 +192,10 @@ void ChannelGroupEditor::doDelete(void) |
---|
109 | query.bindValue(":NAME", name); |
---|
110 | if (!query.exec()) |
---|
111 | MythDB::DBError("ChannelGroupEditor::doDelete", query); |
---|
112 | - query.next(); |
---|
113 | + |
---|
114 | + if (!query.next()) |
---|
115 | + MythDB::DBError("ChannelGroupEditor::doDelete", query); |
---|
116 | + |
---|
117 | uint grpid = query.value(0).toUInt(); |
---|
118 | |
---|
119 | // Delete channels from this group |
---|
120 | diff --git a/mythtv/libs/libmythtv/channelutil.cpp b/mythtv/libs/libmythtv/channelutil.cpp |
---|
121 | index 57b7e42..c69a1aa 100644 |
---|
122 | --- a/mythtv/libs/libmythtv/channelutil.cpp |
---|
123 | +++ b/mythtv/libs/libmythtv/channelutil.cpp |
---|
124 | @@ -619,9 +619,13 @@ int ChannelUtil::GetBetterMplexID(int current_mplexid, |
---|
125 | MythDB::DBError("Getting mplexid global search", query); |
---|
126 | else if (query.size()) |
---|
127 | { |
---|
128 | - query.next(); |
---|
129 | - q_networkid = query.value(0).toInt(); |
---|
130 | - q_transportid = query.value(1).toInt(); |
---|
131 | + if (!query.next()) |
---|
132 | + MythDB::DBError("Getting mplexid global search", query); |
---|
133 | + else |
---|
134 | + { |
---|
135 | + q_networkid = query.value(0).toInt(); |
---|
136 | + q_transportid = query.value(1).toInt(); |
---|
137 | + } |
---|
138 | } |
---|
139 | |
---|
140 | // Got a match, return it. |
---|
141 | @@ -683,13 +687,15 @@ int ChannelUtil::GetBetterMplexID(int current_mplexid, |
---|
142 | "GetBetterMplexID(): query#%1 qsize(%2) " |
---|
143 | "Returning %3") |
---|
144 | .arg(i).arg(query.size()).arg(current_mplexid)); |
---|
145 | - query.next(); |
---|
146 | - return query.value(0).toInt(); |
---|
147 | + if (query.next()); |
---|
148 | + return query.value(0).toInt(); |
---|
149 | } |
---|
150 | |
---|
151 | if (query.size() > 1) |
---|
152 | { |
---|
153 | - query.next(); |
---|
154 | + if (!query.next()) |
---|
155 | + return -1; |
---|
156 | + |
---|
157 | int ret = (i==0) ? current_mplexid : query.value(0).toInt(); |
---|
158 | VERBOSE(VB_CHANSCAN, QString( |
---|
159 | "GetBetterMplexID(): query#%1 qsize(%2) " |
---|
160 | @@ -742,7 +748,7 @@ bool ChannelUtil::GetTuningParams(uint mplexid, |
---|
161 | QString ChannelUtil::GetChannelStringField(int chan_id, const QString &field) |
---|
162 | { |
---|
163 | if (chan_id < 0) |
---|
164 | - return QString::null; |
---|
165 | + return QString(); |
---|
166 | |
---|
167 | MSqlQuery query(MSqlQuery::InitCon()); |
---|
168 | query.prepare(QString("SELECT %1 FROM channel " |
---|
169 | @@ -750,13 +756,15 @@ QString ChannelUtil::GetChannelStringField(int chan_id, const QString &field) |
---|
170 | if (!query.exec() || !query.isActive()) |
---|
171 | { |
---|
172 | MythDB::DBError("Selecting channel/dtv_multiplex 1", query); |
---|
173 | - return QString::null; |
---|
174 | + return QString(); |
---|
175 | } |
---|
176 | if (!query.size()) |
---|
177 | - return QString::null; |
---|
178 | + return QString(); |
---|
179 | |
---|
180 | - query.next(); |
---|
181 | - return query.value(0).toString(); |
---|
182 | + if (query.next()) |
---|
183 | + return query.value(0).toString(); |
---|
184 | + |
---|
185 | + return QString(); |
---|
186 | } |
---|
187 | |
---|
188 | QString ChannelUtil::GetChanNum(int chan_id) |
---|
189 | @@ -795,8 +803,8 @@ int ChannelUtil::GetSourceID(int db_mplexid) |
---|
190 | |
---|
191 | if (query.size() > 0) |
---|
192 | { |
---|
193 | - query.next(); |
---|
194 | - return query.value(0).toInt(); |
---|
195 | + if (query.next()) |
---|
196 | + return query.value(0).toInt(); |
---|
197 | } |
---|
198 | return -1; |
---|
199 | } |
---|
200 | @@ -1635,8 +1643,8 @@ int ChannelUtil::GetServiceVersion(int mplexid) |
---|
201 | |
---|
202 | if (query.size() > 0) |
---|
203 | { |
---|
204 | - query.next(); |
---|
205 | - return query.value(0).toInt(); |
---|
206 | + if (query.next()); |
---|
207 | + return query.value(0).toInt(); |
---|
208 | } |
---|
209 | return -1; |
---|
210 | } |
---|
211 | diff --git a/mythtv/libs/libmythtv/dvbchannel.cpp b/mythtv/libs/libmythtv/dvbchannel.cpp |
---|
212 | index 92ad2db..6f3cad0 100644 |
---|
213 | --- a/mythtv/libs/libmythtv/dvbchannel.cpp |
---|
214 | +++ b/mythtv/libs/libmythtv/dvbchannel.cpp |
---|
215 | @@ -1026,7 +1026,9 @@ int DVBChannel::GetChanID() const |
---|
216 | if (query.size() <= 0) |
---|
217 | return -1; |
---|
218 | |
---|
219 | - query.next(); |
---|
220 | + if (!query.next()) |
---|
221 | + return -1; |
---|
222 | + |
---|
223 | return query.value(0).toInt(); |
---|
224 | } |
---|
225 | |
---|
226 | diff --git a/mythtv/libs/libmythtv/iptv/iptvchannelfetcher.cpp b/mythtv/libs/libmythtv/iptv/iptvchannelfetcher.cpp |
---|
227 | index 0a3dffd..950acba 100644 |
---|
228 | --- a/mythtv/libs/libmythtv/iptv/iptvchannelfetcher.cpp |
---|
229 | +++ b/mythtv/libs/libmythtv/iptv/iptvchannelfetcher.cpp |
---|
230 | @@ -162,10 +162,15 @@ void IPTVChannelFetcher::RunScan(void) |
---|
231 | QObject::tr("Adding %1").arg(msg)); |
---|
232 | } |
---|
233 | chanid = ChannelUtil::CreateChanID(_sourceid, channum); |
---|
234 | - ChannelUtil::CreateChannel( |
---|
235 | - 0, _sourceid, chanid, name, name, channum, |
---|
236 | - 0, 0, 0, false, false, false, QString::null, |
---|
237 | - QString::null, "Default", xmltvid); |
---|
238 | + if (!ChannelUtil::CreateChannel(0, _sourceid, chanid, name, name, |
---|
239 | + channum, 0, 0, 0, false, false, |
---|
240 | + false, QString(), QString(), |
---|
241 | + "Default", xmltvid)) |
---|
242 | + { |
---|
243 | + VERBOSE(VB_IMPORTANT, |
---|
244 | + LOC_ERR + QString("Channel %1(%2) create failed") |
---|
245 | + .arg(name).arg(channum)); |
---|
246 | + } |
---|
247 | } |
---|
248 | else |
---|
249 | { |
---|
250 | @@ -174,10 +179,15 @@ void IPTVChannelFetcher::RunScan(void) |
---|
251 | _scan_monitor->ScanAppendTextToLog( |
---|
252 | QObject::tr("Updating %1").arg(msg)); |
---|
253 | } |
---|
254 | - ChannelUtil::UpdateChannel( |
---|
255 | - 0, _sourceid, chanid, name, name, channum, |
---|
256 | - 0, 0, 0, false, false, false, QString::null, |
---|
257 | - QString::null, "Default", xmltvid); |
---|
258 | + if (!ChannelUtil::UpdateChannel(0, _sourceid, chanid, name, name, |
---|
259 | + channum, 0, 0, 0, false, false, |
---|
260 | + false, QString(), QString(), |
---|
261 | + "Default", xmltvid)) |
---|
262 | + { |
---|
263 | + VERBOSE(VB_IMPORTANT, |
---|
264 | + LOC_ERR + QString("Channel %1(%2) update failed") |
---|
265 | + .arg(name).arg(channum)); |
---|
266 | + } |
---|
267 | } |
---|
268 | |
---|
269 | SetNumChannelsInserted(i); |
---|
270 | diff --git a/mythtv/libs/libmythtv/jobqueue.cpp b/mythtv/libs/libmythtv/jobqueue.cpp |
---|
271 | index fada8d7..c1b29af 100644 |
---|
272 | --- a/mythtv/libs/libmythtv/jobqueue.cpp |
---|
273 | +++ b/mythtv/libs/libmythtv/jobqueue.cpp |
---|
274 | @@ -2178,7 +2178,8 @@ void JobQueue::DoFlagCommercialsThread(int jobID) |
---|
275 | program_info->SendUpdateEvent(); |
---|
276 | |
---|
277 | program_info->pathname = program_info->GetPlaybackURL(); |
---|
278 | - (new PreviewGenerator(program_info, PreviewGenerator::kLocal))->Run(); |
---|
279 | + if (!(new PreviewGenerator(program_info, PreviewGenerator::kLocal))->Run()) |
---|
280 | + VERBOSE(VB_IMPORTANT, "PreviewGenerator::Run() failed"); |
---|
281 | } |
---|
282 | |
---|
283 | msg = tr("Commercial Flagging %1", "Job ID") |
---|
284 | diff --git a/mythtv/libs/libmythtv/previewgenerator.cpp b/mythtv/libs/libmythtv/previewgenerator.cpp |
---|
285 | index 665522f..f3f004c 100644 |
---|
286 | --- a/mythtv/libs/libmythtv/previewgenerator.cpp |
---|
287 | +++ b/mythtv/libs/libmythtv/previewgenerator.cpp |
---|
288 | @@ -283,14 +283,20 @@ bool PreviewGenerator::Run(void) |
---|
289 | |
---|
290 | void *PreviewGenerator::PreviewRun(void *param) |
---|
291 | { |
---|
292 | + if (!param) |
---|
293 | + return NULL; |
---|
294 | + |
---|
295 | // Lower scheduling priority, to avoid problems with recordings. |
---|
296 | if (setpriority(PRIO_PROCESS, 0, 9)) |
---|
297 | VERBOSE(VB_IMPORTANT, LOC + "Setting priority failed." + ENO); |
---|
298 | - PreviewGenerator *gen = (PreviewGenerator*) param; |
---|
299 | + |
---|
300 | + PreviewGenerator *gen = static_cast<PreviewGenerator*>(param); |
---|
301 | gen->createSockets = true; |
---|
302 | - gen->Run(); |
---|
303 | + if (!gen->Run()) |
---|
304 | + VERBOSE(VB_IMPORTANT, LOC + "PreviewGenerator::Run() failed."); |
---|
305 | + |
---|
306 | gen->deleteLater(); |
---|
307 | - return NULL; |
---|
308 | + return param; |
---|
309 | } |
---|
310 | |
---|
311 | bool PreviewGenerator::RemotePreviewSetup(void) |
---|
312 | diff --git a/mythtv/libs/libmythtv/profilegroup.cpp b/mythtv/libs/libmythtv/profilegroup.cpp |
---|
313 | index 4a761a7..307ad67 100644 |
---|
314 | --- a/mythtv/libs/libmythtv/profilegroup.cpp |
---|
315 | +++ b/mythtv/libs/libmythtv/profilegroup.cpp |
---|
316 | @@ -114,11 +114,13 @@ QString ProfileGroup::getName(int group) |
---|
317 | |
---|
318 | if (result.exec() && result.isActive() && result.size() > 0) |
---|
319 | { |
---|
320 | - result.next(); |
---|
321 | + if (!result.next()) |
---|
322 | + return QString(); |
---|
323 | + |
---|
324 | return result.value(0).toString(); |
---|
325 | } |
---|
326 | |
---|
327 | - return NULL; |
---|
328 | + return QString(); |
---|
329 | } |
---|
330 | |
---|
331 | bool ProfileGroup::allowedGroupName(void) |
---|
332 | @@ -285,7 +287,9 @@ void ProfileGroupEditor::callDelete(void) |
---|
333 | |
---|
334 | if (result.exec() && result.isActive() && result.size() > 0) |
---|
335 | { |
---|
336 | - result.next(); |
---|
337 | + if (!result.next()) |
---|
338 | + return; |
---|
339 | + |
---|
340 | QString message = QObject::tr("Delete profile group:") + |
---|
341 | QString("\n'%1'?").arg(ProfileGroup::getName(id)); |
---|
342 | |
---|
343 | diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp |
---|
344 | index 7762b83..59abcbe 100644 |
---|
345 | --- a/mythtv/libs/libmythtv/tv_play.cpp |
---|
346 | +++ b/mythtv/libs/libmythtv/tv_play.cpp |
---|
347 | @@ -1364,7 +1364,9 @@ void TV::AskAllowRecording(PlayerContext *ctx, |
---|
348 | |
---|
349 | ProgramInfo *info = new ProgramInfo; |
---|
350 | QStringList::const_iterator it = msg.begin(); |
---|
351 | - info->FromStringList(it, msg.end()); |
---|
352 | + if (!info->FromStringList(it, msg.end())) |
---|
353 | + VERBOSE(VB_IMPORTANT, LOC + "AskAllowRecording -- " + |
---|
354 | + QString("Could not initialize the ProgramInfo object")); |
---|
355 | |
---|
356 | QMutexLocker locker(&askAllowLock); |
---|
357 | QString key = info->MakeUniqueKey(); |
---|
358 | @@ -6291,18 +6293,20 @@ void TV::DoSkipCommercials(PlayerContext *ctx, int direction) |
---|
359 | ctx->UnlockDeleteNVP(__FILE__, __LINE__); |
---|
360 | |
---|
361 | struct StatusPosInfo posInfo; |
---|
362 | - ctx->CalcNVPSliderPosition(posInfo); |
---|
363 | - |
---|
364 | - bool slidertype = false; |
---|
365 | |
---|
366 | - OSD *osd = GetOSDLock(ctx); |
---|
367 | - if (osd) |
---|
368 | + if (ctx->CalcNVPSliderPosition(posInfo)) |
---|
369 | { |
---|
370 | - posInfo.desc = tr("Searching..."); |
---|
371 | - osd->ShowStatus(posInfo, slidertype, tr("Skip"), 6); |
---|
372 | - SetUpdateOSDPosition(true); |
---|
373 | - } |
---|
374 | - ReturnOSDLock(ctx, osd); |
---|
375 | + OSD *osd = GetOSDLock(ctx); |
---|
376 | + if (osd) |
---|
377 | + { |
---|
378 | + posInfo.desc = tr("Searching..."); |
---|
379 | + osd->ShowStatus(posInfo, false, tr("Skip"), 6); |
---|
380 | + SetUpdateOSDPosition(true); |
---|
381 | + } |
---|
382 | + ReturnOSDLock(ctx, osd); |
---|
383 | + } else |
---|
384 | + VERBOSE(VB_PLAYBACK, LOC + |
---|
385 | + "DoSkipCommercials: ctx->CalcNVPSliderPosition() failed"); |
---|
386 | |
---|
387 | ctx->LockDeleteNVP(__FILE__, __LINE__); |
---|
388 | if (ctx->nvp) |
---|
389 | @@ -6834,8 +6838,8 @@ bool TV::CommitQueuedInput(PlayerContext *ctx) |
---|
390 | if (ccInputMode) |
---|
391 | { |
---|
392 | commited = true; |
---|
393 | - if (HasQueuedInput()) |
---|
394 | - HandleTrackAction(ctx, "TOGGLECC"); |
---|
395 | + if (HasQueuedInput() && !HandleTrackAction(ctx, "TOGGLECC")) |
---|
396 | + VERBOSE(VB_IMPORTANT, "HandleTrackAction(TOGGLECC) failed"); |
---|
397 | } |
---|
398 | else if (asInputMode) |
---|
399 | { |
---|
400 | @@ -9950,151 +9954,150 @@ void TV::TreeMenuSelected(OSDListTreeItemSelectedEvent *e) |
---|
401 | stretch <= 2.0 && |
---|
402 | stretch >= 0.48) |
---|
403 | { |
---|
404 | - actx->ts_normal = stretch; // alter speed before display |
---|
405 | - } |
---|
406 | + bool floatRead; |
---|
407 | + float stretch = action.right(action.length() - 13).toFloat(&floatRead); |
---|
408 | + if (floatRead && |
---|
409 | + stretch <= 2.0 && |
---|
410 | + stretch >= 0.48) |
---|
411 | + { |
---|
412 | + actx->ts_normal = stretch; // alter speed before display |
---|
413 | + } |
---|
414 | |
---|
415 | - StopFFRew(actx); |
---|
416 | + StopFFRew(actx); |
---|
417 | |
---|
418 | - if (actx->paused) |
---|
419 | - DoTogglePause(actx, true); |
---|
420 | + if (actx->paused) |
---|
421 | + DoTogglePause(actx, true); |
---|
422 | |
---|
423 | - ChangeTimeStretch(actx, 0, !floatRead); // just display |
---|
424 | - } |
---|
425 | - else if (action.left(11) == "SELECTSCAN_") |
---|
426 | - { |
---|
427 | - QString msg = QString::null; |
---|
428 | - actx->LockDeleteNVP(__FILE__, __LINE__); |
---|
429 | - actx->nvp->SetScanType((FrameScanType) action.right(1).toInt()); |
---|
430 | - actx->UnlockDeleteNVP(__FILE__, __LINE__); |
---|
431 | - msg = toString(actx->nvp->GetScanType()); |
---|
432 | + ChangeTimeStretch(actx, 0, !floatRead); // just display |
---|
433 | + } |
---|
434 | + else if (action.left(11) == "SELECTSCAN_") |
---|
435 | + { |
---|
436 | + QString msg = QString::null; |
---|
437 | + actx->LockDeleteNVP(__FILE__, __LINE__); |
---|
438 | + actx->nvp->SetScanType((FrameScanType) action.right(1).toInt()); |
---|
439 | + actx->UnlockDeleteNVP(__FILE__, __LINE__); |
---|
440 | + msg = toString(actx->nvp->GetScanType()); |
---|
441 | |
---|
442 | - if (!msg.isEmpty()) |
---|
443 | + if (!msg.isEmpty()) |
---|
444 | + { |
---|
445 | + OSD *osd = GetOSDLock(actx); |
---|
446 | + if (osd) |
---|
447 | + osd->SetSettingsText(msg, 3); |
---|
448 | + ReturnOSDLock(actx, osd); |
---|
449 | + } |
---|
450 | + } |
---|
451 | + else if (action.left(15) == "TOGGLEAUDIOSYNC") |
---|
452 | + ChangeAudioSync(actx, 0); |
---|
453 | + else if (action.left(11) == "TOGGLESLEEP") |
---|
454 | { |
---|
455 | - OSD *osd = GetOSDLock(actx); |
---|
456 | - if (osd) |
---|
457 | - osd->SetSettingsText(msg, 3); |
---|
458 | - ReturnOSDLock(actx, osd); |
---|
459 | + ToggleSleepTimer(actx, action.left(13)); |
---|
460 | } |
---|
461 | - } |
---|
462 | - else if (action.left(15) == "TOGGLEAUDIOSYNC") |
---|
463 | - ChangeAudioSync(actx, 0); |
---|
464 | - else if (action.left(11) == "TOGGLESLEEP") |
---|
465 | - { |
---|
466 | - ToggleSleepTimer(actx, action.left(13)); |
---|
467 | - } |
---|
468 | - else if (action.left(17) == "TOGGLEPICCONTROLS") |
---|
469 | - { |
---|
470 | - adjustingPictureAttribute = (PictureAttribute) |
---|
471 | - (action.right(1).toInt() - 1); |
---|
472 | - DoTogglePictureAttribute(actx, kAdjustingPicture_Playback); |
---|
473 | - } |
---|
474 | - else if (action.left(12) == "TOGGLEASPECT") |
---|
475 | - { |
---|
476 | - ToggleAspectOverride(actx, |
---|
477 | - (AspectOverrideMode) action.right(1).toInt()); |
---|
478 | - } |
---|
479 | - else if (action.left(10) == "TOGGLEFILL") |
---|
480 | - { |
---|
481 | + else if (action.left(17) == "TOGGLEPICCONTROLS") |
---|
482 | + { |
---|
483 | + adjustingPictureAttribute = (PictureAttribute) |
---|
484 | + (action.right(1).toInt() - 1); |
---|
485 | + DoTogglePictureAttribute(actx, kAdjustingPicture_Playback); |
---|
486 | + } |
---|
487 | + else if (action.left(12) == "TOGGLEASPECT") |
---|
488 | + { |
---|
489 | + ToggleAspectOverride(actx, |
---|
490 | + (AspectOverrideMode) action.right(1).toInt()); |
---|
491 | + } |
---|
492 | + else if (action.left(10) == "TOGGLEFILL") |
---|
493 | + { |
---|
494 | ToggleAdjustFill(actx, (AdjustFillMode) action.right(1).toInt()); |
---|
495 | - } |
---|
496 | - else if (action == "AUTODETECT_FILL") |
---|
497 | - { |
---|
498 | - actx->nvp->detect_letter_box->SetDetectLetterbox(!actx->nvp->detect_letter_box->GetDetectLetterbox()); |
---|
499 | - } |
---|
500 | - else if (action == "GUIDE") |
---|
501 | - EditSchedule(actx, kScheduleProgramGuide); |
---|
502 | - else if (action.left(10) == "CHANGROUP_") |
---|
503 | - { |
---|
504 | - if (action == "CHANGROUP_ALL_CHANNELS") |
---|
505 | - channel_group_id = -1; |
---|
506 | - else |
---|
507 | + } |
---|
508 | + else if (action == "AUTODETECT_FILL") |
---|
509 | { |
---|
510 | - action.remove("CHANGROUP_"); |
---|
511 | - |
---|
512 | - channel_group_id = action.toInt(); |
---|
513 | - |
---|
514 | - if (browse_changrp) |
---|
515 | + actx->nvp->detect_letter_box->SetDetectLetterbox(!actx->nvp->detect_letter_box->GetDetectLetterbox()); |
---|
516 | + } |
---|
517 | + else if (action == "GUIDE") |
---|
518 | + EditSchedule(actx, kScheduleProgramGuide); |
---|
519 | + else if (action.left(10) == "CHANGROUP_") |
---|
520 | + { |
---|
521 | + if (action == "CHANGROUP_ALL_CHANNELS") |
---|
522 | + channel_group_id = -1; |
---|
523 | + else |
---|
524 | { |
---|
525 | - m_channellist = ChannelUtil::GetChannels(0, true, "channum, callsign", channel_group_id); |
---|
526 | - ChannelUtil::SortChannels(m_channellist, "channum", true); |
---|
527 | + action.remove("CHANGROUP_"); |
---|
528 | + |
---|
529 | + channel_group_id = action.toInt(); |
---|
530 | |
---|
531 | - // make sure the current channel is from the selected group |
---|
532 | - // or tune to the first in the group |
---|
533 | - if (actx->tvchain) |
---|
534 | + if (browse_changrp) |
---|
535 | { |
---|
536 | - QString cur_channum = actx->tvchain->GetChannelName(-1); |
---|
537 | - QString new_channum = cur_channum; |
---|
538 | + m_channellist = ChannelUtil::GetChannels(0, true, "channum, callsign", channel_group_id); |
---|
539 | + ChannelUtil::SortChannels(m_channellist, "channum", true); |
---|
540 | |
---|
541 | - DBChanList::const_iterator it = m_channellist.begin(); |
---|
542 | - for (; it != m_channellist.end(); ++it) |
---|
543 | + // make sure the current channel is from the selected group |
---|
544 | + // or tune to the first in the group |
---|
545 | + if (actx->tvchain) |
---|
546 | { |
---|
547 | - if ((*it).channum == cur_channum) |
---|
548 | + QString cur_channum = actx->tvchain->GetChannelName(-1); |
---|
549 | + QString new_channum = cur_channum; |
---|
550 | + |
---|
551 | + DBChanList::const_iterator it = m_channellist.begin(); |
---|
552 | + for (; it != m_channellist.end(); ++it) |
---|
553 | { |
---|
554 | - break; |
---|
555 | + if ((*it).channum == cur_channum) |
---|
556 | + { |
---|
557 | + break; |
---|
558 | + } |
---|
559 | } |
---|
560 | - } |
---|
561 | |
---|
562 | - if (it == m_channellist.end()) |
---|
563 | - { |
---|
564 | - // current channel not found so switch to the |
---|
565 | - // first channel in the group |
---|
566 | - it = m_channellist.begin(); |
---|
567 | - if (it != m_channellist.end()) |
---|
568 | - new_channum = (*it).channum; |
---|
569 | - } |
---|
570 | + if (it == m_channellist.end()) |
---|
571 | + { |
---|
572 | + // current channel not found so switch to the |
---|
573 | + // first channel in the group |
---|
574 | + it = m_channellist.begin(); |
---|
575 | + if (it != m_channellist.end()) |
---|
576 | + new_channum = (*it).channum; |
---|
577 | + } |
---|
578 | |
---|
579 | - VERBOSE(VB_IMPORTANT, LOC + QString("Channel Group: '%1'->'%2'") |
---|
580 | - .arg(cur_channum).arg(new_channum)); |
---|
581 | + VERBOSE(VB_IMPORTANT, LOC + QString("Channel Group: '%1'->'%2'") |
---|
582 | + .arg(cur_channum).arg(new_channum)); |
---|
583 | |
---|
584 | - // Only change channel if new channel != current channel |
---|
585 | - if (cur_channum != new_channum && !new_channum.isEmpty()) |
---|
586 | - { |
---|
587 | - QMutexLocker locker(&timerIdLock); |
---|
588 | - queuedInput = new_channum; queuedInput.detach(); |
---|
589 | - queuedChanNum = new_channum; queuedChanNum.detach(); |
---|
590 | - queuedChanID = 0; |
---|
591 | - if (!queueInputTimerId) |
---|
592 | - queueInputTimerId = StartTimer(10, __LINE__); |
---|
593 | - } |
---|
594 | + // Only change channel if new channel != current channel |
---|
595 | + if (cur_channum != new_channum && !new_channum.isEmpty()) |
---|
596 | + { |
---|
597 | + QMutexLocker locker(&timerIdLock); |
---|
598 | + queuedInput = new_channum; queuedInput.detach(); |
---|
599 | + queuedChanNum = new_channum; queuedChanNum.detach(); |
---|
600 | + queuedChanID = 0; |
---|
601 | + if (!queueInputTimerId) |
---|
602 | + queueInputTimerId = StartTimer(10, __LINE__); |
---|
603 | + } |
---|
604 | |
---|
605 | - // Turn off OSD Channel Num so the channel changes right away |
---|
606 | - OSD *osd = GetOSDLock(actx); |
---|
607 | - if (osd) |
---|
608 | - osd->HideSet("channel_number"); |
---|
609 | - ReturnOSDLock(actx, osd); |
---|
610 | + // Turn off OSD Channel Num so the channel changes right away |
---|
611 | + OSD *osd = GetOSDLock(actx); |
---|
612 | + if (osd) |
---|
613 | + osd->HideSet("channel_number"); |
---|
614 | + ReturnOSDLock(actx, osd); |
---|
615 | + } |
---|
616 | } |
---|
617 | } |
---|
618 | } |
---|
619 | - } |
---|
620 | - else if (action == "FINDER") |
---|
621 | - EditSchedule(actx, kScheduleProgramFinder); |
---|
622 | - else if (action == "SCHEDULE") |
---|
623 | - EditSchedule(actx, kScheduledRecording); |
---|
624 | - else if (action == "VIEWSCHEDULED") |
---|
625 | - EditSchedule(actx, kViewSchedule); |
---|
626 | - else if (HandleJumpToProgramAction(actx, QStringList(action))) |
---|
627 | - { |
---|
628 | - } |
---|
629 | - else if (PxPHandleAction(actx, QStringList(action))) |
---|
630 | - { |
---|
631 | - // Hide the tree on old active context.. |
---|
632 | - for (uint i = 0; i < player.size(); i++) |
---|
633 | - { |
---|
634 | - OSD *osd = GetOSDLock(GetPlayer(actx,i)); |
---|
635 | - if (osd) |
---|
636 | - osd->HideTreeMenu(true); |
---|
637 | - ReturnOSDLock(GetPlayer(actx,i), osd); |
---|
638 | - ClearOSD(GetPlayer(actx,i)); |
---|
639 | + else if (action == "FINDER") |
---|
640 | + EditSchedule(actx, kScheduleProgramFinder); |
---|
641 | + else if (action == "SCHEDULE") |
---|
642 | + EditSchedule(actx, kScheduledRecording); |
---|
643 | + else if (action == "VIEWSCHEDULED") |
---|
644 | + EditSchedule(actx, kViewSchedule); |
---|
645 | + else if (!HandleJumpToProgramAction(actx, QStringList(action))) |
---|
646 | + VERBOSE(VB_IMPORTANT, "HandleJumpToProgramAction failed"); |
---|
647 | + else if (PxPHandleAction(actx, QStringList(action))) |
---|
648 | + { |
---|
649 | + // Hide the tree on old active context.. |
---|
650 | + for (uint i = 0; i < player.size(); i++) |
---|
651 | + { |
---|
652 | + OSD *osd = GetOSDLock(GetPlayer(actx,i)); |
---|
653 | + if (osd) |
---|
654 | + osd->HideTreeMenu(true); |
---|
655 | + ReturnOSDLock(GetPlayer(actx,i), osd); |
---|
656 | + ClearOSD(GetPlayer(actx,i)); |
---|
657 | + } |
---|
658 | + actx = GetPlayer(actx,-1); // "NEXTPIPWINDOW" changes active context.. |
---|
659 | } |
---|
660 | - actx = GetPlayer(actx,-1); // "NEXTPIPWINDOW" changes active context.. |
---|
661 | - } |
---|
662 | - else if (StateIsLiveTV(GetState(actx))) |
---|
663 | - { |
---|
664 | - if (action == "TOGGLEBROWSE") |
---|
665 | - BrowseStart(actx); |
---|
666 | - else if (action == "PREVCHAN") |
---|
667 | - PopPreviousChannel(actx, true); |
---|
668 | - else if (action.left(14) == "SWITCHTOINPUT_") |
---|
669 | + else if (StateIsLiveTV(GetState(actx))) |
---|
670 | { |
---|
671 | switchToInputId = action.mid(14).toUInt(); |
---|
672 | QMutexLocker locker(&timerIdLock); |
---|
673 | diff --git a/mythtv/libs/libmythtv/tv_rec.cpp b/mythtv/libs/libmythtv/tv_rec.cpp |
---|
674 | index 2b8d163..b903a24 100644 |
---|
675 | --- a/mythtv/libs/libmythtv/tv_rec.cpp |
---|
676 | +++ b/mythtv/libs/libmythtv/tv_rec.cpp |
---|
677 | @@ -3721,7 +3721,7 @@ void TVRec::TuningFrequency(const TuningRequest &request) |
---|
678 | |
---|
679 | bool ok = false; |
---|
680 | if (channel) |
---|
681 | - channel->Open(); |
---|
682 | + ok = channel->Open(); |
---|
683 | else |
---|
684 | ok = true; |
---|
685 | |
---|
686 | diff --git a/mythtv/libs/libmythtv/tvremoteutil.cpp b/mythtv/libs/libmythtv/tvremoteutil.cpp |
---|
687 | index b0aee08..5f709ba 100644 |
---|
688 | --- a/mythtv/libs/libmythtv/tvremoteutil.cpp |
---|
689 | +++ b/mythtv/libs/libmythtv/tvremoteutil.cpp |
---|
690 | @@ -118,7 +118,9 @@ void RemoteStopRecording(const ProgramInfo *pginfo) |
---|
691 | QStringList strlist(QString("STOP_RECORDING")); |
---|
692 | pginfo->ToStringList(strlist); |
---|
693 | |
---|
694 | - gContext->SendReceiveStringList(strlist); |
---|
695 | + if (!gContext->SendReceiveStringList(strlist)) |
---|
696 | + VERBOSE(VB_IMPORTANT, |
---|
697 | + "SendReceiveStringList(STOP_RECORDING) failed"); |
---|
698 | } |
---|
699 | |
---|
700 | void RemoteCancelNextRecording(uint cardid, bool cancel) |
---|
701 | @@ -269,7 +271,8 @@ void RemoteGeneratePreviewPixmap(ProgramInfo *pginfo) |
---|
702 | QStringList strlist( "QUERY_GENPIXMAP" ); |
---|
703 | pginfo->ToStringList(strlist); |
---|
704 | |
---|
705 | - gContext->SendReceiveStringList(strlist); |
---|
706 | + if (!gContext->SendReceiveStringList(strlist)) |
---|
707 | + VERBOSE(VB_IMPORTANT, "SendReceiveStringList(QUERY_GENPIXMAP) failed"); |
---|
708 | } |
---|
709 | |
---|
710 | bool RemoteIsBusy(uint cardid, TunedInputInfo &busy_input) |
---|
711 | @@ -327,9 +330,8 @@ bool RemoteGetRecordingStatus( |
---|
712 | { |
---|
713 | strlist = QStringList(cmd); |
---|
714 | strlist << "GET_STATE"; |
---|
715 | - gContext->SendReceiveStringList(strlist); |
---|
716 | |
---|
717 | - if (strlist.empty()) |
---|
718 | + if (!gContext->SendReceiveStringList(strlist) || strlist.empty()) |
---|
719 | break; |
---|
720 | |
---|
721 | state = strlist[0].toInt(); |
---|
722 | @@ -346,7 +348,13 @@ bool RemoteGetRecordingStatus( |
---|
723 | |
---|
724 | strlist = QStringList(QString("QUERY_RECORDER %1").arg(cardid)); |
---|
725 | strlist << "GET_RECORDING"; |
---|
726 | - gContext->SendReceiveStringList(strlist); |
---|
727 | + if (!gContext->SendReceiveStringList(strlist)) |
---|
728 | + { |
---|
729 | + VERBOSE(VB_IMPORTANT, |
---|
730 | + QString("SendReceiveStringList(%1, GET_RECORDING)") |
---|
731 | + .arg(cardid)); |
---|
732 | + break; |
---|
733 | + } |
---|
734 | |
---|
735 | ProgramInfo progInfo; |
---|
736 | QStringList::const_iterator it = strlist.constBegin(); |
---|
737 | diff --git a/mythtv/libs/libmythtv/util-opengl.cpp b/mythtv/libs/libmythtv/util-opengl.cpp |
---|
738 | index 69bc208..52cdf2d 100644 |
---|
739 | --- a/mythtv/libs/libmythtv/util-opengl.cpp |
---|
740 | +++ b/mythtv/libs/libmythtv/util-opengl.cpp |
---|
741 | @@ -357,7 +357,8 @@ void *get_gl_proc_address(const QString &procName) |
---|
742 | |
---|
743 | int get_gl_texture_rect_type(const QString &ext) |
---|
744 | { |
---|
745 | - init_opengl(); |
---|
746 | + if (!init_opengl()) |
---|
747 | + return -1; |
---|
748 | |
---|
749 | if (ext.contains("GL_NV_texture_rectangle")) |
---|
750 | return GL_TEXTURE_RECTANGLE_NV; |
---|
751 | @@ -371,9 +372,7 @@ int get_gl_texture_rect_type(const QString &ext) |
---|
752 | |
---|
753 | bool has_gl_fbuffer_object_support(const QString &ext) |
---|
754 | { |
---|
755 | - init_opengl(); |
---|
756 | - |
---|
757 | - if (!ext.contains("GL_EXT_framebuffer_object")) |
---|
758 | + if (!init_opengl() || !ext.contains("GL_EXT_framebuffer_object")) |
---|
759 | return false; |
---|
760 | |
---|
761 | return (gMythGLGenFramebuffersEXT && |
---|
762 | @@ -385,9 +384,7 @@ bool has_gl_fbuffer_object_support(const QString &ext) |
---|
763 | |
---|
764 | bool has_gl_fragment_program_support(const QString &ext) |
---|
765 | { |
---|
766 | - init_opengl(); |
---|
767 | - |
---|
768 | - if (!ext.contains("GL_ARB_fragment_program")) |
---|
769 | + if (!init_opengl() || !ext.contains("GL_ARB_fragment_program")) |
---|
770 | return false; |
---|
771 | |
---|
772 | return (gMythGLGenProgramsARB && |
---|
773 | @@ -400,9 +397,7 @@ bool has_gl_fragment_program_support(const QString &ext) |
---|
774 | |
---|
775 | bool has_glx_video_sync_support(const QString &glx_ext) |
---|
776 | { |
---|
777 | - init_opengl(); |
---|
778 | - |
---|
779 | - if (!glx_ext.contains("GLX_SGI_video_sync")) |
---|
780 | + if (!init_opengl() || !glx_ext.contains("GLX_SGI_video_sync")) |
---|
781 | return false; |
---|
782 | |
---|
783 | return gMythGLXGetVideoSyncSGI && gMythGLXWaitVideoSyncSGI; |
---|
784 | @@ -410,9 +405,7 @@ bool has_glx_video_sync_support(const QString &glx_ext) |
---|
785 | |
---|
786 | bool has_gl_pixelbuffer_object_support(const QString &ext) |
---|
787 | { |
---|
788 | - init_opengl(); |
---|
789 | - |
---|
790 | - if (!ext.contains("GL_ARB_pixel_buffer_object")) |
---|
791 | + if (!init_opengl() || !ext.contains("GL_ARB_pixel_buffer_object")) |
---|
792 | return false; |
---|
793 | |
---|
794 | return (gMythGLMapBufferARB && |
---|
795 | @@ -425,9 +418,7 @@ bool has_gl_pixelbuffer_object_support(const QString &ext) |
---|
796 | |
---|
797 | bool has_gl_nvfence_support(const QString &ext) |
---|
798 | { |
---|
799 | - init_opengl(); |
---|
800 | - |
---|
801 | - if (!ext.contains("GL_NV_fence")) |
---|
802 | + if (!init_opengl() || !ext.contains("GL_NV_fence")) |
---|
803 | return false; |
---|
804 | |
---|
805 | return (gMythGLGenFencesNV && |
---|
806 | @@ -438,9 +429,7 @@ bool has_gl_nvfence_support(const QString &ext) |
---|
807 | |
---|
808 | bool has_gl_applefence_support(const QString &ext) |
---|
809 | { |
---|
810 | - init_opengl(); |
---|
811 | - |
---|
812 | - if (!ext.contains("GL_APPLE_fence")) |
---|
813 | + if (!init_opengl() || !ext.contains("GL_APPLE_fence")) |
---|
814 | return false; |
---|
815 | |
---|
816 | return (gMythGLGenFencesAPPLE && |
---|
817 | @@ -451,9 +440,7 @@ bool has_gl_applefence_support(const QString &ext) |
---|
818 | |
---|
819 | bool has_glx_swapinterval_support(const QString &glx_ext) |
---|
820 | { |
---|
821 | - init_opengl(); |
---|
822 | - |
---|
823 | - if (!glx_ext.contains("GLX_SGI_swap_control")) |
---|
824 | + if (!init_opengl() || !glx_ext.contains("GLX_SGI_swap_control")) |
---|
825 | return false; |
---|
826 | |
---|
827 | return gMythGLXSwapIntervalSGI; |
---|
828 | @@ -461,9 +448,7 @@ bool has_glx_swapinterval_support(const QString &glx_ext) |
---|
829 | |
---|
830 | bool has_wgl_swapinterval_support(const QString &ext) |
---|
831 | { |
---|
832 | - init_opengl(); |
---|
833 | - |
---|
834 | - if (!ext.contains("WGL_EXT_swap_control")) |
---|
835 | + if (!init_opengl() || !ext.contains("WGL_EXT_swap_control")) |
---|
836 | return false; |
---|
837 | |
---|
838 | return gMythWGLSwapIntervalEXT; |
---|
839 | @@ -471,9 +456,7 @@ bool has_wgl_swapinterval_support(const QString &ext) |
---|
840 | |
---|
841 | bool has_gl_ycbcrmesa_support(const QString &ext) |
---|
842 | { |
---|
843 | - init_opengl(); |
---|
844 | - |
---|
845 | - if (!ext.contains("GL_MESA_ycbcr_texture")) |
---|
846 | + if (!init_opengl() || !ext.contains("GL_MESA_ycbcr_texture")) |
---|
847 | return false; |
---|
848 | |
---|
849 | return true; |
---|
850 | diff --git a/mythtv/libs/libmythtv/videodisplayprofile.cpp b/mythtv/libs/libmythtv/videodisplayprofile.cpp |
---|
851 | index cf70384..e90683d 100644 |
---|
852 | --- a/mythtv/libs/libmythtv/videodisplayprofile.cpp |
---|
853 | +++ b/mythtv/libs/libmythtv/videodisplayprofile.cpp |
---|
854 | @@ -800,8 +800,13 @@ QString VideoDisplayProfile::GetDefaultProfileName(const QString &hostname) |
---|
855 | void VideoDisplayProfile::SetDefaultProfileName( |
---|
856 | const QString &profilename, const QString &hostname) |
---|
857 | { |
---|
858 | - gContext->SaveSettingOnHost( |
---|
859 | - "DefaultVideoPlaybackProfile", profilename, hostname); |
---|
860 | + if (!gContext->SaveSettingOnHost("DefaultVideoPlaybackProfile", profilename, |
---|
861 | + hostname)) |
---|
862 | + { |
---|
863 | + VERBOSE(VB_IMPORTANT, |
---|
864 | + QString("SaveSettingOnHost(DefaultVideoPlaybackProfile, " |
---|
865 | + "%1, %2) failed").arg(profilename).arg(hostname)); |
---|
866 | + } |
---|
867 | } |
---|
868 | |
---|
869 | uint VideoDisplayProfile::GetProfileGroupID(const QString &profilename, |
---|
870 | diff --git a/mythtv/libs/libmythtv/videoout_opengl.cpp b/mythtv/libs/libmythtv/videoout_opengl.cpp |
---|
871 | index 01549b5..0917f2b 100644 |
---|
872 | --- a/mythtv/libs/libmythtv/videoout_opengl.cpp |
---|
873 | +++ b/mythtv/libs/libmythtv/videoout_opengl.cpp |
---|
874 | @@ -505,7 +505,9 @@ bool VideoOutputOpenGL::SetupDeinterlace( |
---|
875 | { |
---|
876 | gl_videochain->SetDeinterlacing(false); |
---|
877 | gl_videochain->SetSoftwareDeinterlacer(QString::null); |
---|
878 | - VideoOutput::SetupDeinterlace(interlaced, overridefilter); |
---|
879 | + if (!VideoOutput::SetupDeinterlace(interlaced, overridefilter)) |
---|
880 | + return false; |
---|
881 | + |
---|
882 | if (m_deinterlacing) |
---|
883 | gl_videochain->SetSoftwareDeinterlacer(m_deintfiltername); |
---|
884 | |
---|