Go to the source code of this file.
Functions | |
| QDateTime | mythCurrentDateTime () |
| Returns the current QDateTime object, stripped of its msec component. | |
| int | calc_utc_offset (void) |
| void | encodeLongLong (QStringList &list, long long num) |
| Encodes a long for streaming in the MythTV protocol. | |
| long long | decodeLongLong (QStringList &list, uint offset) |
| Inefficiently decodes a long encoded for streaming in the MythTV protocol. | |
| long long | decodeLongLong (QStringList &list, QStringList::const_iterator &it) |
| Decodes a long encoded for streaming in the MythTV protocol. | |
| QRgb | blendColors (QRgb source, QRgb add, int alpha) |
| Inefficient alpha blending function. | |
| uint | myth_system (const QString &command, int flags) |
| Runs a system command inside the /bin/sh shell. | |
| memset & | si (si) |
| memset & | pi (pi) |
| strcpy (ch, cmd) | |
| if (!::CreateProcessA(NULL, ch, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL,&si,&pi)) | |
| QString | cutDownString (const QString &text, QFont *testFont, uint maxwidth) |
| Returns a string based on "text" that fits within "maxwidth" pixels. | |
| int | MythSecsTo (const QDateTime &from, const QDateTime &to) |
| Returns "'to' - 'from'" for two QDateTime's in seconds. | |
| QDateTime | MythUTCToLocal (const QDateTime &utc) |
| Converts a QDateTime in UTC to local time. | |
| long long | stringToLongLong (const QString &str) |
| Converts QString representing long long to a long long. | |
| QString | longLongToString (long long ll) |
| Returns QString representation of long long. | |
| bool | getUptime (time_t &uptime) |
| Returns uptime statistics. | |
| 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. | |
| bool | getMemStats (int &totalMB, int &freeMB, int &totalVM, int &freeVM) |
| Returns memory statistics in megabytes. | |
| void | myth_eject () |
| Eject a disk, unmount a drive, open a tray. | |
| bool | hasUtf8 (const char *str) |
| Quess whether a string is UTF-8. | |
| u_short | in_cksum (u_short *addr, int len) |
| bool | ping (const QString &host, int timeout) |
| Can we ping host within timeout seconds? | |
| bool | telnet (const QString &host, int port) |
| Can we talk to port on host? | |
| long long | copy (QFile &dst, QFile &src, uint block_size) |
| Copies src file to dst file. | |
| QString | createTempFile (QString name_template, bool dir) |
| double | MythGetPixelAspectRatio (void) |
| unsigned long long | myth_get_approximate_large_file_size (const QString &fname) |
| bool | IsPulseAudioRunning (void) |
| Is A/V Sync destruction daemon is running on this host? | |
Variables | |
| STARTUPINFO | si |
| PROCESS_INFORMATION | pi |
| si | cb = sizeof(si) |
| QString | cmd = QString("cmd.exe /c %1").arg(command.utf8()).ascii() |
| char * | ch = new char[cmd.length() + 1] |
| 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().
| int calc_utc_offset | ( | void | ) |
Definition at line 81 of file util.cpp.
Referenced by calc_eit_utc_offset(), and MPEGStreamData::MPEGStreamData().
| 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().
| 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().
| 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. |
| blendColors | ( | QRgb | source, | |
| QRgb | add, | |||
| int | alpha | |||
| ) |
| 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().
| memset& si | ( | si | ) |
| memset& pi | ( | pi | ) |
Referenced by avcodec_string(), DatabaseBox::BlankCDRW(), bsd_block2char(), MHResidentProgram::CallProgram(), checkfor_cid_info(), GetMySipIp(), getVolName(), main(), match_in_phonebook(), matroska_add_stream(), matroska_read_header(), mp3_header_compress(), SipFsm::OpenSocket(), rtp::OpenSocket(), process_line(), replace(), setup_snd_socket(), sub_read_line_subrip(), sun_block2char(), sup2dast(), tcp_open(), url_open(), and vcedit_open_callbacks().
| if | ( | !:: | CreateProcessANULL, ch, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL,&si,&pi | ) |
| 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().
| 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().
| 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().
| 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().
| 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().
| getUptime | ( | time_t & | uptime | ) |
Returns uptime statistics.
Definition at line 438 of file util.cpp.
Referenced by StatusBox::doMachineStatus(), and MainServer::HandleQueryUptime().
| 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().
| 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().
| 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().
| bool hasUtf8 | ( | const char * | str | ) |
| u_short in_cksum | ( | u_short * | addr, | |
| int | len | |||
| ) |
| 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().
| 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().
| 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. |
| QString createTempFile | ( | QString | name_template, | |
| bool | dir | |||
| ) |
Definition at line 889 of file util.cpp.
Referenced by DataDirectProcessor::CreateTempDirectory(), DBUtil::DoBackup(), DataDirectProcessor::GetCookieFilename(), DataDirectProcessor::GetPostFilename(), DataDirectProcessor::GetResultFilename(), and MetaIOOggVorbisComment::write().
| double MythGetPixelAspectRatio | ( | void | ) |
| unsigned long long myth_get_approximate_large_file_size | ( | const QString & | fname | ) |
| 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().
| STARTUPINFO si |
Definition at line 325 of file util.cpp.
Referenced by ScreenSetup::activeListItemSelected(), decode_nal(), NuppelVideoPlayer::DefineWindow(), ScreenSetup::doListSelect(), LocationDialog::doSearch(), exec_screen(), SourceManager::findPossibleSources(), SourceManager::findScriptsDB(), GuideGrid::GetAlternateChannelIndex(), GuideGrid::GetSelection(), DecoderBase::GetTrackInfo(), gxf_header(), SourceSetup::loadData(), ScreenSetup::loadData(), SourceManager::needSourceFor(), q_exec_screen(), SourceSetup::retrieveSpinboxUpdate(), SourceSetup::saveData(), ScreenSetup::saveData(), AvFormatDecoder::ScanATSCCaptionStreams(), AvFormatDecoder::ScanTeletextCaptions(), SourceSetup::sourceListItemSelected(), VideoListImp::update_meta_view(), ScreenSetup::updateHelpText(), and SourceSetup::updateSpinboxUpdate().
| PROCESS_INFORMATION pi |
Definition at line 326 of file util.cpp.
Referenced by av_audio_convert(), TVRec::CheckForRecGroupChange(), ProgLister::customEdit(), PreviousList::customEdit(), PlaybackBox::customEdit(), TV::customEvent(), MainServer::customEvent(), PreviousList::deleteItem(), ViewScheduleDiff::details(), ProgLister::details(), PreviousList::details(), ViewScheduleDiff::edit(), ProgLister::edit(), PreviousList::edit(), TVRec::FinishedRecording(), gear(), if(), ProgLister::quickRecord(), PreviousList::removalDialog(), ProgLister::remove(), ProgLister::select(), ViewScheduleDiff::statusDialog(), ViewScheduleDiff::upcoming(), ProgLister::upcoming(), PreviousList::upcoming(), ProgLister::updateInfo(), PreviousList::updateInfo(), ProgLister::updateList(), and PreviousList::updateList().
| si cb = sizeof(si) |
Definition at line 329 of file util.cpp.
Referenced by aiw_read_picture(), AutoExpireInsteadOfDelete(), OSDSurface::BlendToARGB(), blendtoargb_8_c(), create_vorbis_context(), decode_frame(), DeletedFifoOrder(), dvbsub_parse_clut_segment(), encode_q_branch(), DVDRingBufferPriv::guess_palette(), handle_intra_block(), handle_p_b_block(), idct_put(), ready_residue(), set2palettes(), uyvy422_to_yuv420p(), uyvy422_to_yuv422p(), uyyvyy411_to_yuv411p(), vorbis_parse_setup_hdr_codebooks(), yuv420_argb32_non_mmx(), yuv422p_to_uyvy422(), yuv422p_to_yuyv422(), yuv_a_to_rgba(), yuyv422_to_yuv420p(), and yuyv422_to_yuv422p().
Definition at line 330 of file util.cpp.
Referenced by av_set_string(), cin_decode_lzss(), decode_dvd_subtitles(), DVDRingBufferPriv::DecodeSubtitles(), ScreenSetup::doListSelect(), StatusBox::doTunerStatus(), dump_extradata(), DiSEqCDevSwitch::ExecuteDiseqc(), MythFlixQueue::executeExternal(), MythFlix::executeExternal(), executeExternal(), DiSEqCDevRotor::ExecuteUSALS(), FirewireDevice::GetPowerState(), AVCInfo::GetSubunitInfo(), IconView::HandleImport(), IconView::ImportFromDir(), iv_Decode_Chunk(), WelcomeDialog::keyPressEvent(), GameHandler::Launchgame(), ThumbGenerator::loadFile(), main(), main_cmd(), SingleView::paintEvent(), GLSingleView::paintGL(), pxsubtitle(), RemoteGetConflictList(), RemoteGetRecordingMask(), RemoteGetRecordingStatus(), remove_extradata(), rtsp_read_close(), rtsp_read_header(), rtsp_read_pause(), rtsp_read_play(), mythvideo_videomanager::VideoPosterSearch::Run(), mythvideo_videomanager::VideoUIDSearch::Run(), mythvideo_videomanager::VideoTitleSearch::Run(), LinuxAVCInfo::SendAVCCommand(), set_chan_fast(), set_chan_slow(), FirewireDevice::SetChannel(), FirewireDevice::SetPowerState(), MythCDROMLinux::setSpeed(), shorten_decode_frame(), Bookmarks::slotBookmarksViewExecuted(), MythFlixQueue::slotShowNetFlixPage(), MythFlix::slotShowNetFlixPage(), MythNews::slotViewArticle(), SourceUtil::UpdateChannelsFromListings(), and vm_print_link().
| char* ch = new char[cmd.length() + 1] |
Definition at line 331 of file util.cpp.
Referenced by aac_sync(), ac3_decode_frame(), AC3_encode_frame(), AC3_encode_init(), ac3_parse_audio_block(), MHIText::AddText(), adpcm_decode_frame(), av_audio_convert(), average_quantized_coeffs(), QCodecs::base64Decode(), bit_alloc(), bit_alloc_masking(), build_sb_samples_from_noise(), UIListBtnTypeItem::CalcDimensions(), MHResidentProgram::CallProgram(), compute_bit_allocation(), copy_samples(), decode_iso6937(), do_imdct(), MHParseBinary::DoParse(), encode_block(), encode_frame(), extract_hot_key(), ff_mpc_dequantize_and_synth(), fill_coding_method_array(), fill_tone_level_array(), DiSEqCDevDevice::FindDevice(), fix_coding_method_array(), flac_encode_frame(), get_transform_coeffs(), MHIText::GetBounds(), GuideGrid::GetSelection(), getSideInfo1(), getSideInfo2(), MHGenericInteger::GetValue(), http_connect(), init_frame(), init_tone_level_dequantization(), mp_decode_frame(), mp_decode_layer1(), mp_decode_layer2(), mp_decode_layer3(), mpc7_decode_frame(), mpc8_decode_frame(), mpc_synth(), OSDListBtnTypeItem::OSDListBtnTypeItem(), output_audio_block(), output_subframes(), MHParseBinary::ParseInt(), DataDirectProcessor::ParseLineup(), MHEngine::ParseProgram(), DeviceTree::PopulateTree(), MHOctetString::PrintMe(), process_subpacket_9(), NetworkControl::processKey(), putSideInfo1(), putSideInfo2(), qdm2_decode(), qdm2_fft_tone_synthesizer(), qdm2_synthesis_filter(), UIImageGridType::recalculateLayout(), MHText::Redraw(), remove_dithering(), roq_dpcm_encode_frame(), rtsp_send_cmd(), DataDirectProcessor::SaveLineup(), DataDirectProcessor::SaveLineupChanges(), DataDirectProcessor::SetAll(), DiSEqCDevSwitch::SetNumPorts(), MHIntegerVar::SetVariableValue(), sonic_decode_frame(), sonic_encode_frame(), DiSEqCDevSwitch::Store(), SwitchSetting::SwitchSetting(), synthfilt_build_sb_samples(), GuideGrid::toggleChannelFavorite(), uncouple_channels(), vorbis_parse_audio_packet(), wma_decode_block(), and wma_decode_frame().
1.5.5