Skip to content

Commit

Permalink
add option for seeking at start
Browse files Browse the repository at this point in the history
Signed-off-by: Zhang Rui <[email protected]>
  • Loading branch information
xinzhengzhang authored and bbcallen committed Mar 21, 2016
1 parent d061590 commit a70298e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ijkmedia/ijkplayer/ff_ffplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -2625,6 +2625,10 @@ static int read_thread(void *arg)
ffp_notify_msg1(ffp, FFP_REQ_START);
ffp->auto_resume = 0;
}
/* offset should be seeked*/
if (ffp->seek_at_start > 0) {
ffp_seek_to_l(ffp, ffp->seek_at_start);
}

for (;;) {
if (is->abort_request)
Expand Down
2 changes: 2 additions & 0 deletions ijkmedia/ijkplayer/ff_ffplay_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ typedef struct FFPlayer {
#endif
int loop;
int framedrop;
int64_t seek_at_start;
int infinite_buffer;
enum ShowMode show_mode;
char *audio_codec_name;
Expand Down Expand Up @@ -668,6 +669,7 @@ inline static void ffp_reset_internal(FFPlayer *ffp)
ffp->autoexit = 0;
ffp->loop = 1;
ffp->framedrop = 0; // option
ffp->seek_at_start = 0;
ffp->infinite_buffer = -1;
ffp->show_mode = SHOW_MODE_NONE;
av_freep(&ffp->audio_codec_name);
Expand Down
9 changes: 8 additions & 1 deletion ijkmedia/ijkplayer/ff_ffplay_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
.min = min__, \
.max = max__, \
.flags = AV_OPT_FLAG_DECODING_PARAM

#define OPTION_INT64(default__, min__, max__) \
.type = AV_OPT_TYPE_INT64, \
{ .i64 = default__ }, \
.min = min__, \
.max = max__, \
.flags = AV_OPT_FLAG_DECODING_PARAM
#define OPTION_CONST(default__) \
.type = AV_OPT_TYPE_CONST, \
{ .i64 = default__ }, \
Expand Down Expand Up @@ -66,6 +71,8 @@ static const AVOption ffp_context_options[] = {
OPTION_OFFSET(infinite_buffer), OPTION_INT(0, 0, 1) },
{ "framedrop", "drop frames when cpu is too slow",
OPTION_OFFSET(framedrop), OPTION_INT(0, -1, 120) },
{ "seek-at-start", "set offset of player should be seeked",
OPTION_OFFSET(seek_at_start), OPTION_INT64(0, 0, INT_MAX) },
// FFP_MERGE: window_title
#if CONFIG_AVFILTER
{ "af", "audio filters",
Expand Down

0 comments on commit a70298e

Please sign in to comment.