|
MythTV
0.25-pre
|
Go to the source code of this file.
Classes | |
| struct | timing_ab_t |
Enumerations | |
| enum | DateTimeFormat { kDateFull = 1, kDateShort = 2, kTime = 4, kDateTimeFull = 5, kDateTimeShort = 6, kAddYear = 16, kSimplify = 32 } |
Functions | |
| MBASE_PUBLIC QDateTime | mythCurrentDateTime () |
| Returns the current QDateTime object, stripped of its msec component. | |
| MBASE_PUBLIC int | calc_utc_offset (void) |
| MBASE_PUBLIC QString | getTimeZoneID (void) |
| Returns the zoneinfo time zone ID or as much time zone information as possible. | |
| MBASE_PUBLIC bool | checkTimeZone (void) |
| Verifies the time zone settings on this system agree with those on the master backend. | |
| MBASE_PUBLIC bool | checkTimeZone (const QStringList &master_settings) |
| This overloaded version allows for the use of an existing (not managed by MythContext) connection to the backend. | |
| MBASE_PUBLIC QDateTime | MythUTCToLocal (const QDateTime &utc) |
| Converts a QDateTime in UTC to local time. | |
| MBASE_PUBLIC int | MythSecsTo (const QDateTime &from, const QDateTime &to) |
| Returns "'to' - 'from'" for two QDateTime's in seconds. | |
| MBASE_PUBLIC QDateTime | myth_dt_from_string (const QString &dtstr) |
| MBASE_PUBLIC QString | MythDateTimeToString (const QDateTime &datetime, uint format=kDateTimeFull) |
| MBASE_PUBLIC QString | MythDateToString (const QDate &date, uint format=kDateFull) |
| MBASE_PUBLIC QString | MythTimeToString (const QTime &time, uint format=kTime) |
| MBASE_PUBLIC bool | getUptime (time_t &uptime) |
| Returns uptime statistics. | |
| MBASE_PUBLIC bool | getMemStats (int &totalMB, int &freeMB, int &totalVM, int &freeVM) |
| Returns memory statistics in megabytes. | |
| MBASE_PUBLIC bool | hasUtf8 (const char *str) |
| Guess whether a string is UTF-8. | |
| MBASE_PUBLIC bool | ping (const QString &host, int timeout) |
| Can we ping host within timeout seconds? | |
| MBASE_PUBLIC bool | telnet (const QString &host, int port) |
| Can we talk to port on host? | |
| MBASE_PUBLIC long long | copy (QFile &dst, QFile &src, uint block_size=0) |
| Copies src file to dst file. | |
| MBASE_PUBLIC QString | createTempFile (QString name_template="/tmp/mythtv_XXXXXX", bool dir=false) |
| MBASE_PUBLIC void | makeFileAccessible (QString filename) |
| Makes a file accessible to all frontends/backends. | |
| MBASE_PUBLIC QString | getResponse (const QString &query, const QString &def) |
| In an interactive shell, prompt the user to input a string. | |
| MBASE_PUBLIC int | intResponse (const QString &query, int def) |
| In an interactive shell, prompt the user to input a number. | |
| MBASE_PUBLIC QString | getSymlinkTarget (const QString &start_file, QStringList *intermediaries=NULL, unsigned maxLinks=255) |
| MBASE_PUBLIC void | sendPlaybackStart () |
| MBASE_PUBLIC void | sendPlaybackEnd () |
| MBASE_PUBLIC void | wrapList (QStringList &list, int width) |
| float | clamp (float val, float minimum, float maximum) |
| int | clamp (int val, int minimum, int maximum) |
| float | lerp (float r, float a, float b) |
| int | lerp (float r, int a, int b) |
| float | sq (float a) |
| int | sq (int a) |
| static QString | xml_bool_to_string (bool val) |
| MBASE_PUBLIC QString | xml_indent (uint level) |
| MBASE_PUBLIC bool | IsMACAddress (QString MAC) |
| MBASE_PUBLIC bool | WakeOnLAN (QString MAC) |
| MBASE_PUBLIC QString | FileHash (QString filename) |
| MBASE_PUBLIC bool | IsPulseAudioRunning (void) |
| Is A/V Sync destruction daemon is running on this host? | |
| MBASE_PUBLIC bool | myth_nice (int val) |
| MBASE_PUBLIC void | myth_yield (void) |
| MBASE_PUBLIC bool | myth_ioprio (int val) |
| MBASE_PUBLIC bool | MythRemoveDirectory (QDir &aDir) |
| MBASE_PUBLIC QString & | ShellEscape (QString &string) |
| MBASE_PUBLIC void | setHttpProxy (void) |
| Get network proxy settings from OS, and use for [Q]Http[Comms]. | |
| void | rdtsc (uint64_t &x) |
| enum DateTimeFormat |
| MBASE_PUBLIC QDateTime mythCurrentDateTime | ( | ) |
Returns the current QDateTime object, stripped of its msec component.
Definition at line 58 of file util.cpp.
Referenced by DTVRecorder::BufferedWrite(), checkTimeZone(), ProgramInfo::clear(), TVRec::FinishedRecording(), Scheduler::GetAllScheduled(), Scheduler::GetNextLiveTVDir(), TVRec::GetProgramRingBufferForLiveTV(), Myth::GetTimeZone(), BaseRequestHandler::HandleQueryTimeZone(), MainServer::HandleQueryTimeZone(), Scheduler::HandleRecording(), DTVRecorder::HandleTimestamps(), ThemeChooser::Load(), ProgramInfo::MarkAsInUse(), and TV::ProcessNetworkControlCommand().
| MBASE_PUBLIC int calc_utc_offset | ( | void | ) |
Definition at line 166 of file util.cpp.
Referenced by calc_eit_utc_offset(), checkTimeZone(), Myth::GetTimeZone(), BaseRequestHandler::HandleQueryTimeZone(), MainServer::HandleQueryTimeZone(), and MPEGStreamData::MPEGStreamData().
| MBASE_PUBLIC QString getTimeZoneID | ( | void | ) |
Returns the zoneinfo time zone ID or as much time zone information as possible.
Definition at line 431 of file util.cpp.
Referenced by checkTimeZone(), connect_to_master(), Myth::GetTimeZone(), BaseRequestHandler::HandleQueryTimeZone(), and MainServer::HandleQueryTimeZone().
| MBASE_PUBLIC bool checkTimeZone | ( | void | ) |
Verifies the time zone settings on this system agree with those on the master backend.
Definition at line 502 of file util.cpp.
Referenced by checkTimeZone(), connect_to_master(), and BackendConnectionManager::customEvent().
| MBASE_PUBLIC bool checkTimeZone | ( | const QStringList & | master_settings | ) |
This overloaded version allows for the use of an existing (not managed by MythContext) connection to the backend.
| MBASE_PUBLIC QDateTime MythUTCToLocal | ( | const QDateTime & | utc | ) |
Converts a QDateTime in UTC to local time.
Definition at line 623 of file util.cpp.
Referenced by EITHelper::AddEIT(), fromXMLTVDate(), DataDirectProcessor::GetDDProgramsEndAt(), DataDirectProcessor::GetDDProgramsStartAt(), DataDirectProcessor::GrabNextSuggestedTime(), and DDStructureParser::startElement().
| MBASE_PUBLIC int MythSecsTo | ( | const QDateTime & | from, |
| const QDateTime & | to | ||
| ) |
Returns "'to' - 'from'" for two QDateTime's in seconds.
Definition at line 614 of file util.cpp.
Referenced by calc_utc_offset(), and MythUTCToLocal().
| MBASE_PUBLIC QDateTime myth_dt_from_string | ( | const QString & | dtstr | ) |
Definition at line 66 of file util.cpp.
Referenced by ProgramInfo::ExtractKeyFromPathname(), getProgramInfoForFile(), MainServer::HandleDeleteRecording(), MainServer::HandleQueryRecording(), PlaybackBox::processNetworkControlCommand(), and CommandLineArg::Set().
| MBASE_PUBLIC QString MythDateTimeToString | ( | const QDateTime & | datetime, |
| uint | format = kDateTimeFull |
||
| ) |
Definition at line 86 of file util.cpp.
Referenced by ManualSchedule::Create(), PlaybackBox::CreateProgramInfoString(), StatusBox::doAutoExpireList(), StatusBox::doJobQueueStatus(), StatusBox::doListingsStatus(), StatusBox::doLogEntries(), HttpStatus::FillStatusXML(), GuideGrid::fillTimeInfos(), ProgLister::FillViewList(), ZMPlayer::getEventInfo(), ProgDetails::loadPage(), MythFrontendStatus::ProcessRequest(), ProgramInfo::ProgramInfo(), ProgLister::SetViewFromTime(), ProgLister::SwitchToNextView(), ProgLister::SwitchToPreviousView(), RecordingRule::ToMap(), ResultItem::toMap(), Metadata::toMap(), MetadataLookup::toMap(), ProgramInfo::ToMap(), GuideGrid::updateDateText(), ProgramRecPriority::updateInfo(), MythNews::updateInfoView(), ProgramRecPriority::UpdateList(), RecordingSelector::updateRecordingList(), ProgFinder::updateTimesList(), ZMEvents::updateUIList(), and PlaybackBox::UpdateUILists().
| MBASE_PUBLIC QString MythDateToString | ( | const QDate & | date, |
| uint | format = kDateFull |
||
| ) |
Definition at line 110 of file util.cpp.
Referenced by VideoListImp::buildGroupList(), MythTimeInputDialog::Create(), ViewScheduled::FillList(), ViewScheduled::LoadList(), ProgDetails::loadPage(), MythDateTimeToString(), RecordingRule::ToMap(), VideoMetadata::toMap(), MetadataLookup::toMap(), and ProgramInfo::ToMap().
| MBASE_PUBLIC QString MythTimeToString | ( | const QTime & | time, |
| uint | format = kTime |
||
| ) |
Definition at line 153 of file util.cpp.
Referenced by MythTimeInputDialog::Create(), GuideGrid::fillTimeInfos(), MythDateTimeToString(), and RecordingRule::ToMap().
Returns uptime statistics.
Definition at line 638 of file util.cpp.
Referenced by StatusBox::doMachineStatus(), BaseRequestHandler::HandleQueryUptime(), MainServer::HandleQueryUptime(), and NetworkControl::processQuery().
Returns memory statistics in megabytes.
Definition at line 685 of file util.cpp.
Referenced by StatusBox::doMachineStatus(), BaseRequestHandler::HandleQueryMemStats(), MainServer::HandleQueryMemStats(), and NetworkControl::processQuery().
Can we ping host within timeout seconds?
Some unixes don't like the -t argument. To make sure a ping failure is actually caused by a defunct server, we might have to do a ping without the -t, which will cause a long timeout.
Definition at line 798 of file util.cpp.
Referenced by setHttpProxy(), and MythContextPrivate::TestDBconnection().
Copies src file to dst file.
If the dst file is open, it must be open for writing. If the src file is open, if must be open for reading.
The files will be in the same open or close state after this function runs as they were prior to this function being called.
This function does not care if the files are actual files. For compatibility with pipes and socket streams the file location will not be reset to 0 at the end of this function. If the function is successful the file pointers will be at the end of the copied data.
| dst | Destination QFile |
| src | Source QFile |
| block_size | Optional block size in bytes, must be at least 1024, otherwise the default of 16 KB will be used. |
Definition at line 873 of file util.cpp.
Referenced by VAAPIContext::CopySurfaceToFrame(), VideoVisualGoom::Draw(), PrivateDecoderCrystalHD::GetFrame(), ImportRecorder::Open(), MythImage::Reflect(), strDup(), strDupSize(), trail_space(), and ThumbFinder::updateThumb().
| MBASE_PUBLIC QString createTempFile | ( | QString | name_template = "/tmp/mythtv_XXXXXX", |
| bool | dir = false |
||
| ) |
Definition at line 930 of file util.cpp.
Referenced by Playlist::CreateCDMP3(), DataDirectProcessor::CreateTemp(), DBUtil::CreateTemporaryDBConf(), and FillData::GrabData().
| MBASE_PUBLIC void makeFileAccessible | ( | QString | filename | ) |
Makes a file accessible to all frontends/backends.
This function abstracts the functionality of making a file accessible to all frontends and backends. Currently it contains a permissions hack that makes a file accessible even on a system with an improperly configured environment (umask/group) where the frontend and backend are being run as different users or where a NFS share is used but UID's/GID's differ on different hosts.
Though the function currently only changes the file mode to 0666, by abstracting the functionality, it will be easier to make changes in the future if a better approach is chosen. Similarly, using this function allows the hack to be applied only when required if code is written to detect or allow the user to specify their system is misconfigured.
| filename | Path of file to make accessible |
Definition at line 1002 of file util.cpp.
Referenced by DataDirectProcessor::SaveLineupToCache(), and PreviewGenerator::SavePreview().
| MBASE_PUBLIC QString getResponse | ( | const QString & | query, |
| const QString & | def | ||
| ) |
In an interactive shell, prompt the user to input a string.
Definition at line 1011 of file util.cpp.
Referenced by intResponse(), ChannelData::promptForChannelUpdates(), MythContextPrivate::PromptForDatabaseParams(), and SchemaUpgradeWizard::PromptForUpgrade().
| MBASE_PUBLIC int intResponse | ( | const QString & | query, |
| int | def | ||
| ) |
In an interactive shell, prompt the user to input a number.
Definition at line 1050 of file util.cpp.
Referenced by MythContextPrivate::PromptForDatabaseParams().
| MBASE_PUBLIC QString getSymlinkTarget | ( | const QString & | start_file, |
| QStringList * | intermediaries = NULL, |
||
| unsigned | maxLinks = 255 |
||
| ) |
Definition at line 1061 of file util.cpp.
Referenced by CompleteJob(), MainServer::DeleteFile(), ProgramInfo::DiscoverRecordingDirectory(), MythMediaDevice::findMountPath(), MediaMonitor::MediaMonitor(), MythMediaDevice::MythMediaDevice(), and DeleteThread::ProcessNew().
| MBASE_PUBLIC void sendPlaybackStart | ( | ) |
Definition at line 1116 of file util.cpp.
Referenced by VideoPlayMythSystem::Play(), playDisc(), and TV::StartTV().
| MBASE_PUBLIC void sendPlaybackEnd | ( | ) |
Definition at line 1122 of file util.cpp.
Referenced by VideoPlayMythSystem::Play(), playDisc(), and TV::StartTV().
Definition at line 1545 of file util.cpp.
Referenced by CommandLineArg::GetHelpString(), and CommandLineArg::GetLongHelpString().
| float clamp | ( | float | val, |
| float | minimum, | ||
| float | maximum | ||
| ) | [inline] |
Definition at line 75 of file util.h.
Referenced by ClassicCommDetector::CleanupFrameInfo(), ProgramInfo::LoadProgramFromRecorded(), RecordingInfo::RecordingInfo(), and MythPlayer::ToggleNightMode().
| float lerp | ( | float | r, |
| float | a, | ||
| float | b | ||
| ) | [inline] |
| float sq | ( | float | a | ) | [inline] |
Definition at line 91 of file util.h.
Referenced by VideoVisualSpectrum::Draw(), SingleView::EffectCircleOut(), SingleView::EffectMultiCircleOut(), VideoOutWindow::GetVisibleOSDBounds(), and Spectrum::process().
| static QString xml_bool_to_string | ( | bool | val | ) | [inline, static] |
Definition at line 94 of file util.h.
Referenced by ModulationModeSubtable::toStringXML(), DefinedChannelsMapSubtable::toStringXML(), VirtualChannelMapSubtable::toStringXML(), SystemTimeTable::toStringXML(), SpliceInsertView::toStringXML(), VirtualChannelTable::XMLChannelValues(), CableVirtualChannelTable::XMLChannelValues(), and PSIPTable::XMLValues().
| MBASE_PUBLIC QString xml_indent | ( | uint | level | ) |
Definition at line 1589 of file util.cpp.
Referenced by VirtualChannelTable::ChannelStringXML(), RecordingQuality::toStringXML(), CarrierDefinitionSubtable::toStringXML(), SpliceDescriptor::toStringXML(), MasterGuideTable::toStringXML(), ModulationModeSubtable::toStringXML(), MPEGDescriptor::toStringXML(), SCTENetworkInformationTable::toStringXML(), NetworkTextTable::toStringXML(), VirtualChannelTable::toStringXML(), DefinedChannelsMapSubtable::toStringXML(), VirtualChannelMapSubtable::toStringXML(), PSIPTable::toStringXML(), InverseChannelMapSubtable::toStringXML(), ProgramAssociationTable::toStringXML(), ShortVirtualChannelTable::toStringXML(), SCTESystemTimeTable::toStringXML(), ProgramMapTable::toStringXML(), SystemTimeTable::toStringXML(), ConditionalAccessTable::toStringXML(), SpliceTimeView::toStringXML(), SpliceInsertView::toStringXML(), SpliceInformationTable::toStringXML(), VirtualChannelTable::XMLChannelValues(), and PSIPTable::XMLValues().
| MBASE_PUBLIC bool IsMACAddress | ( | QString | MAC | ) |
Definition at line 1128 of file util.cpp.
Referenced by Scheduler::WakeUpSlave().
Definition at line 1216 of file util.cpp.
Referenced by Scheduler::WakeUpSlave().
| MBASE_PUBLIC QString FileHash | ( | QString | filename | ) |
Definition at line 1175 of file util.cpp.
Referenced by Video::AddVideo(), Content::GetHash(), FileServerHandler::HandleQueryFileHash(), MainServer::HandleQueryFileHash(), UpdateHashes(), and VideoMetadata::VideoFileHash().
| MBASE_PUBLIC bool IsPulseAudioRunning | ( | void | ) |
Is A/V Sync destruction daemon is running on this host?
Definition at line 1258 of file util.cpp.
Referenced by AudioOutput::OpenAudio(), and PulseHandler::Suspend().
Definition at line 1276 of file util.cpp.
Referenced by JobQueue::DoTranscodeThread(), JobQueue::DoUserJobThread(), MythSystemUnix::Fork(), MythPlayer::InitAVSync(), main(), and NuppelVideoRecorder::run().
| MBASE_PUBLIC void myth_yield | ( | void | ) |
| MBASE_PUBLIC bool myth_ioprio | ( | int | val | ) |
Definition at line 1352 of file util.cpp.
Referenced by JobQueue::DoTranscodeThread(), JobQueue::DoUserJobThread(), MythSystemUnix::Fork(), and main().
| MBASE_PUBLIC bool MythRemoveDirectory | ( | QDir & | aDir | ) |
Definition at line 1382 of file util.cpp.
Referenced by NativeArchive::doNativeArchive(), MythBurn::MythBurn(), and MythRemoveDirectory().
| MBASE_PUBLIC QString& ShellEscape | ( | QString & | string | ) |
Definition at line 1415 of file util.cpp.
Referenced by Search::executeSearch().
| MBASE_PUBLIC void setHttpProxy | ( | void | ) |
Get network proxy settings from OS, and use for [Q]Http[Comms].
The HTTP_PROXY environment var. is parsed for values like; "proxy-host", "proxy-host:8080", "http://host:8080" and "http"//user:password:1080", and that is used for any Qt-based Http fetches. We also test connectivity here with ping and telnet, and warn if it fails.
If there is was no env. var, we use Qt to get proxy settings from the OS, and search through them for a proxy server we can connect to.
Definition at line 1443 of file util.cpp.
Referenced by main().
1.7.6.1