Beispiel #1
0
int hb_bd_seek_pts( hb_bd_t * d, uint64_t pts )
{
    bd_seek_time(d->bd, pts);
    d->next_chap = bd_get_current_chapter( d->bd ) + 1;
    hb_ts_stream_reset(d->stream);
    return 1;
}
Beispiel #2
0
uint64_t BDRingBuffer::Seek(uint64_t pos)
{
    VERBOSE(VB_PLAYBACK, LOC + QString("Seeking to %1.").arg(pos));
    if (bdnav)
        return bd_seek_time(bdnav, pos);
    return 0;
}
Beispiel #3
0
uint64_t BDRingBuffer::SeekInternal(uint64_t pos)
{
    LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Seeking to %1.").arg(pos));
    if (bdnav)
        return bd_seek_time(bdnav, pos);
    return 0;
}
JNIEXPORT jlong JNICALL Java_org_videolan_Libbluray_seekTimeN(JNIEnv * env,
        jclass cls, jlong np, jlong tick) {
    BDJAVA* bdj = (BDJAVA*)(intptr_t)np;

    BD_DEBUG(DBG_JNI, "seekTimeN(%"PRId64")\n", (int64_t)tick);

    return bd_seek_time(bdj->bd, tick);
}
Beispiel #5
0
/***********************************************************************
 * hb_bd_seek
 ***********************************************************************
 *
 **********************************************************************/
int hb_bd_seek( hb_bd_t * d, float f )
{
    uint64_t pos = f * d->duration;

    bd_seek_time(d->bd, pos);
    d->next_chap = bd_get_current_chapter( d->bd ) + 1;
    hb_ts_stream_reset(d->stream);
    return 1;
}
Beispiel #6
0
uint64_t BDRingBuffer::Seek(uint64_t pos)
{
    VERBOSE(VB_PLAYBACK|VB_EXTRA, LOC + QString("Seeking to %1.")
                .arg(pos));

    bd_seek_time(bdnav, pos);

    return GetReadPosition();
}
Beispiel #7
0
static int bluray_stream_control(stream_t *s, int cmd, void *arg)
{
    struct bluray_priv_s *b = s->priv;

    switch (cmd) {

    case STREAM_CTRL_GET_NUM_CHAPTERS: {
        BLURAY_TITLE_INFO *ti;

        ti = bd_get_title_info(b->bd, b->current_title, b->current_angle);
        if (!ti)
            return STREAM_UNSUPPORTED;

        *((unsigned int *) arg) = ti->chapter_count;
        bd_free_title_info(ti);

        return 1;
    }

    case STREAM_CTRL_GET_CURRENT_TITLE: {
        *((unsigned int *) arg) = b->current_title;
        return 1;
    }

    case STREAM_CTRL_GET_CURRENT_CHAPTER: {
        *((unsigned int *) arg) = bd_get_current_chapter(b->bd);
        return 1;
    }

    case STREAM_CTRL_SEEK_TO_CHAPTER: {
        BLURAY_TITLE_INFO *ti;
        int chapter = *((unsigned int *) arg);
        int64_t pos;
        int r;

        ti = bd_get_title_info(b->bd, b->current_title, b->current_angle);
        if (!ti)
            return STREAM_UNSUPPORTED;

        if (chapter < 0 || chapter > ti->chapter_count) {
            bd_free_title_info(ti);
            return STREAM_UNSUPPORTED;
        }

        pos = bd_chapter_pos(b->bd, chapter);
        r = bluray_stream_seek(s, pos);
        bd_free_title_info(ti);

        return r ? 1 : STREAM_UNSUPPORTED;
    }

    case STREAM_CTRL_GET_TIME_LENGTH: {
        BLURAY_TITLE_INFO *ti = bd_get_title_info(b->bd, b->current_title, b->current_angle);
        if (!ti)
            return STREAM_UNSUPPORTED;
        *(double *)arg = ti->duration / 90000.0;
        return STREAM_OK;
    }
    case STREAM_CTRL_GET_SIZE:
        *(uint64_t*)arg = bd_get_title_size(b->bd);
        return STREAM_OK;

    case STREAM_CTRL_GET_CURRENT_TIME:
        *(double *)arg = bd_tell_time(b->bd) / 90000.0;
        return STREAM_OK;
    case STREAM_CTRL_SEEK_TO_TIME: {
        int64_t res;
        double target = *(double*)arg * 90000.0;
        BLURAY_TITLE_INFO *ti = bd_get_title_info(b->bd, b->current_title, b->current_angle);
        // clamp to ensure that out-of-bounds seeks do not simply do nothing.
        target = FFMAX(target, 0);
        if (ti && ti->duration > 1)
            target = FFMIN(target, ti->duration - 1);
        res = bd_seek_time(b->bd, target);
        if (res < 0)
            return STREAM_ERROR;
        s->pos = res;
        return 1;
    }

    case STREAM_CTRL_GET_NUM_ANGLES: {
        BLURAY_TITLE_INFO *ti;

        ti = bd_get_title_info(b->bd, b->current_title, b->current_angle);
        if (!ti)
            return STREAM_UNSUPPORTED;

        *((int *) arg) = ti->angle_count;
        bd_free_title_info(ti);

        return 1;
    }

    case STREAM_CTRL_GET_ANGLE: {
        *((int *) arg) = b->current_angle;
        return 1;
    }

    case STREAM_CTRL_SET_ANGLE: {
        BLURAY_TITLE_INFO *ti;
        int angle = *((int *) arg);

        ti = bd_get_title_info(b->bd, b->current_title, b->current_angle);
        if (!ti)
            return STREAM_UNSUPPORTED;

        if (angle < 0 || angle > ti->angle_count) {
            bd_free_title_info(ti);
            return STREAM_UNSUPPORTED;
        }

        b->current_angle = angle;
        bd_seamless_angle_change(b->bd, angle);
        bd_free_title_info(ti);

        return 1;
    }

    case STREAM_CTRL_GET_LANG: {
        struct stream_lang_req *req = arg;
        const BLURAY_STREAM_INFO *si;
        int count;
        BLURAY_TITLE_INFO *ti = get_langs(b, req->type, &si, &count);
        while (count-- > 0) {
            if (si->pid == req->id) {
                memcpy(req->buf, si->lang, 4);
                req->buf[4] = 0;
                bd_free_title_info(ti);
                return STREAM_OK;
            }
            si++;
        }
        if (ti)
            bd_free_title_info(ti);
        return STREAM_ERROR;
    }

    default:
        break;
    }

    return STREAM_UNSUPPORTED;
}