Beispiel #1
0
int MythBDPlayer::GetCurrentChapter(void)
{
    uint total = GetNumChapters();
    if (!total)
        return 0;

    for (int i = (total - 1); i > -1 ; i--)
    {
        uint64_t frame = player_ctx->buffer->BD()->GetChapterStartFrame(i);
        if (framesPlayed >= frame)
        {
            VERBOSE(VB_PLAYBACK, LOC +
                    QString("GetCurrentChapter(selected chapter %1 framenum %2)")
                            .arg(i + 1).arg(frame));
            return i + 1;
        }
    }
    return 0;
}
Beispiel #2
0
bool MythDVDPlayer::DoJumpChapter(int chapter)
{
    if (!player_ctx->buffer->IsDVD())
        return false;

    int total   = GetNumChapters();
    int current = GetCurrentChapter();

    if (chapter < 0 || chapter > total)
    {
        if (chapter < 0)
        {
            chapter = current -1;
            if (chapter < 0) chapter = 0;
        }
        else if (chapter > total)
        {
            chapter = current + 1;
            if (chapter > total) chapter = total;
        }
    }

    bool success = player_ctx->buffer->DVD()->playTrack(chapter);
    if (success)
    {
        if (decoder)
        {
            decoder->UpdateFramesPlayed();
            if (player_ctx->buffer->DVD()->GetCellStart() == 0)
                decoder->SeekReset(framesPlayed, 0, true, true);
        }
        ClearAfterSeek(!player_ctx->buffer->IsInDiscMenuOrStillFrame());
    }

    jumpchapter = 0;
    return success;
}
Beispiel #3
0
bool BDRingBuffer::UpdateTitleInfo(void)
{
    QMutexLocker locker(&m_infoLock);
    if (!m_currentTitleInfo)
        return false;

    m_titleChanged = true;
    m_currentTitleLength = m_currentTitleInfo->duration;
    m_currentTitleAngleCount = m_currentTitleInfo->angle_count;
    m_currentAngle = 0;
    m_titlesize = bd_get_title_size(bdnav);
    uint32_t chapter_count = GetNumChapters();
    uint64_t total_secs = m_currentTitleLength / 90000;
    int hours = (int)total_secs / 60 / 60;
    int minutes = ((int)total_secs / 60) - (hours * 60);
    double secs = (double)total_secs - (double)(hours * 60 * 60 + minutes * 60);
    QString duration = QString("%1:%2:%3")
                        .arg(QString().sprintf("%02d", hours))
                        .arg(QString().sprintf("%02d", minutes))
                        .arg(QString().sprintf("%02.1f", secs));
    VERBOSE(VB_IMPORTANT, LOC +
        QString("New title info: Index %1 Playlist: %2 Duration: %3 Chapters: %5")
                .arg(m_currentTitleInfo->idx).arg(m_currentTitleInfo->playlist)
                .arg(duration).arg(chapter_count));
    VERBOSE(VB_IMPORTANT, LOC +
        QString("New title info: Clips: %6 Angles: %7 Title Size: %8 Frame Rate %9")
                .arg(m_currentTitleInfo->clip_count)
                .arg(m_currentTitleAngleCount).arg(m_titlesize)
                .arg(GetFrameRate()));

    if (chapter_count)
    {
        for (uint i = 0; i < chapter_count; i++)
        {
            uint64_t total_secs = GetChapterStartTime(i);
            uint64_t framenum   = GetChapterStartFrame(i);
            int hours = (int)total_secs / 60 / 60;
            int minutes = ((int)total_secs / 60) - (hours * 60);
            double secs = (double)total_secs - (double)(hours * 60 * 60 + minutes * 60);
            VERBOSE(VB_PLAYBACK, LOC + QString("Chapter %1 found @ [%2:%3:%4]->%5")
                    .arg(QString().sprintf("%02d", i + 1))
                    .arg(QString().sprintf("%02d", hours))
                    .arg(QString().sprintf("%02d", minutes))
                    .arg(QString().sprintf("%06.3f", secs))
                    .arg(framenum));
        }
    }

    int still = BLURAY_STILL_NONE;
    int time  = 0;
    if (m_currentTitleInfo->clip_count)
    {
        for (uint i = 0; i < m_currentTitleInfo->clip_count; i++)
        {
            VERBOSE(VB_PLAYBACK, LOC + QString("Clip %1 stillmode %2 "
                                               "stilltime %3 videostreams %4 "
                                               "audiostreams %5 igstreams %6")
                    .arg(i).arg(m_currentTitleInfo->clips[i].still_mode)
                    .arg(m_currentTitleInfo->clips[i].still_time)
                    .arg(m_currentTitleInfo->clips[i].video_stream_count)
                    .arg(m_currentTitleInfo->clips[i].audio_stream_count)
                    .arg(m_currentTitleInfo->clips[i].ig_stream_count));
            still |= m_currentTitleInfo->clips[i].still_mode;
            time = m_currentTitleInfo->clips[i].still_time;
        }
    }

    if (m_currentTitleInfo->clip_count > 1 && still != BLURAY_STILL_NONE)
        VERBOSE(VB_IMPORTANT, LOC + "Warning: more than 1 clip, following still"
                                    " frame analysis may be wrong");
    if (still == BLURAY_STILL_TIME)
    {
        VERBOSE(VB_PLAYBACK, LOC +
            QString("Entering still frame (%1 seconds) UNSUPPORTED").arg(time));
    }
    else if (still == BLURAY_STILL_INFINITE)
    {
        VERBOSE(VB_PLAYBACK, LOC + "Entering infinite still frame.");
    }

    m_stillMode = still;
    m_stillTime = time;

    return true;
}