当前位置: 首页>>代码示例>>C++>>正文


C++ AudioChannelService类代码示例

本文整理汇总了C++中AudioChannelService的典型用法代码示例。如果您正苦于以下问题:C++ AudioChannelService类的具体用法?C++ AudioChannelService怎么用?C++ AudioChannelService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AudioChannelService类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MOZ_ASSERT

PLDHashOperator
AudioChannelService::WindowDestroyedEnumerator(AudioChannelAgent* aAgent,
                                               nsAutoPtr<AudioChannelAgentData>& aData,
                                               void* aPtr)
{
  auto* data = static_cast<WindowDestroyedEnumeratorData*>(aPtr);
  MOZ_ASSERT(data);

  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aAgent->Window());
  if (window && !window->IsInnerWindow()) {
    window = window->GetCurrentInnerWindow();
  }

  if (!window || window->WindowID() != data->mInnerID) {
    return PL_DHASH_NEXT;
  }

  AudioChannelService* service = AudioChannelService::GetAudioChannelService();
  MOZ_ASSERT(service);

  service->UnregisterType(aData->mChannel, aData->mElementHidden,
                          CONTENT_PROCESS_ID_MAIN, aData->mWithVideo);
  data->mAgents.AppendElement(aAgent);

  return PL_DHASH_REMOVE;
}
开发者ID:danemacmillan,项目名称:gecko-dev,代码行数:26,代码来源:AudioChannelService.cpp

示例2: NotifyAudioChannelStateChanged

void AudioChannelAgent::NotifyAudioChannelStateChanged()
{
    if (mCallback != nullptr) {
        AudioChannelService *service = AudioChannelService::GetAudioChannelService();
        mCallback->CanPlayChanged(!service->GetMuted(this, !mVisible));
    }
}
开发者ID:jraff,项目名称:mozilla-central,代码行数:7,代码来源:AudioChannelAgent.cpp

示例3: SetPhoneState

void
AudioManager::HandleAudioChannelProcessChanged()
{
  // Note: If the user answers a VoIP call (e.g. WebRTC calls) during the
  // telephony call (GSM/CDMA calls) the audio manager won't set the
  // PHONE_STATE_IN_COMMUNICATION audio state. Once the telephony call finishes
  // the RIL plumbing sets the PHONE_STATE_NORMAL audio state. This seems to be
  // an issue for the VoIP call but it is not. Once the RIL plumbing sets the
  // the PHONE_STATE_NORMAL audio state the AudioManager::mPhoneAudioAgent
  // member will call the StopPlaying() method causing that this function will
  // be called again and therefore the audio manager sets the
  // PHONE_STATE_IN_COMMUNICATION audio state.

  if ((mPhoneState == PHONE_STATE_IN_CALL) ||
      (mPhoneState == PHONE_STATE_RINGTONE)) {
    return;
  }

  AudioChannelService *service = AudioChannelService::GetOrCreateAudioChannelService();
  MOZ_ASSERT(service);

  bool telephonyChannelIsActive = service->TelephonyChannelIsActive();
  telephonyChannelIsActive ? SetPhoneState(PHONE_STATE_IN_COMMUNICATION) :
                             SetPhoneState(PHONE_STATE_NORMAL);
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例4: MOZ_COUNT_DTOR

SpeakerManagerService::~SpeakerManagerService()
{
  MOZ_COUNT_DTOR(SpeakerManagerService);
  AudioChannelService* audioChannelService =
    AudioChannelService::GetOrCreateAudioChannelService();
  if (audioChannelService)
    audioChannelService->UnregisterSpeakerManager(this);
}
开发者ID:Bouh,项目名称:gecko-dev,代码行数:8,代码来源:SpeakerManagerService.cpp

示例5: GetCallback

void AudioChannelAgent::NotifyAudioChannelStateChanged()
{
  nsCOMPtr<nsIAudioChannelAgentCallback> callback = GetCallback();
  if (callback) {
    AudioChannelService *service = AudioChannelService::GetAudioChannelService();
    callback->CanPlayChanged(service->GetState(this, !mVisible));
  }
}
开发者ID:Balakrishnan-Vivek,项目名称:gecko-dev,代码行数:8,代码来源:AudioChannelAgent.cpp

示例6: MOZ_ASSERT

SpeakerManagerServiceChild::SpeakerManagerServiceChild()
{
  MOZ_ASSERT(NS_IsMainThread());
  AudioChannelService* audioChannelService = AudioChannelService::GetOrCreateAudioChannelService();
  if (audioChannelService) {
    audioChannelService->RegisterSpeakerManager(this);
  }
  MOZ_COUNT_CTOR(SpeakerManagerServiceChild);
}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:9,代码来源:SpeakerManagerServiceChild.cpp

示例7: SetVisibilityState

/* void setVisibilityState (in boolean visible); */
NS_IMETHODIMP AudioChannelAgent::SetVisibilityState(bool visible)
{
    bool oldVisibility = mVisible;

    mVisible = visible;
    if (mIsRegToService && oldVisibility != mVisible && mCallback != nullptr) {
        AudioChannelService *service = AudioChannelService::GetAudioChannelService();
        mCallback->CanPlayChanged(!service->GetMuted(this, !mVisible));
    }
    return NS_OK;
}
开发者ID:jraff,项目名称:mozilla-central,代码行数:12,代码来源:AudioChannelAgent.cpp

示例8: StopPlaying

/* void stopPlaying (); */
NS_IMETHODIMP AudioChannelAgent::StopPlaying(void)
{
    if (mAudioChannelType == AUDIO_AGENT_CHANNEL_ERROR ||
            mIsRegToService == false) {
        return NS_ERROR_FAILURE;
    }

    AudioChannelService *service = AudioChannelService::GetAudioChannelService();
    service->UnregisterAudioChannelAgent(this);
    mIsRegToService = false;
    return NS_OK;
}
开发者ID:jraff,项目名称:mozilla-central,代码行数:13,代码来源:AudioChannelAgent.cpp

示例9: StartPlaying

/* boolean startPlaying (); */
NS_IMETHODIMP AudioChannelAgent::StartPlaying(bool *_retval)
{
    AudioChannelService *service = AudioChannelService::GetAudioChannelService();
    if (mAudioChannelType == AUDIO_AGENT_CHANNEL_ERROR ||
            service == nullptr) {
        return NS_ERROR_FAILURE;
    }

    service->RegisterAudioChannelAgent(this,
                                       static_cast<AudioChannelType>(mAudioChannelType));
    *_retval = !service->GetMuted(this, !mVisible);
    mIsRegToService = true;
    return NS_OK;
}
开发者ID:jraff,项目名称:mozilla-central,代码行数:15,代码来源:AudioChannelAgent.cpp

示例10: StartPlaying

/* boolean startPlaying (); */
NS_IMETHODIMP AudioChannelAgent::StartPlaying(int32_t *_retval)
{
  AudioChannelService *service = AudioChannelService::GetAudioChannelService();
  if (mAudioChannelType == AUDIO_AGENT_CHANNEL_ERROR ||
      service == nullptr || mIsRegToService) {
    return NS_ERROR_FAILURE;
  }

  service->RegisterAudioChannelAgent(this,
    static_cast<AudioChannel>(mAudioChannelType), mWithVideo);
  *_retval = service->GetState(this, !mVisible);
  mIsRegToService = true;
  return NS_OK;
}
开发者ID:Balakrishnan-Vivek,项目名称:gecko-dev,代码行数:15,代码来源:AudioChannelAgent.cpp

示例11: mOrgSpeakerStatus

SpeakerManagerService::SpeakerManagerService()
  : mOrgSpeakerStatus(false),
    mVisible(false)
{
  MOZ_COUNT_CTOR(SpeakerManagerService);
  if (XRE_IsParentProcess()) {
    nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
    if (obs) {
      obs->AddObserver(this, "ipc:content-shutdown", false);
    }
  }
  AudioChannelService* audioChannelService =
    AudioChannelService::GetOrCreateAudioChannelService();
  if (audioChannelService) {
    audioChannelService->RegisterSpeakerManager(this);
  }
}
开发者ID:Bouh,项目名称:gecko-dev,代码行数:17,代码来源:SpeakerManagerService.cpp

示例12: MOZ_ASSERT

PLDHashOperator
AudioChannelService::WindowDestroyedEnumerator(AudioChannelAgent* aAgent,
                                               nsAutoPtr<AudioChannelAgentData>& aData,
                                               void* aPtr)
{
  uint64_t* innerID = static_cast<uint64_t*>(aPtr);
  MOZ_ASSERT(innerID);

  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aAgent->Window());
  if (!window || window->WindowID() != *innerID) {
    return PL_DHASH_NEXT;
  }

  AudioChannelService* service = AudioChannelService::GetAudioChannelService();
  MOZ_ASSERT(service);

  service->UnregisterType(aData->mChannel, aData->mElementHidden,
                          CONTENT_PROCESS_ID_MAIN, aData->mWithVideo);

  return PL_DHASH_REMOVE;
}
开发者ID:Acidburn0zzz,项目名称:tor-browser,代码行数:21,代码来源:AudioChannelService.cpp

示例13: do_GetInterface

NS_IMETHODIMP
SpeakerManager::HandleEvent(nsIDOMEvent* aEvent)
{
  nsAutoString type;
  aEvent->GetType(type);

  if (!type.EqualsLiteral("visibilitychange")) {
    return NS_ERROR_FAILURE;
  }

  nsCOMPtr<nsIDocShell> docshell = do_GetInterface(GetOwner());
  NS_ENSURE_TRUE(docshell, NS_ERROR_FAILURE);
  docshell->GetIsActive(&mVisible);

  // If an app that has called forcespeaker=true is switched
  // from the background to the foreground 'speakerforced'
  // switches to true in all apps. I.e. the app doesn't have to
  // call forcespeaker=true again when it comes into foreground.
  SpeakerManagerService *service =
    SpeakerManagerService::GetOrCreateSpeakerManagerService();
  MOZ_ASSERT(service);

  if (mVisible && mForcespeaker) {
    service->ForceSpeaker(mForcespeaker, mVisible);
  }
  // If an application that has called forcespeaker=true, but no audio is
  // currently playing in the app itself, if application switch to
  // the background, we switch 'speakerforced' to false.
  if (!mVisible && mForcespeaker) {
    AudioChannelService* audioChannelService =
      AudioChannelService::GetOrCreateAudioChannelService();
    if (audioChannelService && !audioChannelService->AnyAudioChannelIsActive()) {
      service->ForceSpeaker(false, mVisible);
    }
  }
  return NS_OK;
}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:37,代码来源:SpeakerManager.cpp


注:本文中的AudioChannelService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。