Go to the source code of this file.
Classes | |
| class | MythTimer |
| struct | timing_ab_t |
Functions | |
| MPUBLIC QDateTime | mythCurrentDateTime () |
| Returns the current QDateTime object, stripped of its msec component. | |
| MPUBLIC int | calc_utc_offset (void) |
| MPUBLIC long long | absLongLong (long long n) |
| MPUBLIC void | encodeLongLong (QStringList &list, long long num) |
| Encodes a long for streaming in the MythTV protocol. | |
| MPUBLIC long long | decodeLongLong (QStringList &list, uint offset) |
| Inefficiently decodes a long encoded for streaming in the MythTV protocol. | |
| MPUBLIC long long | decodeLongLong (QStringList &list, QStringList::const_iterator &it) |
| Decodes a long encoded for streaming in the MythTV protocol. | |
| MPUBLIC QRgb | blendColors (QRgb source, QRgb add, int alpha) |
| Inefficient alpha blending function. | |
| MPUBLIC uint | myth_system (const QString &command, int flags=0) |
| Runs a system command inside the /bin/sh shell. | |
| MPUBLIC QString | cutDownString (const QString &text, QFont *testFont, uint maxwidth) |
| Returns a string based on "text" that fits within "maxwidth" pixels. | |
| MPUBLIC QDateTime | MythUTCToLocal (const QDateTime &utc) |
| Converts a QDateTime in UTC to local time. | |
| MPUBLIC int | MythSecsTo (const QDateTime &from, const QDateTime &to) |
| Returns "'to' - 'from'" for two QDateTime's in seconds. | |
| MPUBLIC long long | stringToLongLong (const QString &str) |
| Converts QString representing long long to a long long. | |
| MPUBLIC QString | longLongToString (long long ll) |
| Returns QString representation of long long. | |
| MPUBLIC long long | getDiskSpace (const QString &, long long &, long long &) |
| Returns free space on disk containing file in KiB, or -1 if it does not succeed. | |
| MPUBLIC bool | getUptime (time_t &uptime) |
| Returns uptime statistics. | |
| MPUBLIC bool | getMemStats (int &totalMB, int &freeMB, int &totalVM, int &freeVM) |
| Returns memory statistics in megabytes. | |
| MPUBLIC void | myth_eject (void) |
| Eject a disk, unmount a drive, open a tray. | |
| MPUBLIC bool | hasUtf8 (const char *str) |
| Quess whether a string is UTF-8. | |
| MPUBLIC bool | ping (const QString &host, int timeout) |
| Can we ping host within timeout seconds? | |
| MPUBLIC bool | telnet (const QString &host, int port) |
| Can we talk to port on host? | |
| MPUBLIC long long | copy (QFile &dst, QFile &src, uint block_size=0) |
| Copies src file to dst file. | |
| MPUBLIC QString | createTempFile (QString name_template="/tmp/mythtv_XXXXXX", bool dir=false) |
| MPUBLIC unsigned long long | myth_get_approximate_large_file_size (const QString &fname) |
| MPUBLIC double | MythGetPixelAspectRatio (void) |
| MPUBLIC bool | IsPulseAudioRunning (void) |
| Is A/V Sync destruction daemon is running on this host? | |
| void | rdtsc (uint64_t &x) |
| MPUBLIC QDateTime mythCurrentDateTime | ( | ) |
Returns the current QDateTime object, stripped of its msec component.
Definition at line 73 of file util.cpp.
Referenced by TVRec::FinishedRecording(), ProgramInfo::GetDVDBookmark(), Scheduler::GetNextLiveTVDir(), TVRec::GetProgramRingBufferForLiveTV(), ProgramInfo::MarkAsInUse(), TV::ProcessNetworkControlCommand(), ProgramInfo::ProgramInfo(), and Scheduler::RunScheduler().
| MPUBLIC int calc_utc_offset | ( | void | ) |
Definition at line 81 of file util.cpp.
Referenced by calc_eit_utc_offset(), and MPEGStreamData::MPEGStreamData().
| MPUBLIC long long absLongLong | ( | long long | n | ) | [inline] |
Definition at line 49 of file util.h.
Referenced by BackendQueryDiskSpace(), computeBreakMap(), GetFilesystemInfos(), and NuppelVideoPlayer::HandleSelect().
| MPUBLIC void encodeLongLong | ( | QStringList & | list, | |
| long long | num | |||
| ) |
Encodes a long for streaming in the MythTV protocol.
We need this for Qt3.1 compatibility, since it will not print or read a 64 bit number directly. We encode the long long as strings representing two signed 32 bit integers.
Definition at line 111 of file util.cpp.
Referenced by BackendQueryDiskSpace(), PlaybackSock::GenPreviewPixmap(), RemoteEncoder::GetKeyframePosition(), MainServer::HandleAnnounce(), MainServer::HandleBookmarkQuery(), MainServer::HandleCutMapQuery(), MainServer::HandleFileTransferQuery(), MainServer::HandleRecorderQuery(), MainServer::HandleRemoteEncoder(), PreviewGenerator::RemotePreviewRun(), and RemoteFile::Seek().
| MPUBLIC long long decodeLongLong | ( | QStringList & | list, | |
| uint | offset | |||
| ) |
Inefficiently decodes a long encoded for streaming in the MythTV protocol.
We need this for Qt3.1 compatibility, since it will not print or read a 64 bit number directly.
The long long is represented as two signed 32 bit integers.
Note: This decode performs two O(n) linear searches of the list, The iterator decode function is much more efficient.
| list | List to search for offset and offset+1 in. | |
| offset | Offset in list where to find first 32 bits of long long. |
Definition at line 134 of file util.cpp.
Referenced by BackendQueryDiskSpace(), RemoteEncoder::FillPositionMap(), HttpStatus::FillStatusXML(), RemoteEncoder::GetFilePosition(), GetFilesystemInfos(), RemoteEncoder::GetFramesWritten(), RemoteEncoder::GetKeyframePosition(), RemoteEncoder::GetMaxBitrate(), PlaybackSock::GetMaxBitrate(), MainServer::HandleFileTransferQuery(), MainServer::HandleGenPreviewPixmap(), MainServer::HandleRecorderQuery(), MainServer::HandleSetBookmark(), RemoteFile::openSocket(), RemoteGetFreeSpace(), and RemoteFile::Seek().
| MPUBLIC long long decodeLongLong | ( | QStringList & | list, | |
| QStringList::const_iterator & | it | |||
| ) |
Decodes a long encoded for streaming in the MythTV protocol.
We need this for Qt3.1 compatibility, since it will not print or read a 64 bit number directly.
The long long is represented as two signed 32 bit integers.
| list | List to search for offset and offset+1 in. | |
| it | Iterator pointing to first 32 bits of long long. |
| MPUBLIC QRgb blendColors | ( | QRgb | source, | |
| QRgb | add, | |||
| int | alpha | |||
| ) |
| MPUBLIC uint myth_system | ( | const QString & | command, | |
| int | flags | |||
| ) |
Runs a system command inside the /bin/sh shell.
Note: Returns GENERIC_EXIT_NOT_OK if it can not execute the command.
Definition at line 227 of file util.cpp.
Referenced by MythContext::BackendIsRunning(), Scheduler::CheckShutdownServer(), MythContext::ConnectServer(), JobQueue::DoFlagCommercialsThread(), JobQueue::DoTranscodeThread(), JobQueue::DoUserJobThread(), MythMediaDevice::eject(), DataDirectProcessor::GrabNextSuggestedTime(), MythThemedMenuPrivate::handleAction(), IconView::HandleImport(), IconView::ImportFromDir(), IsPulseAudioRunning(), GameHandler::Launchgame(), ThumbGenerator::loadFile(), myth_eject(), SingleView::paintEvent(), GLSingleView::paintGL(), MythMediaDevice::performMountCmd(), ping(), playDVD(), playVCD(), PlayVideo(), MythNews::playVideo(), DataDirectProcessor::Post(), ScreenSaverX11Private::ResetScreenSaver(), PreviewGenerator::Run(), HouseKeeper::RunMFD(), WelcomeDialog::runMythFillDatabase(), Scheduler::RunScheduler(), runTestDVD(), ScreenSaverX11Private::ScreenSaverX11Private(), Scheduler::ShutdownServer(), Bookmarks::slotBookmarksViewExecuted(), MythFlixQueue::slotShowNetFlixPage(), MythFlix::slotShowNetFlixPage(), MythNews::slotViewArticle(), LircClient::SpawnApp(), WelcomeDialog::startFrontend(), SourceUtil::UpdateChannelsFromListings(), TitleDialog::viewTitle(), and writeJPG().
| MPUBLIC QString cutDownString | ( | const QString & | text, | |
| QFont * | testFont, | |||
| uint | maxwidth | |||
| ) |
Returns a string based on "text" that fits within "maxwidth" pixels.
Definition at line 356 of file util.cpp.
Referenced by PlaybackBox::initPopup().
| MPUBLIC QDateTime MythUTCToLocal | ( | const QDateTime & | utc | ) |
Converts a QDateTime in UTC to local time.
Definition at line 394 of file util.cpp.
Referenced by EITHelper::AddEIT(), fromXMLTVDate(), DataDirectProcessor::GetDDProgramsEndAt(), DataDirectProcessor::GetDDProgramsStartAt(), DataDirectProcessor::GrabNextSuggestedTime(), and DDStructureParser::startElement().
| MPUBLIC int MythSecsTo | ( | const QDateTime & | from, | |
| const QDateTime & | to | |||
| ) |
Returns "'to' - 'from'" for two QDateTime's in seconds.
Definition at line 385 of file util.cpp.
Referenced by calc_utc_offset(), and MythUTCToLocal().
| MPUBLIC long long stringToLongLong | ( | const QString & | str | ) |
Converts QString representing long long to a long long.
This is needed to input 64 bit numbers with Qt 3.1.
Definition at line 410 of file util.cpp.
Referenced by UPnpCDSTv::AddItem(), TV::customEvent(), AutoExpire::ExpireEpisodesOverMax(), AutoExpire::FillDBOrdered(), ProgramList::FromRecorded(), ProgramInfo::GetFilesize(), ProgramInfo::GetProgramFromRecorded(), and MainServer::HandleQueryRecordings().
| MPUBLIC QString longLongToString | ( | long long | ll | ) |
Returns QString representation of long long.
This is needed to output 64 bit numbers with Qt 3.1.
Definition at line 425 of file util.cpp.
Referenced by UPnpCDSTv::AddItem(), MythXML::FillProgramInfo(), StorageGroup::FindNextDirMostFree(), ProgramInfo::SetFilesize(), and ProgramInfo::ToMap().
| MPUBLIC long long getDiskSpace | ( | const QString & | file_on_disk, | |
| long long & | total, | |||
| long long & | used | |||
| ) |
Returns free space on disk containing file in KiB, or -1 if it does not succeed.
| file_on_disk | file on the file system we wish to stat. |
Definition at line 484 of file util.cpp.
Referenced by BackendQueryDiskSpace(), NativeArchive::copyFile(), MythburnWizard::filenameEditLostFocus(), ExportNativeWizard::filenameEditLostFocus(), StorageGroup::FindNextDirMostFree(), getMemStats(), MythburnWizard::setDestination(), and ExportNativeWizard::setDestination().
| MPUBLIC bool getUptime | ( | time_t & | uptime | ) |
Returns uptime statistics.
Definition at line 438 of file util.cpp.
Referenced by StatusBox::doMachineStatus(), and MainServer::HandleQueryUptime().
| MPUBLIC bool getMemStats | ( | int & | totalMB, | |
| int & | freeMB, | |||
| int & | totalVM, | |||
| int & | freeVM | |||
| ) |
Returns memory statistics in megabytes.
Definition at line 522 of file util.cpp.
Referenced by StatusBox::doMachineStatus(), and MainServer::HandleQueryMemStats().
| MPUBLIC void myth_eject | ( | void | ) |
Eject a disk, unmount a drive, open a tray.
If the Media Monitor is enabled, we use its fully-featured routine. Otherwise, we guess a drive and use a primitive OS-specific command
Definition at line 586 of file util.cpp.
Referenced by MythThemedMenuPrivate::handleAction(), IconView::HandleEject(), and MythThemedMenuPrivate::keyHandler().
| MPUBLIC bool hasUtf8 | ( | const char * | str | ) |
| MPUBLIC bool ping | ( | const QString & | host, | |
| int | timeout | |||
| ) |
Can we ping host within timeout seconds?
Definition at line 689 of file util.cpp.
Referenced by MythContextPrivate::TestDBconnection().
| MPUBLIC bool telnet | ( | const QString & | host, | |
| int | port | |||
| ) |
Can we talk to port on host?
Definition at line 800 of file util.cpp.
Referenced by MythContextPrivate::TestDBconnection().
| MPUBLIC long long copy | ( | QFile & | dst, | |
| QFile & | src, | |||
| uint | block_size | |||
| ) |
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 succesful 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. |
| MPUBLIC QString createTempFile | ( | QString | name_template = "/tmp/mythtv_XXXXXX", |
|
| bool | dir = false | |||
| ) |
Definition at line 889 of file util.cpp.
Referenced by DataDirectProcessor::CreateTempDirectory(), DBUtil::DoBackup(), DataDirectProcessor::GetCookieFilename(), DataDirectProcessor::GetPostFilename(), DataDirectProcessor::GetResultFilename(), and MetaIOOggVorbisComment::write().
| MPUBLIC unsigned long long myth_get_approximate_large_file_size | ( | const QString & | fname | ) |
| MPUBLIC double MythGetPixelAspectRatio | ( | void | ) |
| MPUBLIC bool IsPulseAudioRunning | ( | void | ) |
Is A/V Sync destruction daemon is running on this host?
Definition at line 965 of file util.cpp.
Referenced by pulseaudio_handle_startup().
| void rdtsc | ( | uint64_t & | x | ) | [inline] |
1.5.5