summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-21 06:17:22 +0300
committerUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-23 13:48:37 +0300
commit3ee6503a078a45f1506fa0daaa768a511d58fcf0 (patch)
tree55a6a6259272b9c30569d50c2d5d42d2adff62ca
parentc1f9fe7d673ab7c34232a1fe9312e60f81503ccf (diff)
downloadmpv-3ee6503a078a45f1506fa0daaa768a511d58fcf0.tar.bz2
mpv-3ee6503a078a45f1506fa0daaa768a511d58fcf0.tar.xz
Move global rel_seek_secs and abs_seek_pos to mpctx
-rw-r--r--command.c30
-rw-r--r--mp_core.h6
-rw-r--r--mplayer.c22
3 files changed, 28 insertions, 30 deletions
diff --git a/command.c b/command.c
index bc22c1d5b6..59840d9652 100644
--- a/command.c
+++ b/command.c
@@ -348,8 +348,8 @@ static int mp_property_percent_pos(m_option_t * prop, int action,
demuxer_get_percent_pos(mpctx->demuxer));
}
- abs_seek_pos = SEEK_ABSOLUTE | SEEK_FACTOR;
- rel_seek_secs = pos / 100.0;
+ mpctx->abs_seek_pos = SEEK_ABSOLUTE | SEEK_FACTOR;
+ mpctx->rel_seek_secs = pos / 100.0;
return M_PROPERTY_OK;
}
@@ -363,12 +363,12 @@ static int mp_property_time_pos(m_option_t * prop, int action,
case M_PROPERTY_SET:
if(!arg) return M_PROPERTY_ERROR;
M_PROPERTY_CLAMP(prop, *(double*)arg);
- abs_seek_pos = SEEK_ABSOLUTE;
- rel_seek_secs = *(double*)arg;
+ mpctx->abs_seek_pos = SEEK_ABSOLUTE;
+ mpctx->rel_seek_secs = *(double*)arg;
return M_PROPERTY_OK;
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
- rel_seek_secs += (arg ? *(double*)arg : 10.0) *
+ mpctx->rel_seek_secs += (arg ? *(double*)arg : 10.0) *
(action == M_PROPERTY_STEP_UP ? 1.0 : -1.0);
return M_PROPERTY_OK;
}
@@ -427,21 +427,21 @@ static int mp_property_chapter(m_option_t *prop, int action, void *arg,
default:
return M_PROPERTY_NOT_IMPLEMENTED;
}
- rel_seek_secs = 0;
- abs_seek_pos = 0;
+ mpctx->rel_seek_secs = 0;
+ mpctx->abs_seek_pos = 0;
chapter = demuxer_seek_chapter(mpctx->demuxer, chapter, 1,
&next_pts, &chapter_num, &chapter_name);
if (chapter >= 0) {
if (next_pts > -1.0) {
- abs_seek_pos = SEEK_ABSOLUTE;
- rel_seek_secs = next_pts;
+ mpctx->abs_seek_pos = SEEK_ABSOLUTE;
+ mpctx->rel_seek_secs = next_pts;
}
if (chapter_name)
set_osd_msg(OSD_MSG_TEXT, 1, osd_duration,
MSGTR_OSDChapter, chapter + 1, chapter_name);
}
else if (step_all > 0)
- rel_seek_secs = 1000000000.;
+ mpctx->rel_seek_secs = 1000000000.;
else
set_osd_msg(OSD_MSG_TEXT, 1, osd_duration,
MSGTR_OSDChapter, 0, MSGTR_Unknown);
@@ -2301,18 +2301,18 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
v = cmd->args[0].v.f;
abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0;
if (abs == 2) { /* Absolute seek to a specific timestamp in seconds */
- abs_seek_pos = SEEK_ABSOLUTE;
+ mpctx->abs_seek_pos = SEEK_ABSOLUTE;
if (sh_video)
mpctx->osd_function =
(v > sh_video->pts) ? OSD_FFW : OSD_REW;
- rel_seek_secs = v;
+ mpctx->rel_seek_secs = v;
} else if (abs) { /* Absolute seek by percentage */
- abs_seek_pos = SEEK_ABSOLUTE | SEEK_FACTOR;
+ mpctx->abs_seek_pos = SEEK_ABSOLUTE | SEEK_FACTOR;
if (sh_video)
mpctx->osd_function = OSD_FFW; // Direction isn't set correctly
- rel_seek_secs = v / 100.0;
+ mpctx->rel_seek_secs = v / 100.0;
} else {
- rel_seek_secs += v;
+ mpctx->rel_seek_secs += v;
mpctx->osd_function = (v > 0) ? OSD_FFW : OSD_REW;
}
brk_cmd = 1;
diff --git a/mp_core.h b/mp_core.h
index 2307a88724..32f7f26ef8 100644
--- a/mp_core.h
+++ b/mp_core.h
@@ -74,6 +74,10 @@ typedef struct MPContext {
// by the audio CPU usage meter.
double delay;
+ // Used to communicate the parameters of a seek between parts
+ float rel_seek_secs;
+ int abs_seek_pos;
+
float begin_skip; ///< start time of the current skip while on edlout mode
// audio is muted if either EDL or user activates mute
short edl_muted; ///< Stores whether EDL is currently in muted mode.
@@ -108,8 +112,6 @@ typedef struct MPContext {
// Most of these should not be globals
-extern int abs_seek_pos;
-extern float rel_seek_secs;
extern FILE *edl_fd;
extern int file_filter;
// These appear in options list
diff --git a/mplayer.c b/mplayer.c
index 752241577a..93a7f1de79 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -234,10 +234,6 @@ static m_time_size_t end_at = { .type = END_AT_NONE, .pos = 0 };
// A/V sync:
int autosync=0; // 30 might be a good default value.
-// may be changed by GUI: (FIXME!)
-float rel_seek_secs=0;
-int abs_seek_pos=0;
-
// codecs:
char **audio_codec_list=NULL; // override audio codec
char **video_codec_list=NULL; // override video codec
@@ -2359,7 +2355,7 @@ static void pause_loop(struct MPContext *mpctx)
if (use_gui) {
guiEventHandling();
guiGetEvent(guiReDraw, NULL);
- if (guiIntfStruct.Playing!=2 || (rel_seek_secs || abs_seek_pos))
+ if (guiIntfStruct.Playing!=2 || (mpctx->rel_seek_secs || mpctx->abs_seek_pos))
break;
}
#endif
@@ -2463,8 +2459,8 @@ static void edl_update(MPContext *mpctx)
if (mpctx->sh_video->pts >= next_edl_record->start_sec) {
if (next_edl_record->action == EDL_SKIP) {
mpctx->osd_function = OSD_FFW;
- abs_seek_pos = 0;
- rel_seek_secs = next_edl_record->length_sec;
+ mpctx->abs_seek_pos = 0;
+ mpctx->rel_seek_secs = next_edl_record->length_sec;
mp_msg(MSGT_CPLAYER, MSGL_DBG4, "EDL_SKIP: start [%f], stop "
"[%f], length [%f]\n", next_edl_record->start_sec,
next_edl_record->stop_sec, next_edl_record->length_sec);
@@ -3849,7 +3845,7 @@ if(auto_quality>0){
// handle -sstep
if(step_sec>0) {
mpctx->osd_function=OSD_FFW;
- rel_seek_secs+=step_sec;
+ mpctx->rel_seek_secs+=step_sec;
}
edl_update(mpctx);
@@ -3878,12 +3874,12 @@ if(step_sec>0) {
if(opts->loop_times==1) opts->loop_times=-1;
play_n_frames=play_n_frames_mf;
mpctx->eof=0;
- abs_seek_pos=SEEK_ABSOLUTE; rel_seek_secs=seek_to_sec;
+ mpctx->abs_seek_pos=SEEK_ABSOLUTE; mpctx->rel_seek_secs=seek_to_sec;
loop_seek = 1;
}
-if(rel_seek_secs || abs_seek_pos){
- if (seek(mpctx, rel_seek_secs, abs_seek_pos) >= 0) {
+if(mpctx->rel_seek_secs || mpctx->abs_seek_pos){
+ if (seek(mpctx, mpctx->rel_seek_secs, mpctx->abs_seek_pos) >= 0) {
// Set OSD:
if(!loop_seek){
if( !edl_decision )
@@ -3891,8 +3887,8 @@ if(rel_seek_secs || abs_seek_pos){
}
}
- rel_seek_secs=0;
- abs_seek_pos=0;
+ mpctx->rel_seek_secs=0;
+ mpctx->abs_seek_pos=0;
loop_seek=0;
edl_decision = 0;
}