Ejemplo n.º 1
0
/* Common */
static int AStreamSeek(stream_t *s, uint64_t offset)
{
    stream_sys_t *sys = s->p_sys;

    if (sys->block != NULL)
    {
        block_Release(sys->block);
        sys->block = NULL;
    }

    return vlc_access_Seek(sys->access, offset);
}
Ejemplo n.º 2
0
static int Seek(access_t *access, uint64_t position)
{
    access_sys_t *sys = access->p_sys;

    if (sys->access != NULL)
    {
        vlc_access_Delete(sys->access);
        sys->access = NULL;
    }

    sys->next = sys->first;
    access->info.i_pos = 0;

    for (;;)
    {
        access_t *a = GetAccess(access);
        if (a == NULL)
            break;

        bool can_seek;
        access_Control(a, ACCESS_CAN_SEEK, &can_seek);
        if (!can_seek)
            break;

        uint64_t size;

        if (access_GetSize(a, &size))
            break;
        if (position - access->info.i_pos < size)
        {
            if (vlc_access_Seek(a, position - access->info.i_pos))
                break;

            access->info.i_pos = position;
            return VLC_SUCCESS;
        }

        access->info.i_pos += size;
        vlc_access_Delete(a);
        sys->access = NULL;
    }

    return VLC_EGENERIC;
}