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


C++ AudioPlayer::SetAudioInfo方法代码示例

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


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

示例1: CreatePlayer

bool PlayerContext::CreatePlayer(TV *tv, QWidget *widget,
                                 TVState desiredState,
                                 bool embed, const QRect &embedbounds,
                                 bool muted)
{
    if (HasPlayer())
    {
        LOG(VB_GENERAL, LOG_ERR, LOC +
                "Attempting to setup a player, but it already exists.");
        return false;
    }

    uint playerflags = kDecodeAllowEXT; // allow VDA etc for normal playback
    playerflags |= muted              ? kAudioMuted : kNoFlags;
    playerflags |= useNullVideo       ? kVideoIsNull : kNoFlags;
    playerflags |= nohardwaredecoders ? kNoFlags : kDecodeAllowGPU;

    MythPlayer *player = NULL;
    if (kState_WatchingBD  == desiredState)
        player = new MythBDPlayer((PlayerFlags)playerflags);
    else if (kState_WatchingDVD == desiredState)
        player = new MythDVDPlayer((PlayerFlags)playerflags);
    else
        player = new MythPlayer((PlayerFlags)playerflags);

    QString passthru_device = 
        gCoreContext->GetNumSetting("PassThruDeviceOverride", false) ?
        gCoreContext->GetSetting("PassThruOutputDevice") : QString::null;

    player->SetPlayerInfo(tv, widget, this);
    AudioPlayer *audio = player->GetAudio();
    audio->SetAudioInfo(gCoreContext->GetSetting("AudioOutputDevice"),
                        passthru_device,
                        gCoreContext->GetNumSetting("AudioSampleRate", 44100));
    audio->SetStretchFactor(ts_normal);
    player->SetLength(playingLen);

    player->SetVideoFilters((useNullVideo) ? "onefield" : "");

    if (!IsAudioNeeded())
        audio->SetNoAudio();
    else
    {
        QString subfn = buffer->GetSubtitleFilename();
        if (!subfn.isEmpty() && player->GetSubReader())
            player->GetSubReader()->LoadExternalSubtitles(subfn);
    }

    if (embed && !embedbounds.isNull())
        player->EmbedInWidget(embedbounds);

    bool isWatchingRecording = (desiredState == kState_WatchingRecording);
    player->SetWatchingRecording(isWatchingRecording);

    SetPlayer(player);

    if (pipState == kPIPOff || pipState == kPBPLeft)
    {
        if (audio->HasAudioOut())
        {
            QString errMsg = audio->ReinitAudio();
        }
    }
    else if (pipState == kPBPRight)
        player->SetMuted(true);

    return StartPlaying(-1);
}
开发者ID:aravilife,项目名称:mythtv-stabilize2,代码行数:68,代码来源:playercontext.cpp

示例2: CreatePlayer

bool PlayerContext::CreatePlayer(TV *tv, QWidget *widget,
                                 TVState desiredState,
                                 WId embedwinid, const QRect *embedbounds,
                                 bool muted)
{
    int exact_seeking = gCoreContext->GetNumSetting("ExactSeeking", 0);

    if (HasPlayer())
    {
        VERBOSE(VB_IMPORTANT, LOC_ERR +
                "Attempting to setup a player, but it already exists.");
        return false;
    }

    MythPlayer *player = NULL;
    if (kState_WatchingBD  == desiredState)
        player = new MythBDPlayer(muted);
    else if (kState_WatchingDVD == desiredState)
        player = new MythDVDPlayer(muted);
    else
        player = new MythPlayer(muted);

    if (nohardwaredecoders)
        player->DisableHardwareDecoders();

    QString passthru_device = gCoreContext->GetNumSetting(
        "PassThruDeviceOverride", false) ?
        gCoreContext->GetSetting("PassThruOutputDevice") : QString::null;

    player->SetPlayerInfo(tv, widget, exact_seeking, this);
    AudioPlayer *audio = player->GetAudio();
    audio->SetAudioInfo(gCoreContext->GetSetting("AudioOutputDevice"),
                        passthru_device,
                        gCoreContext->GetNumSetting("AudioSampleRate", 44100));
    audio->SetStretchFactor(ts_normal);
    player->SetLength(playingLen);

    if (useNullVideo)
        player->SetNullVideo();

    player->SetVideoFilters((useNullVideo) ? "onefield" : "");

    if (!IsAudioNeeded())
        audio->SetNoAudio();
    else
    {
        QString subfn = buffer->GetSubtitleFilename();
        if (!subfn.isEmpty() && player->GetSubReader())
            player->GetSubReader()->LoadExternalSubtitles(subfn);
    }

    if ((embedwinid > 0) && embedbounds)
    {
        player->EmbedInWidget(
            embedbounds->x(), embedbounds->y(),
            embedbounds->width(), embedbounds->height(), embedwinid);
    }

    bool isWatchingRecording = (desiredState == kState_WatchingRecording);
    player->SetWatchingRecording(isWatchingRecording);

    SetPlayer(player);

    if (pipState == kPIPOff || pipState == kPBPLeft)
    {
        if (audio->HasAudioOut())
        {
            QString errMsg = audio->ReinitAudio();
        }
    }
    else if (pipState == kPBPRight)
        player->SetMuted(true);

    return StartPlaying(-1);
}
开发者ID:bwarden,项目名称:mythtv,代码行数:75,代码来源:playercontext.cpp


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