Skip to content

Commit

Permalink
Create bsv_movie_set_frame_start/bsv_movie_set_frame_end
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed Jan 22, 2017
1 parent 5bc611c commit b04056d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
17 changes: 6 additions & 11 deletions movie.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,16 @@ static bsv_movie_t *bsv_movie_init(const char *path,
}

/* Used for rewinding while playback/record. */
static void bsv_movie_set_frame_start(bsv_movie_t *handle)
void bsv_movie_set_frame_start(void)
{
if (!handle)
return;
handle->frame_pos[handle->frame_ptr] = ftell(handle->file);
bsv_movie_t *handle = bsv_movie_state.movie;
if (handle)
handle->frame_pos[handle->frame_ptr] = ftell(handle->file);
}

static void bsv_movie_set_frame_end(bsv_movie_t *handle)
void bsv_movie_set_frame_end(void)
{
bsv_movie_t *handle = bsv_movie_state.movie;
if (!handle)
return;

Expand Down Expand Up @@ -401,12 +402,6 @@ bool bsv_movie_ctl(enum bsv_ctl_state state, void *data)
case BSV_MOVIE_CTL_INIT:
bsv_movie_init_state();
break;
case BSV_MOVIE_CTL_SET_FRAME_START:
bsv_movie_set_frame_start(bsv_movie_state.movie);
break;
case BSV_MOVIE_CTL_SET_FRAME_END:
bsv_movie_set_frame_end(bsv_movie_state.movie);
break;
case BSV_MOVIE_CTL_FRAME_REWIND:
bsv_movie_frame_rewind(bsv_movie_state.movie);
break;
Expand Down
6 changes: 4 additions & 2 deletions movie.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ enum bsv_ctl_state
BSV_MOVIE_CTL_UNSET_START_PLAYBACK,
BSV_MOVIE_CTL_START_PLAYBACK,
BSV_MOVIE_CTL_UNSET_PLAYBACK,
BSV_MOVIE_CTL_SET_FRAME_START,
BSV_MOVIE_CTL_SET_FRAME_END,
BSV_MOVIE_CTL_FRAME_REWIND,
BSV_MOVIE_CTL_DEINIT,
BSV_MOVIE_CTL_INIT,
Expand All @@ -74,6 +72,10 @@ void bsv_movie_set_path(const char *path);

void bsv_movie_set_start_path(const char *path);

void bsv_movie_set_frame_start(void);

void bsv_movie_set_frame_end(void);

bool bsv_movie_ctl(enum bsv_ctl_state state, void *data);

bool bsv_movie_check(void);
Expand Down
6 changes: 2 additions & 4 deletions runloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1114,8 +1114,7 @@ int runloop_iterate(unsigned *sleep_ms)

autosave_lock();

if (bsv_movie_ctl(BSV_MOVIE_CTL_IS_INITED, NULL))
bsv_movie_ctl(BSV_MOVIE_CTL_SET_FRAME_START, NULL);
bsv_movie_set_frame_start();

camera_driver_ctl(RARCH_CAMERA_CTL_POLL, NULL);

Expand Down Expand Up @@ -1157,8 +1156,7 @@ int runloop_iterate(unsigned *sleep_ms)
input_pop_analog_dpad(auto_binds);
}

if (bsv_movie_ctl(BSV_MOVIE_CTL_IS_INITED, NULL))
bsv_movie_ctl(BSV_MOVIE_CTL_SET_FRAME_END, NULL);
bsv_movie_set_frame_end();

autosave_unlock();

Expand Down

0 comments on commit b04056d

Please sign in to comment.