CStdString CSysInfo::GetUAWindowsVersion() { OSVERSIONINFOEX osvi = {}; osvi.dwOSVersionInfoSize = sizeof(osvi); CStdString strVersion = "Windows NT"; if (GetVersionEx((OSVERSIONINFO *)&osvi)) { strVersion.AppendFormat(" %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion); } SYSTEM_INFO si = {}; GetSystemInfo(&si); BOOL bIsWow = FALSE; if (IsWow64Process(GetCurrentProcess(), &bIsWow)) { if (bIsWow) { strVersion.append(";WOW64"); GetNativeSystemInfo(&si); // different function to read the info under Wow } } if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64) strVersion.append(";Win64;x64"); else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_IA64) strVersion.append(";Win64;IA64"); return strVersion; }
void CCECProcessor::ProcessCommand(const cec_command &command) { // log the command CStdString dataStr; dataStr.Format(">> %1x%1x", command.initiator, command.destination); if (command.opcode_set == 1) dataStr.AppendFormat(":%02x", command.opcode); for (uint8_t iPtr = 0; iPtr < command.parameters.size; iPtr++) dataStr.AppendFormat(":%02x", (unsigned int)command.parameters[iPtr]); m_libcec->AddLog(CEC_LOG_TRAFFIC, dataStr.c_str()); // find the initiator CCECBusDevice *device = m_busDevices->At(command.initiator); if (device) device->HandleCommand(command); }
/// \brief Make the actual search for the OnSearch function. /// \param strSearch The search string /// \param items Items Found void CGUIDialogVideoInfo::DoSearch(CStdString& strSearch, CFileItemList& items) { CVideoDatabase db; if (!db.Open()) return; CFileItemList movies; db.GetMoviesByActor(strSearch, movies); for (int i = 0; i < movies.Size(); ++i) { CStdString label = movies[i]->GetVideoInfoTag()->m_strTitle; if (movies[i]->GetVideoInfoTag()->m_iYear > 0) label.AppendFormat(" (%i)", movies[i]->GetVideoInfoTag()->m_iYear); movies[i]->SetLabel(label); } CGUIWindowVideoBase::AppendAndClearSearchItems(movies, "[" + g_localizeStrings.Get(20338) + "] ", items); db.GetTvShowsByActor(strSearch, movies); for (int i = 0; i < movies.Size(); ++i) { CStdString label = movies[i]->GetVideoInfoTag()->m_strShowTitle; if (movies[i]->GetVideoInfoTag()->m_iYear > 0) label.AppendFormat(" (%i)", movies[i]->GetVideoInfoTag()->m_iYear); movies[i]->SetLabel(label); } CGUIWindowVideoBase::AppendAndClearSearchItems(movies, "[" + g_localizeStrings.Get(20364) + "] ", items); db.GetEpisodesByActor(strSearch, movies); for (int i = 0; i < movies.Size(); ++i) { CStdString label = movies[i]->GetVideoInfoTag()->m_strTitle + " (" + movies[i]->GetVideoInfoTag()->m_strShowTitle + ")"; movies[i]->SetLabel(label); } CGUIWindowVideoBase::AppendAndClearSearchItems(movies, "[" + g_localizeStrings.Get(20359) + "] ", items); db.GetMusicVideosByArtist(strSearch, movies); for (int i = 0; i < movies.Size(); ++i) { CStdString label = movies[i]->GetVideoInfoTag()->m_strArtist + " - " + movies[i]->GetVideoInfoTag()->m_strTitle; if (movies[i]->GetVideoInfoTag()->m_iYear > 0) label.AppendFormat(" (%i)", movies[i]->GetVideoInfoTag()->m_iYear); movies[i]->SetLabel(label); } CGUIWindowVideoBase::AppendAndClearSearchItems(movies, "[" + g_localizeStrings.Get(20391) + "] ", items); db.Close(); }
void StringUtils::SecondsToTimeString(long lSeconds, CStdString& strHMS, TIME_FORMAT format) { int hh = lSeconds / 3600; lSeconds = lSeconds % 3600; int mm = lSeconds / 60; int ss = lSeconds % 60; if (format == TIME_FORMAT_GUESS) format = (hh >= 1) ? TIME_FORMAT_HH_MM_SS : TIME_FORMAT_MM_SS; strHMS.Empty(); if (format & TIME_FORMAT_HH) strHMS.AppendFormat("%02.2i", hh); if (format & TIME_FORMAT_MM) strHMS.AppendFormat(strHMS.IsEmpty() ? "%02.2i" : ":%02.2i", mm); if (format & TIME_FORMAT_SS) strHMS.AppendFormat(strHMS.IsEmpty() ? "%02.2i" : ":%02.2i", ss); }
void CPlayListPLS::Save(const CStdString& strFileName) const { if (!m_vecItems.size()) return ; CStdString strPlaylist = CUtil::MakeLegalPath(strFileName); CFile file; if (!file.OpenForWrite(strPlaylist, true)) { CLog::Log(LOGERROR, "Could not save PLS playlist: [%s]", strPlaylist.c_str()); return; } CStdString write; write.AppendFormat("%s\n", START_PLAYLIST_MARKER); CStdString strPlayListName=m_strPlayListName; g_charsetConverter.utf8ToStringCharset(strPlayListName); write.AppendFormat("PlaylistName=%s\n", strPlayListName.c_str() ); for (int i = 0; i < (int)m_vecItems.size(); ++i) { CFileItemPtr item = m_vecItems[i]; CStdString strFileName=item->GetPath(); g_charsetConverter.utf8ToStringCharset(strFileName); CStdString strDescription=item->GetLabel(); g_charsetConverter.utf8ToStringCharset(strDescription); write.AppendFormat("File%i=%s\n", i + 1, strFileName.c_str() ); write.AppendFormat("Title%i=%s\n", i + 1, strDescription.c_str() ); write.AppendFormat("Length%i=%u\n", i + 1, item->GetMusicInfoTag()->GetDuration() / 1000 ); } write.AppendFormat("NumberOfEntries=%i\n", m_vecItems.size()); write.AppendFormat("Version=2\n"); file.Write(write.c_str(), write.size()); file.Close(); }
void CCECProcessor::LogOutput(const cec_command &data) { CStdString strTx; // initiator and destination strTx.Format("<< %02x", ((uint8_t)data.initiator << 4) + (uint8_t)data.destination); // append the opcode if (data.opcode_set) strTx.AppendFormat(":%02x", (uint8_t)data.opcode); // append the parameters for (uint8_t iPtr = 0; iPtr < data.parameters.size; iPtr++) strTx.AppendFormat(":%02x", data.parameters[iPtr]); // and log it m_libcec->AddLog(CEC_LOG_TRAFFIC, strTx.c_str()); }
CStdString CKeyboardStat::GetKeyName(int KeyID) { /* 歌方: 1、 卦指: 1、 傍苧: 1、 */ int keyid; CStdString keyname; XBMCKEYTABLE keytable; keyname.clear(); // Get modifiers if (KeyID & CKey::MODIFIER_CTRL) keyname.append("ctrl-"); if (KeyID & CKey::MODIFIER_SHIFT) keyname.append("shift-"); if (KeyID & CKey::MODIFIER_ALT) keyname.append("alt-"); if (KeyID & CKey::MODIFIER_SUPER) keyname.append("win-"); // Now get the key name keyid = KeyID & 0xFF; if (KeyTableLookupVKeyName(keyid, &keytable)) keyname.append(keytable.keyname); else keyname.AppendFormat("%i", keyid); keyname.AppendFormat(" (%02x)", KeyID); return keyname; }
string ByArtist(SortAttribute attributes, const SortItem &values) { CStdString label = ArrayToString(attributes, values.at(FieldArtist)); const CVariant &year = values.at(FieldYear); if (g_advancedSettings.m_bMusicLibraryAlbumsSortByArtistThenYear && !year.isNull()) label.AppendFormat(" %i", (int)year.asInteger()); const CVariant &album = values.at(FieldAlbum); if (!album.isNull()) label += " " + SortUtils::RemoveArticles(album.asString()); const CVariant &track = values.at(FieldTrackNumber); if (!track.isNull()) label.AppendFormat(" %i", (int)track.asInteger()); return label; }
string ByYear(SortAttribute attributes, const SortItem &values) { CStdString label; const CVariant &airDate = values.at(FieldAirDate); if (!airDate.isNull()) label = airDate.asString() + " "; label.AppendFormat("%i %s", (int)values.at(FieldYear).asInteger(), ByLabel(attributes, values).c_str()); return label; }
//looks pretty in the log CStdString CPullupCorrection::GetPatternStr() { CStdString patternstr; for (unsigned int i = 0; i < m_pattern.size(); i++) patternstr.AppendFormat("%.2f ", m_pattern[i]); patternstr.Trim(); return patternstr; }
void CCECTCPServer::sendData(cec_command data) { if(this->new_socket) { CStdString dataStr; int length = 2 + data.parameters.size; dataStr.Format("%c", (char)(data.initiator<<4)+(data.destination&15)); if (data.opcode_set == 1) { dataStr.AppendFormat("%c", (char)data.opcode); length++; } for (uint8_t iPtr = 0; iPtr < data.parameters.size; iPtr++) dataStr.AppendFormat("%c", (char)data.parameters[iPtr]); char *message = new char[length]; strcpy(message, dataStr.c_str()); puts(message); write(this->new_socket , message , length); } }
bool CPeripheralCecAdapterUpdateThread::SetInitialConfiguration(void) { // devices to wake are set if (!m_configuration.wakeDevices.IsEmpty()) m_adapter->m_cecAdapter->PowerOnDevices(CECDEVICE_BROADCAST); // the option to make XBMC the active source is set if (m_configuration.bActivateSource == 1) m_adapter->m_cecAdapter->SetActiveSource(); // wait until devices are powered up if (!WaitReady()) return false; // request the menu language of the TV if (m_configuration.bUseTVMenuLanguage == 1) { cec_menu_language language; if (m_adapter->m_cecAdapter->GetDeviceMenuLanguage(CECDEVICE_TV, &language)) m_adapter->SetMenuLanguage(language.language); } // request the OSD name of the TV CStdString strNotification; cec_osd_name tvName = m_adapter->m_cecAdapter->GetDeviceOSDName(CECDEVICE_TV); strNotification.Format("%s: %s", g_localizeStrings.Get(36016), tvName.name); /* disable the mute setting when an amp is found, because the amp handles the mute setting and set PCM output to 100% */ if (m_adapter->m_cecAdapter->IsActiveDeviceType(CEC_DEVICE_TYPE_AUDIO_SYSTEM)) { // request the OSD name of the amp cec_osd_name ampName = m_adapter->m_cecAdapter->GetDeviceOSDName(CECDEVICE_AUDIOSYSTEM); CLog::Log(LOGDEBUG, "%s - CEC capable amplifier found (%s). volume will be controlled on the amp", __FUNCTION__, ampName.name); strNotification.AppendFormat(" - %s", ampName.name); // set amp present m_adapter->SetAudioSystemConnected(true); g_settings.m_bMute = false; g_settings.m_nVolumeLevel = VOLUME_MAXIMUM; } m_adapter->m_bIsReady = true; // try to send an OSD string to the TV m_adapter->m_cecAdapter->SetOSDString(CECDEVICE_TV, CEC_DISPLAY_CONTROL_DISPLAY_FOR_DEFAULT_TIME, g_localizeStrings.Get(36016).c_str()); // and let the gui know that we're done CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(36000), strNotification); CSingleLock lock(m_critSection); m_bIsUpdating = false; return true; }
bool CDatabase::DeleteValues(const CStdString &strTable, const CStdString &strWhereClause /* = CStdString() */) { bool bReturn = true; CStdString strQueryBase = "DELETE FROM %s"; if (!strWhereClause.IsEmpty()) strQueryBase.AppendFormat(" WHERE %s", strWhereClause.c_str()); CStdString strQuery = FormatSQL(strQueryBase, strTable.c_str()); bReturn = ExecuteQuery(strQuery); return bReturn; }
CStdString CEdl::GetInfo() { /* * TODO: Update wiki (http://xbmc.org/wiki/?title=EDL_(commercial_skipping)_and_SceneMarker_support) * if these different status strings are used. */ CStdString strInfo = ""; if (HasCut()) { int cutCount = 0, muteCount = 0, commBreakCount = 0; for (int i = 0; i < (int)m_vecCuts.size(); i++) { switch (m_vecCuts[i].action) { case CUT: cutCount++; break; case MUTE: muteCount++; break; case COMM_BREAK: commBreakCount++; break; } } if (cutCount > 0) strInfo.AppendFormat("c%i", cutCount); if (muteCount > 0) strInfo.AppendFormat("m%i", muteCount); if (commBreakCount > 0) strInfo.AppendFormat("b%i", commBreakCount); } if (HasSceneMarker()) strInfo.AppendFormat("s%i", m_vecSceneMarkers.size()); return strInfo.IsEmpty() ? "-" : strInfo; }
CStdString CDatabase::GetSingleValue(const CStdString &strTable, const CStdString &strColumn, const CStdString &strWhereClause /* = CStdString() */, const CStdString &strOrderBy /* = CStdString() */) { CStdString strReturn; try { if (NULL == m_pDB.get()) return strReturn; if (NULL == m_pDS.get()) return strReturn; CStdString strQueryBase = "SELECT %s FROM %s"; if (!strWhereClause.IsEmpty()) strQueryBase.AppendFormat(" WHERE %s", strWhereClause.c_str()); if (!strOrderBy.IsEmpty()) strQueryBase.AppendFormat(" ORDER BY %s", strOrderBy.c_str()); strQueryBase.append(" LIMIT 1"); CStdString strQuery = PrepareSQL(strQueryBase, strColumn.c_str(), strTable.c_str()); if (!m_pDS->query(strQuery.c_str())) return strReturn; if (m_pDS->num_rows() > 0) { strReturn = m_pDS->fv(0).get_asString(); } m_pDS->close(); } catch(...) { CLog::Log(LOGERROR, "%s - failed to get value '%s' from table '%s'", __FUNCTION__, strColumn.c_str(), strTable.c_str()); } return strReturn; }
string ByAlbum(SortAttribute attributes, const SortItem &values) { string album = values.at(FieldAlbum).asString(); if (attributes & SortAttributeIgnoreArticle) album = SortUtils::RemoveArticles(album); CStdString label; label.Format("%s %s", album, ArrayToString(attributes, values.at(FieldArtist))); const CVariant &track = values.at(FieldTrackNumber); if (!track.isNull()) label.AppendFormat(" %i", (int)track.asInteger()); return label; }
void CGUIDialogAudioSubtitleSettings::AddSubtitleStreams(unsigned int id) { SettingInfo setting; setting.id = id; setting.name = g_localizeStrings.Get(462); setting.type = SettingInfo::SPIN; setting.min = 0; setting.data = &m_subtitleStream; m_subtitleStream = CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream; if(m_subtitleStream < 0) m_subtitleStream = 0; // get the number of audio strams for the current movie setting.max = (float)g_application.m_pPlayer->GetSubtitleCount() - 1; // cycle through each subtitle and add it to our entry list for (int i = 0; i <= setting.max; ++i) { SPlayerSubtitleStreamInfo info; g_application.m_pPlayer->GetSubtitleStreamInfo(i, info); CStdString strItem; CStdString strLanguage; if (!g_LangCodeExpander.Lookup(strLanguage, info.language)) strLanguage = g_localizeStrings.Get(13205); // Unknown if (info.name.length() == 0) strItem = strLanguage; else strItem.Format("%s - %s", strLanguage.c_str(), info.name.c_str()); strItem.AppendFormat(" (%i/%i)", i + 1, (int)setting.max + 1); setting.entry.push_back(make_pair(setting.entry.size(), strItem)); } if (setting.max < 0) { // no subtitle streams - just add a "None" entry m_subtitleStream = 0; setting.max = 0; setting.entry.push_back(make_pair(setting.entry.size(), g_localizeStrings.Get(231))); } m_settings.push_back(setting); }
bool CDatabase::Open(const DatabaseSettings &settings) { if (IsOpen()) { m_openCount++; return true; } // check our database manager to see if this database can be opened if (!CDatabaseManager::Get().CanOpen(GetBaseDBName())) return false; DatabaseSettings dbSettings = settings; InitSettings(dbSettings); CStdString dbName = dbSettings.name; dbName.AppendFormat("%d", GetMinVersion()); return Connect(dbName, dbSettings, false); }
void SSortFileItem::BySongAlbum(CFileItemPtr &item) { if (!item) return; CStdString label; if (item->HasMusicInfoTag()) label = item->GetMusicInfoTag()->GetAlbum(); else if (item->HasVideoInfoTag()) label = item->GetVideoInfoTag()->m_strAlbum; CStdString artist; if (item->HasMusicInfoTag()) artist = item->GetMusicInfoTag()->GetArtist(); else if (item->HasVideoInfoTag()) artist = item->GetVideoInfoTag()->m_strArtist; label += " " + artist; if (item->HasMusicInfoTag()) label.AppendFormat(" %i", item->GetMusicInfoTag()->GetTrackAndDiskNumber()); item->SetSortLabel(label); }
void SSortFileItem::BySongAlbumNoThe(CFileItemPtr &item) { if (!item) return; CStdString label; if (item->HasMusicInfoTag()) label = item->GetMusicInfoTag()->GetAlbum(); else if (item->HasVideoInfoTag()) label = item->GetVideoInfoTag()->m_strAlbum; label = RemoveArticles(label); CStdString artist; if (item->HasMusicInfoTag()) artist = StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator); else if (item->HasVideoInfoTag()) artist = item->GetVideoInfoTag()->m_strArtist; label += " " + RemoveArticles(artist); if (item->HasMusicInfoTag()) label.AppendFormat(" %i", item->GetMusicInfoTag()->GetTrackAndDiskNumber()); item->SetSortLabel(label); }
bool CCECAdapterMessageQueueEntry::MessageReceivedCommandAccepted(const CCECAdapterMessage &message) { bool bSendSignal(false); bool bHandled(false); { CLockObject lock(m_mutex); if (m_iPacketsLeft > 0) { /* decrease by 1 */ m_iPacketsLeft--; #ifdef CEC_DEBUGGING /* log this message */ CStdString strLog; strLog.Format("%s - command accepted", ToString()); if (m_iPacketsLeft > 0) strLog.AppendFormat(" - waiting for %d more", m_iPacketsLeft); m_queue->m_com->m_callback->GetLib()->AddLog(CEC_LOG_DEBUG, strLog); #endif /* no more packets left and not a transmission, so we're done */ if (!m_message->IsTranmission() && m_iPacketsLeft == 0) { m_message->state = ADAPTER_MESSAGE_STATE_SENT_ACKED; m_message->response = message.packet; bSendSignal = true; } bHandled = true; } } if (bSendSignal) Signal(); return bHandled; }
bool CFanart::ParseColors(const CStdString &colorsIn, CStdString &colorsOut) { // Formats: // 0: XBMC ARGB Hexadecimal string comma seperated "FFFFFFFF,DDDDDDDD,AAAAAAAA" // 1: The TVDB RGB Int Triplets, pipe seperate with leading/trailing pipes "|68,69,59|69,70,58|78,78,68|" // Essentially we read the colors in using the proper format, and store them in our own fixed temporary format (3 DWORDS), and then // write them back in in the specified format. if (colorsIn.IsEmpty()) return false; // check for the TVDB RGB triplets "|68,69,59|69,70,58|78,78,68|" if (colorsIn[0] == '|') { // need conversion colorsOut.Empty(); CStdStringArray strColors; StringUtils::SplitString(colorsIn, "|", strColors); for (int i = 0; i < std::min((int)strColors.size()-1, (int)max_fanart_colors); i++) { // split up each color CStdStringArray strTriplets; StringUtils::SplitString(strColors[i+1], ",", strTriplets); if (strTriplets.size() == 3) { // convert if (colorsOut.size()) colorsOut += ","; colorsOut.AppendFormat("FF%2x%2x%2x", atol(strTriplets[0].c_str()), atol(strTriplets[1].c_str()), atol(strTriplets[2].c_str())); } } } else { // assume is our format colorsOut = colorsIn; } return true; }
void CPlayListWPL::Save(const CStdString& strFileName) const { if (!m_vecItems.size()) return ; CStdString strPlaylist = CUtil::MakeLegalPath(strFileName); CFile file; if (!file.OpenForWrite(strPlaylist, true)) { CLog::Log(LOGERROR, "Could not save WPL playlist: [%s]", strPlaylist.c_str()); return ; } CStdString write; write.AppendFormat("<?wpl version=%c1.0%c>\n", 34, 34); write.AppendFormat("<smil>\n"); write.AppendFormat(" <head>\n"); write.AppendFormat(" <meta name=%cGenerator%c content=%cMicrosoft Windows Media Player -- 10.0.0.3646%c/>\n", 34, 34, 34, 34); write.AppendFormat(" <author/>\n"); write.AppendFormat(" <title>%s</title>\n", m_strPlayListName.c_str()); write.AppendFormat(" </head>\n"); write.AppendFormat(" <body>\n"); write.AppendFormat(" <seq>\n"); for (int i = 0; i < (int)m_vecItems.size(); ++i) { CFileItemPtr item = m_vecItems[i]; write.AppendFormat(" <media src=%c%s%c/>", 34, item->m_strPath.c_str(), 34); } write.AppendFormat(" </seq>\n"); write.AppendFormat(" </body>\n"); write.AppendFormat("</smil>\n"); file.Write(write.c_str(), write.size()); file.Close(); }
void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configuration &config) { // set the primary device type m_configuration.deviceTypes.Clear(); m_configuration.deviceTypes.Add(config.deviceTypes[0]); SetSetting("device_type", (int)config.deviceTypes[0]); // set the connected device m_configuration.baseDevice = config.baseDevice; SetSetting("connected_device", (int)config.baseDevice); // set the HDMI port number m_configuration.iHDMIPort = config.iHDMIPort; SetSetting("cec_hdmi_port", config.iHDMIPort); // set the physical address, when baseDevice or iHDMIPort are not set if (m_configuration.baseDevice == CECDEVICE_UNKNOWN || m_configuration.iHDMIPort == 0 || m_configuration.iHDMIPort > 4) { m_configuration.iPhysicalAddress = config.iPhysicalAddress; CStdString strPhysicalAddress; strPhysicalAddress.Format("%x", config.iPhysicalAddress); SetSetting("physical_address", strPhysicalAddress); } // set the tv vendor override m_configuration.tvVendor = config.tvVendor; SetSetting("tv_vendor", (int)config.tvVendor); // set the devices to wake when starting m_configuration.wakeDevices = config.wakeDevices; CStdString strWakeDevices; for (unsigned int iPtr = 0; iPtr <= 16; iPtr++) if (config.wakeDevices[iPtr]) strWakeDevices.AppendFormat(" %X", iPtr); SetSetting("wake_devices", strWakeDevices.Trim()); // set the devices to power off when stopping m_configuration.powerOffDevices = config.powerOffDevices; CStdString strPowerOffDevices; for (unsigned int iPtr = 0; iPtr <= 16; iPtr++) if (config.powerOffDevices[iPtr]) strPowerOffDevices.AppendFormat(" %X", iPtr); SetSetting("wake_devices", strPowerOffDevices.Trim()); // set the boolean settings m_configuration.bUseTVMenuLanguage = config.bUseTVMenuLanguage; SetSetting("use_tv_menu_language", m_configuration.bUseTVMenuLanguage == 1); m_configuration.bActivateSource = config.bActivateSource; SetSetting("activate_source", m_configuration.bActivateSource == 1); m_configuration.bPowerOffScreensaver = config.bPowerOffScreensaver; SetSetting("cec_standby_screensaver", m_configuration.bPowerOffScreensaver == 1); m_configuration.bPowerOffOnStandby = config.bPowerOffOnStandby; SetSetting("standby_pc_on_tv_standby", m_configuration.bPowerOffOnStandby == 1); if (config.serverVersion >= CEC_SERVER_VERSION_1_5_1) m_configuration.bSendInactiveSource = config.bSendInactiveSource; SetSetting("send_inactive_source", m_configuration.bSendInactiveSource == 1); }
void CGUIDialogAudioSubtitleSettings::AddAudioStreams(unsigned int id) { SettingInfo setting; setting.id = id; setting.name = g_localizeStrings.Get(460); setting.type = SettingInfo::SPIN; setting.min = 0; setting.data = &m_audioStream; // get the number of audio strams for the current movie setting.max = (float)g_application.m_pPlayer->GetAudioStreamCount() - 1; m_audioStream = g_application.m_pPlayer->GetAudioStream(); if( m_audioStream < 0 ) m_audioStream = 0; // check if we have a single, stereo stream, and if so, allow us to split into // left, right or both if (!setting.max) { CStdString strAudioInfo; g_application.m_pPlayer->GetAudioInfo(strAudioInfo); int iNumChannels = atoi(strAudioInfo.Right(strAudioInfo.size() - strAudioInfo.Find("chns:") - 5).c_str()); CStdString strAudioCodec = strAudioInfo.Mid(7, strAudioInfo.Find(") VBR") - 5); bool bDTS = strstr(strAudioCodec.c_str(), "DTS") != 0; bool bAC3 = strstr(strAudioCodec.c_str(), "AC3") != 0; if (iNumChannels == 2 && !(bDTS || bAC3)) { // ok, enable these options /* if (CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream == -1) { // default to stereo stream CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream = 0; }*/ setting.max = 2; for (int i = 0; i <= setting.max; i++) setting.entry.push_back(make_pair(setting.entry.size(), g_localizeStrings.Get(13320 + i))); m_audioStream = -CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream - 1; m_settings.push_back(setting); return; } } // cycle through each audio stream and add it to our list control for (int i = 0; i <= setting.max; ++i) { CStdString strItem; CStdString strLanguage; SPlayerAudioStreamInfo info; g_application.m_pPlayer->GetAudioStreamInfo(i, info); if (!g_LangCodeExpander.Lookup(strLanguage, info.language)) strLanguage = g_localizeStrings.Get(13205); // Unknown if (info.name.length() == 0) strItem = strLanguage; else strItem.Format("%s - %s", strLanguage.c_str(), info.name.c_str()); strItem.AppendFormat(" (%i/%i)", i + 1, (int)setting.max + 1); setting.entry.push_back(make_pair(setting.entry.size(), strItem)); } if( setting.max < 0 ) { setting.max = 0; setting.entry.push_back(make_pair(setting.entry.size(), g_localizeStrings.Get(231))); } m_settings.push_back(setting); }
bool CVideoReferenceClock::SetupD3D() { int ReturnV; CLog::Log(LOGDEBUG, "CVideoReferenceClock: Setting up Direct3d"); m_D3dCallback.Aquire(); //get d3d device m_D3dDev = g_Windowing.Get3DDevice(); //we need a high priority thread to get accurate timing if (!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL)) CLog::Log(LOGDEBUG, "CVideoReferenceClock: SetThreadPriority failed"); D3DCAPS9 DevCaps; ReturnV = m_D3dDev->GetDeviceCaps(&DevCaps); if (ReturnV != D3D_OK) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: GetDeviceCaps returned %s: %s", DXGetErrorString(ReturnV), DXGetErrorDescription(ReturnV)); return false; } if ((DevCaps.Caps & D3DCAPS_READ_SCANLINE) != D3DCAPS_READ_SCANLINE) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: Hardware does not support GetRasterStatus"); return false; } D3DRASTER_STATUS RasterStatus; ReturnV = m_D3dDev->GetRasterStatus(0, &RasterStatus); if (ReturnV != D3D_OK) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: GetRasterStatus returned returned %s: %s", DXGetErrorString(ReturnV), DXGetErrorDescription(ReturnV)); return false; } D3DDISPLAYMODE DisplayMode; ReturnV = m_D3dDev->GetDisplayMode(0, &DisplayMode); if (ReturnV != D3D_OK) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: GetDisplayMode returned returned %s: %s", DXGetErrorString(ReturnV), DXGetErrorDescription(ReturnV)); return false; } //forced update of windows refreshrate UpdateRefreshrate(true); if (g_advancedSettings.m_measureRefreshrate) { //measure the refreshrate a couple times list<double> Measures; for (int i = 0; i < NRMEASURES; i++) Measures.push_back(MeasureRefreshrate(MEASURETIME)); //build up a string of measured rates CStdString StrRates; for (list<double>::iterator it = Measures.begin(); it != Measures.end(); it++) StrRates.AppendFormat("%.2f ", *it); //get the top half of the measured rates Measures.sort(); double RefreshRate = 0.0; int NrMeasurements = 0; while (NrMeasurements < NRMEASURES / 2 && !Measures.empty()) { if (Measures.back() > 0.0) { RefreshRate += Measures.back(); NrMeasurements++; } Measures.pop_back(); } if (NrMeasurements < NRMEASURES / 2) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: refreshrate measurements: %s, unable to get a good measurement", StrRates.c_str(), m_RefreshRate); return false; } RefreshRate /= NrMeasurements; m_RefreshRate = MathUtils::round_int(RefreshRate); CLog::Log(LOGDEBUG, "CVideoReferenceClock: refreshrate measurements: %s, assuming %i hertz", StrRates.c_str(), m_RefreshRate); } else { m_RefreshRate = m_PrevRefreshRate; if (m_RefreshRate == 23 || m_RefreshRate == 29 || m_RefreshRate == 59) m_RefreshRate++; if (m_Interlaced) { m_RefreshRate *= 2; CLog::Log(LOGDEBUG, "CVideoReferenceClock: display is interlaced"); } CLog::Log(LOGDEBUG, "CVideoReferenceClock: detected refreshrate: %i hertz, assuming %i hertz", m_PrevRefreshRate, (int)m_RefreshRate); } m_MissedVblanks = 0; return true; }
const CStdString CPictureInfoTag::GetInfo(int info) const { if (!m_isLoaded) return ""; CStdString value; switch (info) { case SLIDE_RESOLUTION: value.Format("%d x %d", m_exifInfo.Width, m_exifInfo.Height); break; case SLIDE_COLOUR: value = m_exifInfo.IsColor ? "Colour" : "Black and White"; break; case SLIDE_PROCESS: switch (m_exifInfo.Process) { case M_SOF0: // don't show it if its the plain old boring 'baseline' process, but do // show it if its something else, like 'progressive' (used on web sometimes) value = "Baseline"; break; case M_SOF1: value = "Extended sequential"; break; case M_SOF2: value = "Progressive"; break; case M_SOF3: value = "Lossless"; break; case M_SOF5: value = "Differential sequential"; break; case M_SOF6: value = "Differential progressive"; break; case M_SOF7: value = "Differential lossless"; break; case M_SOF9: value = "Extended sequential, arithmetic coding"; break; case M_SOF10: value = "Progressive, arithmetic coding"; break; case M_SOF11: value = "Lossless, arithmetic coding"; break; case M_SOF13: value = "Differential sequential, arithmetic coding"; break; case M_SOF14: value = "Differential progressive, arithmetic coding"; break; case M_SOF15: value = "Differential lossless, arithmetic coding"; break; default: value = "Unknown"; break; } break; case SLIDE_COMMENT: case SLIDE_EXIF_COMMENT: value = m_exifInfo.Comments; break; case SLIDE_EXIF_DATE_TIME: if (m_exifInfo.DateTime && strlen(m_exifInfo.DateTime) >= 19 && m_exifInfo.DateTime[0] != ' ') { CStdString dateTime = m_exifInfo.DateTime; int year = atoi(dateTime.Mid(0, 4).c_str()); int month = atoi(dateTime.Mid(5, 2).c_str()); int day = atoi(dateTime.Mid(8, 2).c_str()); int hour = atoi(dateTime.Mid(11,2).c_str()); int min = atoi(dateTime.Mid(14,2).c_str()); int sec = atoi(dateTime.Mid(17,2).c_str()); CDateTime date(year, month, day, hour, min, sec); value = date.GetAsLocalizedDateTime(); } break; case SLIDE_EXIF_DESCRIPTION: value = m_exifInfo.Description; break; case SLIDE_EXIF_CAMERA_MAKE: value = m_exifInfo.CameraMake; break; case SLIDE_EXIF_CAMERA_MODEL: value = m_exifInfo.CameraModel; break; // case SLIDE_EXIF_SOFTWARE: // value = m_exifInfo.Software; case SLIDE_EXIF_APERTURE: if (m_exifInfo.ApertureFNumber) value.Format("%3.1f", m_exifInfo.ApertureFNumber); break; case SLIDE_EXIF_ORIENTATION: switch (m_exifInfo.Orientation) { case 1: value = "Top Left"; break; case 2: value = "Top Right"; break; case 3: value = "Bottom Right"; break; case 4: value = "Bottom Left"; break; case 5: value = "Left Top"; break; case 6: value = "Right Top"; break; case 7: value = "Right Bottom"; break; case 8: value = "Left Bottom"; break; } break; case SLIDE_EXIF_FOCAL_LENGTH: if (m_exifInfo.FocalLength) { value.Format("%4.2fmm", m_exifInfo.FocalLength); if (m_exifInfo.FocalLength35mmEquiv != 0) value.AppendFormat(" (35mm Equivalent = %umm)", m_exifInfo.FocalLength35mmEquiv); } break; case SLIDE_EXIF_FOCUS_DIST: if (m_exifInfo.Distance < 0) value = "Infinite"; else if (m_exifInfo.Distance > 0) value.Format("%4.2fm", m_exifInfo.Distance); break; case SLIDE_EXIF_EXPOSURE: switch (m_exifInfo.ExposureProgram) { case 1: value = "Manual"; break; case 2: value = "Program (Auto)"; break; case 3: value = "Aperture priority (Semi-Auto)"; break; case 4: value = "Shutter priority (semi-auto)"; break; case 5: value = "Creative Program (based towards depth of field)"; break; case 6: value = "Action program (based towards fast shutter speed)"; break; case 7: value = "Portrait Mode"; break; case 8: value = "Landscape Mode"; break; } break; case SLIDE_EXIF_EXPOSURE_TIME: if (m_exifInfo.ExposureTime) { if (m_exifInfo.ExposureTime < 0.010f) value.Format("%6.4fs", m_exifInfo.ExposureTime); else value.Format("%5.3fs", m_exifInfo.ExposureTime); if (m_exifInfo.ExposureTime <= 0.5) value.AppendFormat(" (1/%d)", (int)(0.5 + 1/m_exifInfo.ExposureTime)); } break; case SLIDE_EXIF_EXPOSURE_BIAS: if (m_exifInfo.ExposureBias != 0) value.Format("%4.2", m_exifInfo.ExposureBias); break; case SLIDE_EXIF_EXPOSURE_MODE: switch (m_exifInfo.ExposureMode) { case 0: value = "Automatic"; break; case 1: value = "Manual"; break; case 2: value = "Auto bracketing"; break; } break; case SLIDE_EXIF_FLASH_USED: if (m_exifInfo.FlashUsed >= 0) { if (m_exifInfo.FlashUsed & 1) { value = "Yes"; switch (m_exifInfo.FlashUsed) { case 0x5: value = "Yes (Strobe light not detected)"; break; case 0x7: value = "Yes (Strobe light detected)"; break; case 0x9: value = "Yes (Manual)"; break; case 0xd: value = "Yes (Manual, return light not detected)"; break; case 0xf: value = "Yes (Manual, return light detected)"; break; case 0x19: value = "Yes (Auto)"; break; case 0x1d: value = "Yes (Auto, return light not detected)"; break; case 0x1f: value = "Yes (Auto, return light detected)"; break; case 0x41: value = "Yes (Red eye reduction mode)"; break; case 0x45: value = "Yes (Red eye reduction mode return light not detected)"; break; case 0x47: value = "Yes (Red eye reduction mode return light detected)"; break; case 0x49: value = "Yes (Manual, red eye reduction mode)"; break; case 0x4d: value = "Yes (Manual, red eye reduction mode, return light not detected)"; break; case 0x4f: value = "Yes (Manual, red eye reduction mode, return light detected)"; break; case 0x59: value = "Yes (Auto, red eye reduction mode)"; break; case 0x5d: value = "Yes (Auto, red eye reduction mode, return light not detected)"; break; case 0x5f: value = "Yes (Auto, red eye reduction mode, return light detected)"; break; } } else value = m_exifInfo.FlashUsed == 0x18 ? "No (Auto)" : "No"; } break; case SLIDE_EXIF_WHITE_BALANCE: return m_exifInfo.Whitebalance ? "Manual" : "Auto"; case SLIDE_EXIF_LIGHT_SOURCE: switch (m_exifInfo.LightSource) { case 1: value = "Daylight"; break; case 2: value = "Fluorescent"; break; case 3: value = "Incandescent"; break; case 4: value = "Flash"; break; case 9: value = "Fine Weather"; break; case 11: value = "Shade"; break; default:; //Quercus: 17-1-2004 There are many more modes for this, check Exif2.2 specs // If it just says 'unknown' or we don't know it, then // don't bother showing it - it doesn't add any useful information. } break; case SLIDE_EXIF_METERING_MODE: switch (m_exifInfo.MeteringMode) { case 2: value = "Center weight"; break; case 3: value = "Spot"; break; case 5: value = "Matrix"; break; } break; case SLIDE_EXIF_ISO_EQUIV: if (m_exifInfo.ISOequivalent) value.Format("%2d", m_exifInfo.ISOequivalent); break; case SLIDE_EXIF_DIGITAL_ZOOM: if (m_exifInfo.DigitalZoomRatio) value.Format("%1.3fx", m_exifInfo.DigitalZoomRatio); break; case SLIDE_EXIF_CCD_WIDTH: if (m_exifInfo.CCDWidth) value.Format("%4.2fmm", m_exifInfo.CCDWidth); break; case SLIDE_EXIF_GPS_LATITUDE: value = m_exifInfo.GpsLat; break; case SLIDE_EXIF_GPS_LONGITUDE: value = m_exifInfo.GpsLong; break; case SLIDE_EXIF_GPS_ALTITUDE: value = m_exifInfo.GpsAlt; break; case SLIDE_IPTC_SUP_CATEGORIES: value = m_iptcInfo.SupplementalCategories; break; case SLIDE_IPTC_KEYWORDS: value = m_iptcInfo.Keywords; break; case SLIDE_IPTC_CAPTION: value = m_iptcInfo.Caption; break; case SLIDE_IPTC_AUTHOR: value = m_iptcInfo.Author; break; case SLIDE_IPTC_HEADLINE: value = m_iptcInfo.Headline; break; case SLIDE_IPTC_SPEC_INSTR: value = m_iptcInfo.SpecialInstructions; break; case SLIDE_IPTC_CATEGORY: value = m_iptcInfo.Category; break; case SLIDE_IPTC_BYLINE: value = m_iptcInfo.Byline; break; case SLIDE_IPTC_BYLINE_TITLE: value = m_iptcInfo.BylineTitle; break; case SLIDE_IPTC_CREDIT: value = m_iptcInfo.Credit; break; case SLIDE_IPTC_SOURCE: value = m_iptcInfo.Source; break; case SLIDE_IPTC_COPYRIGHT_NOTICE: value = m_iptcInfo.CopyrightNotice; break; case SLIDE_IPTC_OBJECT_NAME: value = m_iptcInfo.ObjectName; break; case SLIDE_IPTC_CITY: value = m_iptcInfo.City; break; case SLIDE_IPTC_STATE: value = m_iptcInfo.State; break; case SLIDE_IPTC_COUNTRY: value = m_iptcInfo.Country; break; case SLIDE_IPTC_TX_REFERENCE: value = m_iptcInfo.TransmissionReference; break; case SLIDE_IPTC_DATE: value = m_iptcInfo.Date; break; case SLIDE_IPTC_COPYRIGHT: value = m_iptcInfo.Copyright; break; case SLIDE_IPTC_COUNTRY_CODE: value = m_iptcInfo.CountryCode; break; case SLIDE_IPTC_REF_SERVICE: value = m_iptcInfo.ReferenceService; break; default: break; } return value; }
void CPVRChannel::UpdateEncryptionName(void) { // http://www.dvb.org/index.php?id=174 // http://en.wikipedia.org/wiki/Conditional_access_system CStdString strName; CSingleLock lock(m_critSection); if ( m_iClientEncryptionSystem == 0x0000) strName = g_localizeStrings.Get(19013); /* Free To Air */ else if (m_iClientEncryptionSystem < 0x0000) strName = g_localizeStrings.Get(13205); /* Unknown */ else { if ( m_iClientEncryptionSystem >= 0x0001 && m_iClientEncryptionSystem <= 0x009F) strName = g_localizeStrings.Get(19014); /* Fixed */ else if (m_iClientEncryptionSystem >= 0x00A0 && m_iClientEncryptionSystem <= 0x00A1) strName = g_localizeStrings.Get(338); /* Analog */ else if (m_iClientEncryptionSystem >= 0x00A2 && m_iClientEncryptionSystem <= 0x00FF) strName = g_localizeStrings.Get(19014); /* Fixed */ else if (m_iClientEncryptionSystem >= 0x0100 && m_iClientEncryptionSystem <= 0x01FF) strName = "SECA Mediaguard"; else if (m_iClientEncryptionSystem == 0x0464) strName = "EuroDec"; else if (m_iClientEncryptionSystem >= 0x0500 && m_iClientEncryptionSystem <= 0x05FF) strName = "Viaccess"; else if (m_iClientEncryptionSystem >= 0x0600 && m_iClientEncryptionSystem <= 0x06FF) strName = "Irdeto"; else if (m_iClientEncryptionSystem >= 0x0900 && m_iClientEncryptionSystem <= 0x09FF) strName = "NDS Videoguard"; else if (m_iClientEncryptionSystem >= 0x0B00 && m_iClientEncryptionSystem <= 0x0BFF) strName = "Conax"; else if (m_iClientEncryptionSystem >= 0x0D00 && m_iClientEncryptionSystem <= 0x0DFF) strName = "CryptoWorks"; else if (m_iClientEncryptionSystem >= 0x0E00 && m_iClientEncryptionSystem <= 0x0EFF) strName = "PowerVu"; else if (m_iClientEncryptionSystem == 0x1000) strName = "RAS"; else if (m_iClientEncryptionSystem >= 0x1200 && m_iClientEncryptionSystem <= 0x12FF) strName = "NagraVision"; else if (m_iClientEncryptionSystem >= 0x1700 && m_iClientEncryptionSystem <= 0x17FF) strName = "BetaCrypt"; else if (m_iClientEncryptionSystem >= 0x1800 && m_iClientEncryptionSystem <= 0x18FF) strName = "NagraVision"; else if (m_iClientEncryptionSystem == 0x22F0) strName = "Codicrypt"; else if (m_iClientEncryptionSystem == 0x2600) strName = "BISS"; else if (m_iClientEncryptionSystem == 0x4347) strName = "CryptOn"; else if (m_iClientEncryptionSystem == 0x4800) strName = "Accessgate"; else if (m_iClientEncryptionSystem == 0x4900) strName = "China Crypt"; else if (m_iClientEncryptionSystem == 0x4A10) strName = "EasyCas"; else if (m_iClientEncryptionSystem == 0x4A20) strName = "AlphaCrypt"; else if (m_iClientEncryptionSystem == 0x4A70) strName = "DreamCrypt"; else if (m_iClientEncryptionSystem == 0x4A60) strName = "SkyCrypt"; else if (m_iClientEncryptionSystem == 0x4A61) strName = "Neotioncrypt"; else if (m_iClientEncryptionSystem == 0x4A62) strName = "SkyCrypt"; else if (m_iClientEncryptionSystem == 0x4A63) strName = "Neotion SHL"; else if (m_iClientEncryptionSystem >= 0x4A64 && m_iClientEncryptionSystem <= 0x4A6F) strName = "SkyCrypt"; else if (m_iClientEncryptionSystem == 0x4A80) strName = "ThalesCrypt"; else if (m_iClientEncryptionSystem == 0x4AA1) strName = "KeyFly"; else if (m_iClientEncryptionSystem == 0x4ABF) strName = "DG-Crypt"; else if (m_iClientEncryptionSystem >= 0x4AD0 && m_iClientEncryptionSystem <= 0x4AD1) strName = "X-Crypt"; else if (m_iClientEncryptionSystem == 0x4AD4) strName = "OmniCrypt"; else if (m_iClientEncryptionSystem == 0x4AE0) strName = "RossCrypt"; else if (m_iClientEncryptionSystem == 0x5500) strName = "Z-Crypt"; else if (m_iClientEncryptionSystem == 0x5501) strName = "Griffin"; else strName = g_localizeStrings.Get(19499); /* Unknown */ strName.AppendFormat(" (%04X)", m_iClientEncryptionSystem); } m_strClientEncryptionName = strName; }
const CStdString CPictureInfoTag::GetInfo(int info) const { if (!m_isLoaded && !m_isInfoSetExternally) // If no metadata has been loaded from the picture file or set with SetInfo(), just return return ""; CStdString value; switch (info) { case SLIDE_RESOLUTION: value.Format("%d x %d", m_exifInfo.Width, m_exifInfo.Height); break; case SLIDE_COLOUR: value = m_exifInfo.IsColor ? "Colour" : "Black and White"; break; case SLIDE_PROCESS: switch (m_exifInfo.Process) { case M_SOF0: // don't show it if its the plain old boring 'baseline' process, but do // show it if its something else, like 'progressive' (used on web sometimes) value = "Baseline"; break; case M_SOF1: value = "Extended sequential"; break; case M_SOF2: value = "Progressive"; break; case M_SOF3: value = "Lossless"; break; case M_SOF5: value = "Differential sequential"; break; case M_SOF6: value = "Differential progressive"; break; case M_SOF7: value = "Differential lossless"; break; case M_SOF9: value = "Extended sequential, arithmetic coding"; break; case M_SOF10: value = "Progressive, arithmetic coding"; break; case M_SOF11: value = "Lossless, arithmetic coding"; break; case M_SOF13: value = "Differential sequential, arithmetic coding"; break; case M_SOF14: value = "Differential progressive, arithmetic coding"; break; case M_SOF15: value = "Differential lossless, arithmetic coding"; break; default: value = "Unknown"; break; } break; case SLIDE_COMMENT: case SLIDE_EXIF_COMMENT: // The charset used for the UserComment is stored in CommentsCharset: // Ascii, Unicode (UCS2), JIS (X208-1990), Unknown (application specific) if (m_exifInfo.CommentsCharset == EXIF_COMMENT_CHARSET_UNICODE) { g_charsetConverter.ucs2ToUTF8(CStdString16((uint16_t*)m_exifInfo.Comments), value); } else { // Ascii doesn't need to be converted (EXIF_COMMENT_CHARSET_ASCII) // Archived data is already converted (EXIF_COMMENT_CHARSET_CONVERTED) // Unknown data can't be converted as it could be any codec (EXIF_COMMENT_CHARSET_UNKNOWN) // JIS data can't be converted as CharsetConverter and iconv lacks support (EXIF_COMMENT_CHARSET_JIS) value = m_exifInfo.Comments; } break; case SLIDE_EXIF_LONG_DATE_TIME: if (m_dateTimeTaken.IsValid()) value = m_dateTimeTaken.GetAsLocalizedDateTime(true); break; case SLIDE_EXIF_DATE_TIME: if (m_dateTimeTaken.IsValid()) value = m_dateTimeTaken.GetAsLocalizedDateTime(); break; case SLIDE_EXIF_LONG_DATE: if (m_dateTimeTaken.IsValid()) value = m_dateTimeTaken.GetAsLocalizedDate(true); break; case SLIDE_EXIF_DATE: if (m_dateTimeTaken.IsValid()) value = m_dateTimeTaken.GetAsLocalizedDate(); break; case SLIDE_EXIF_DESCRIPTION: value = m_exifInfo.Description; break; case SLIDE_EXIF_CAMERA_MAKE: value = m_exifInfo.CameraMake; break; case SLIDE_EXIF_CAMERA_MODEL: value = m_exifInfo.CameraModel; break; // case SLIDE_EXIF_SOFTWARE: // value = m_exifInfo.Software; case SLIDE_EXIF_APERTURE: if (m_exifInfo.ApertureFNumber) value.Format("%3.1f", m_exifInfo.ApertureFNumber); break; case SLIDE_EXIF_ORIENTATION: switch (m_exifInfo.Orientation) { case 1: value = "Top Left"; break; case 2: value = "Top Right"; break; case 3: value = "Bottom Right"; break; case 4: value = "Bottom Left"; break; case 5: value = "Left Top"; break; case 6: value = "Right Top"; break; case 7: value = "Right Bottom"; break; case 8: value = "Left Bottom"; break; } break; case SLIDE_EXIF_FOCAL_LENGTH: if (m_exifInfo.FocalLength) { value.Format("%4.2fmm", m_exifInfo.FocalLength); if (m_exifInfo.FocalLength35mmEquiv != 0) value.AppendFormat(" (35mm Equivalent = %umm)", m_exifInfo.FocalLength35mmEquiv); } break; case SLIDE_EXIF_FOCUS_DIST: if (m_exifInfo.Distance < 0) value = "Infinite"; else if (m_exifInfo.Distance > 0) value.Format("%4.2fm", m_exifInfo.Distance); break; case SLIDE_EXIF_EXPOSURE: switch (m_exifInfo.ExposureProgram) { case 1: value = "Manual"; break; case 2: value = "Program (Auto)"; break; case 3: value = "Aperture priority (Semi-Auto)"; break; case 4: value = "Shutter priority (semi-auto)"; break; case 5: value = "Creative Program (based towards depth of field)"; break; case 6: value = "Action program (based towards fast shutter speed)"; break; case 7: value = "Portrait Mode"; break; case 8: value = "Landscape Mode"; break; } break; case SLIDE_EXIF_EXPOSURE_TIME: if (m_exifInfo.ExposureTime) { if (m_exifInfo.ExposureTime < 0.010f) value.Format("%6.4fs", m_exifInfo.ExposureTime); else value.Format("%5.3fs", m_exifInfo.ExposureTime); if (m_exifInfo.ExposureTime <= 0.5) value.AppendFormat(" (1/%d)", (int)(0.5 + 1/m_exifInfo.ExposureTime)); } break; case SLIDE_EXIF_EXPOSURE_BIAS: if (m_exifInfo.ExposureBias != 0) value.Format("%4.2f EV", m_exifInfo.ExposureBias); break; case SLIDE_EXIF_EXPOSURE_MODE: switch (m_exifInfo.ExposureMode) { case 0: value = "Automatic"; break; case 1: value = "Manual"; break; case 2: value = "Auto bracketing"; break; } break; case SLIDE_EXIF_FLASH_USED: if (m_exifInfo.FlashUsed >= 0) { if (m_exifInfo.FlashUsed & 1) { value = "Yes"; switch (m_exifInfo.FlashUsed) { case 0x5: value = "Yes (Strobe light not detected)"; break; case 0x7: value = "Yes (Strobe light detected)"; break; case 0x9: value = "Yes (Manual)"; break; case 0xd: value = "Yes (Manual, return light not detected)"; break; case 0xf: value = "Yes (Manual, return light detected)"; break; case 0x19: value = "Yes (Auto)"; break; case 0x1d: value = "Yes (Auto, return light not detected)"; break; case 0x1f: value = "Yes (Auto, return light detected)"; break; case 0x41: value = "Yes (Red eye reduction mode)"; break; case 0x45: value = "Yes (Red eye reduction mode return light not detected)"; break; case 0x47: value = "Yes (Red eye reduction mode return light detected)"; break; case 0x49: value = "Yes (Manual, red eye reduction mode)"; break; case 0x4d: value = "Yes (Manual, red eye reduction mode, return light not detected)"; break; case 0x4f: value = "Yes (Manual, red eye reduction mode, return light detected)"; break; case 0x59: value = "Yes (Auto, red eye reduction mode)"; break; case 0x5d: value = "Yes (Auto, red eye reduction mode, return light not detected)"; break; case 0x5f: value = "Yes (Auto, red eye reduction mode, return light detected)"; break; } } else value = m_exifInfo.FlashUsed == 0x18 ? "No (Auto)" : "No"; } break; case SLIDE_EXIF_WHITE_BALANCE: return m_exifInfo.Whitebalance ? "Manual" : "Auto"; case SLIDE_EXIF_LIGHT_SOURCE: switch (m_exifInfo.LightSource) { case 1: value = "Daylight"; break; case 2: value = "Fluorescent"; break; case 3: value = "Incandescent"; break; case 4: value = "Flash"; break; case 9: value = "Fine Weather"; break; case 11: value = "Shade"; break; default:; //Quercus: 17-1-2004 There are many more modes for this, check Exif2.2 specs // If it just says 'unknown' or we don't know it, then // don't bother showing it - it doesn't add any useful information. } break; case SLIDE_EXIF_METERING_MODE: switch (m_exifInfo.MeteringMode) { case 2: value = "Center weight"; break; case 3: value = "Spot"; break; case 5: value = "Matrix"; break; } break; case SLIDE_EXIF_ISO_EQUIV: if (m_exifInfo.ISOequivalent) value.Format("%2d", m_exifInfo.ISOequivalent); break; case SLIDE_EXIF_DIGITAL_ZOOM: if (m_exifInfo.DigitalZoomRatio) value.Format("%1.3fx", m_exifInfo.DigitalZoomRatio); break; case SLIDE_EXIF_CCD_WIDTH: if (m_exifInfo.CCDWidth) value.Format("%4.2fmm", m_exifInfo.CCDWidth); break; case SLIDE_EXIF_GPS_LATITUDE: value = m_exifInfo.GpsLat; break; case SLIDE_EXIF_GPS_LONGITUDE: value = m_exifInfo.GpsLong; break; case SLIDE_EXIF_GPS_ALTITUDE: value = m_exifInfo.GpsAlt; break; case SLIDE_IPTC_SUP_CATEGORIES: value = m_iptcInfo.SupplementalCategories; break; case SLIDE_IPTC_KEYWORDS: value = m_iptcInfo.Keywords; break; case SLIDE_IPTC_CAPTION: value = m_iptcInfo.Caption; break; case SLIDE_IPTC_AUTHOR: value = m_iptcInfo.Author; break; case SLIDE_IPTC_HEADLINE: value = m_iptcInfo.Headline; break; case SLIDE_IPTC_SPEC_INSTR: value = m_iptcInfo.SpecialInstructions; break; case SLIDE_IPTC_CATEGORY: value = m_iptcInfo.Category; break; case SLIDE_IPTC_BYLINE: value = m_iptcInfo.Byline; break; case SLIDE_IPTC_BYLINE_TITLE: value = m_iptcInfo.BylineTitle; break; case SLIDE_IPTC_CREDIT: value = m_iptcInfo.Credit; break; case SLIDE_IPTC_SOURCE: value = m_iptcInfo.Source; break; case SLIDE_IPTC_COPYRIGHT_NOTICE: value = m_iptcInfo.CopyrightNotice; break; case SLIDE_IPTC_OBJECT_NAME: value = m_iptcInfo.ObjectName; break; case SLIDE_IPTC_CITY: value = m_iptcInfo.City; break; case SLIDE_IPTC_STATE: value = m_iptcInfo.State; break; case SLIDE_IPTC_COUNTRY: value = m_iptcInfo.Country; break; case SLIDE_IPTC_TX_REFERENCE: value = m_iptcInfo.TransmissionReference; break; case SLIDE_IPTC_DATE: value = m_iptcInfo.Date; break; case SLIDE_IPTC_URGENCY: value = m_iptcInfo.Urgency; break; case SLIDE_IPTC_COUNTRY_CODE: value = m_iptcInfo.CountryCode; break; case SLIDE_IPTC_REF_SERVICE: value = m_iptcInfo.ReferenceService; break; case SLIDE_IPTC_TIMECREATED: value = m_iptcInfo.TimeCreated; break; case SLIDE_IPTC_SUBLOCATION: value = m_iptcInfo.SubLocation; break; case SLIDE_IPTC_IMAGETYPE: value = m_iptcInfo.ImageType; break; default: break; } return value; }
void CPlayListXML::Save(const CStdString& strFileName) const { if (!m_vecItems.size()) return ; CStdString strPlaylist = CUtil::MakeLegalPath(strFileName); CFile file; if (!file.OpenForWrite(strPlaylist, true)) { CLog::Log(LOGERROR, "Could not save WPL playlist: [%s]", strPlaylist.c_str()); return ; } CStdString write; write.AppendFormat("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"); write.AppendFormat("<streams>\n"); for (int i = 0; i < (int)m_vecItems.size(); ++i) { CFileItemPtr item = m_vecItems[i]; write.AppendFormat(" <stream>\n" ); write.AppendFormat(" <url>%s</url>", item->GetPath().c_str() ); write.AppendFormat(" <name>%s</name>", item->GetLabel().c_str() ); if ( !item->GetProperty("language").empty() ) write.AppendFormat(" <lang>%s</lang>", item->GetProperty("language").c_str() ); if ( !item->GetProperty("category").empty() ) write.AppendFormat(" <category>%s</category>", item->GetProperty("category").c_str() ); if ( !item->GetProperty("remotechannel").empty() ) write.AppendFormat(" <channel>%s</channel>", item->GetProperty("remotechannel").c_str() ); if ( item->m_iHasLock > 0 ) write.AppendFormat(" <lockpassword>%s<lockpassword>", item->m_strLockCode.c_str() ); write.AppendFormat(" </stream>\n\n" ); } write.AppendFormat("</streams>\n"); file.Write(write.c_str(), write.size()); file.Close(); }