Repository: xbmc/xbmc
File: xbmc/cores/VideoPlayer/VideoPlayer.cpp (C++)

Code before:
  if (bStreamInfo)
  {
    int iStream = m_processInfo->GetVideoSettings().m_SubtitleStream;
    SubtitleStreamInfo info;
    GetSubtitleStreamInfo(iStream, info);
    if (info.valid)
    {
      CVariant contentEntry(CVariant::VariantTypeObject);
      contentEntry["index"] = iStream;
      contentEntry["isdefault"] = (info.flags & StreamFlags::FLAG_DEFAULT) != 0;
      contentEntry["isforced"] = (info.flags & StreamFlags::FLAG_FORCED) != 0;
      contentEntry["isimpaired"] = (info.flags & StreamFlags::FLAG_VISUAL_IMPAIRED) != 0;
      contentEntry["language"] = info.language;
      contentEntry["name"] = info.name;
      data["property"]["currentsubtitle"] = contentEntry;
    } else if (!bStatus) return;
  }
  CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "OnPropertyChanged", data);
}

void CVideoPlayer::NotifyAudioUpdate()
{
  AudioStreamInfo info;
  int iStream = m_processInfo->GetVideoSettings().m_AudioStream;
  GetAudioStreamInfo(iStream, info);
  if (info.valid)
  {
    CVariant data;
    data["player"]["playerid"] = static_cast<int>(CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist());
    CVariant contentEntry(CVariant::VariantTypeObject);
    contentEntry["index"] = iStream;
    contentEntry["bitrate"] = info.bitrate;
    contentEntry["channels"] = info.channels;
    contentEntry["codec"] = info.codecDesc;
    contentEntry["isdefault"] = (info.flags & StreamFlags::FLAG_DEFAULT) != 0;
    contentEntry["isimpaired"] = (info.flags & StreamFlags::FLAG_HEARING_IMPAIRED) != 0;
    contentEntry["isoriginal"] = (info.flags & StreamFlags::FLAG_ORIGINAL) != 0;
    contentEntry["language"] = info.language;
    contentEntry["name"] = info.name;
    contentEntry["samplerate"] = info.samplerate;
    data["property"]["currentaudiostream"] = contentEntry;
    CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "OnPropertyChanged", data);
  }
}

void CVideoPlayer::NotifyVideoUpdate()
{
  VideoStreamInfo info;
  int iStream = m_processInfo->GetVideoSettings().m_VideoStream;
  GetVideoStreamInfo(iStream, info);
  if (info.valid)

Review comment (suggestion):
could be just me, I prefer to structure like
if (!info.valid)
  return;
to exit early and remove an identation level. Same comment for NotifyVideoUpdate.

Code after:
int CVideoPlayer::GetSubtitle()
{
  std::unique_lock lock(m_content.m_section);
  return m_content.m_subtitleIndex;
}

int CVideoPlayer::GetPrograms(std::vector<ProgramInfo>& programs)
{
  std::unique_lock lock(m_content.m_section);
  programs = m_programs;
  return programs.size();
}

void CVideoPlayer::SetProgram(int progId)
{
  m_messenger.Put(std::make_shared<CDVDMsgInt>(CDVDMsg::PLAYER_SET_PROGRAM, progId));
}

int CVideoPlayer::GetProgramsCount() const
{
  std::unique_lock lock(m_content.m_section);
  return m_programs.size();
}

void CVideoPlayer::SetUpdateStreamDetails()
{
  m_messenger.Put(std::make_shared<CDVDMsg>(CDVDMsg::PLAYER_SET_UPDATE_STREAM_DETAILS));
}

void CVideoPlayer::NotifySubtitleUpdate(int flags)
{
  CVariant data;
  data["player"]["playerid"] = m_item.GetProperty("playlist_type_hint").asInteger32(-1);
  if ((flags & SubtitleChange::FLAG_STATUS_CHANGE) != 0)
  {
    data["property"]["subtitleenabled"] = m_processInfo->GetVideoSettings().m_SubtitleOn;
  }
  if ((flags & SubtitleChange::FLAG_STREAMINFO_CHANGE) != 0)
  {
    const int stream = m_processInfo->GetVideoSettings().m_SubtitleStream;
    SubtitleStreamInfo info;
    GetSubtitleStreamInfo(stream, info);
    if (!info.valid)
    {
      // Only proceed if we're also sending status change
      if ((flags & SubtitleChange::FLAG_STATUS_CHANGE) == 0)
        return;
    }
    else
    {
      // Only add stream info if valid