Exemple #1
0
static int pause_toggle_sdl(video_player_h h)
{
    player_ctx_t *ctx = (player_ctx_t *)h;

    if (!ctx)
        return 0;

    if (ctx->common.state == PLAYER_PAUSE)
    {
        struct timespec end_pause;
        uint32_t diff;

        ctx->common.state = PLAYER_PLAY;
        clock_gettime(CLOCK_MONOTONIC, &end_pause);
        diff = util_time_diff(&end_pause, &ctx->common.start_pause);
        util_time_add(&ctx->common.base_time, diff);
    }
    else
    {
        ctx->common.state = PLAYER_PAUSE;
        clock_gettime(CLOCK_MONOTONIC, &ctx->common.start_pause);
    }

    return (ctx->common.state == PLAYER_PAUSE);
}
Exemple #2
0
static ret_code_t seek_sdl(video_player_h h, seek_direction_t dir, int32_t seek)
{
    player_ctx_t *ctx = (player_ctx_t *)h;

    if (dir == L_SEEK_FORWARD)
        util_time_sub(&ctx->common.base_time, seek);
    else if (dir == L_SEEK_BACKWARD)
        util_time_add(&ctx->common.base_time, seek);

    return L_OK;
}
Exemple #3
0
static void
pb_cache_buffer_destroy(struct pb_buffer *_buf)
{
   struct pb_cache_buffer *buf = pb_cache_buffer(_buf);   
   struct pb_cache_manager *mgr = buf->mgr;

   pipe_mutex_lock(mgr->mutex);
   assert(!pipe_is_referenced(&buf->base.base.reference));
   
   _pb_cache_buffer_list_check_free(mgr);
   
   util_time_get(&buf->start);
   util_time_add(&buf->start, mgr->usecs, &buf->end);
   LIST_ADDTAIL(&buf->head, &mgr->delayed);
   ++mgr->numDelayed;
   pipe_mutex_unlock(mgr->mutex);
}