summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c74
1 files changed, 32 insertions, 42 deletions
diff --git a/mplayer.c b/mplayer.c
index e9f707c016..1c2bc7efa3 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -683,11 +683,12 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask)
if (mask & INITIALIZED_AO) {
mpctx->initialized_flags &= ~INITIALIZED_AO;
current_module = "uninit_ao";
- if (mpctx->edl_muted)
- mixer_mute(&mpctx->mixer);
- if (mpctx->ao)
+ if (mpctx->ao) {
+ mixer_uninit(&mpctx->mixer);
ao_uninit(mpctx->ao, mpctx->stop_play != AT_END_OF_FILE);
+ }
mpctx->ao = NULL;
+ mpctx->mixer.ao = NULL;
}
current_module = NULL;
@@ -695,8 +696,6 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask)
void exit_player_with_rc(struct MPContext *mpctx, enum exit_reason how, int rc)
{
- if (mpctx->user_muted && !mpctx->edl_muted)
- mixer_mute(&mpctx->mixer);
uninit_player(mpctx, INITIALIZED_ALL);
#if defined(__MINGW32__) || defined(__CYGWIN__)
timeEndPeriod(1);
@@ -1611,7 +1610,7 @@ void set_osd_bar(struct MPContext *mpctx, int type, const char *name,
if (opts->osd_level < 1)
return;
- if (mpctx->sh_video) {
+ if (mpctx->sh_video && opts->term_osd != 1) {
mpctx->osd_visible = (GetTimerMS() + 1000) | 1;
vo_osd_progbar_type = type;
vo_osd_progbar_value = 256 * (val - min) / (max - min);
@@ -1666,25 +1665,30 @@ static void update_osd_msg(struct MPContext *mpctx)
if (mpctx->add_osd_seek_info) {
double percentage = get_percent_pos(mpctx);
set_osd_bar(mpctx, 0, "Position", 0, 100, percentage);
- if (mpctx->sh_video)
+ if (mpctx->sh_video && opts->term_osd != 1)
mpctx->osd_show_percentage_until = (GetTimerMS() + 1000) | 1;
mpctx->add_osd_seek_info = false;
}
// Look if we have a msg
if ((msg = get_osd_msg(mpctx))) {
- if (strcmp(osd->osd_text, msg->msg)) {
- osd_set_text(osd, msg->msg);
- if (mpctx->sh_video)
+ if (mpctx->sh_video && opts->term_osd != 1) {
+ if (strcmp(osd->osd_text, msg->msg)) {
+ osd_set_text(osd, msg->msg);
vo_osd_changed(OSDTYPE_OSD);
- else if (opts->term_osd)
+ }
+ } else if (opts->term_osd) {
+ if (strcmp(mpctx->terminal_osd_text, msg->msg)) {
+ talloc_free(mpctx->terminal_osd_text);
+ mpctx->terminal_osd_text = talloc_strdup(mpctx, msg->msg);
mp_msg(MSGT_CPLAYER, MSGL_STATUS, "%s%s\n", opts->term_osd_esc,
- msg->msg);
+ mpctx->terminal_osd_text);
+ }
}
return;
}
- if (mpctx->sh_video) {
+ if (mpctx->sh_video && opts->term_osd != 1) {
// fallback on the timer
if (opts->osd_level >= 2) {
int len = get_time_length(mpctx);
@@ -1749,8 +1753,8 @@ static void update_osd_msg(struct MPContext *mpctx)
}
// Clear the term osd line
- if (opts->term_osd && osd->osd_text[0]) {
- osd->osd_text[0] = 0;
+ if (opts->term_osd && mpctx->terminal_osd_text[0]) {
+ mpctx->terminal_osd_text[0] = '\0';
printf("%s\n", opts->term_osd_esc);
}
}
@@ -1823,6 +1827,7 @@ void reinit_audio_chain(struct MPContext *mpctx)
}
mpctx->mixer.ao = ao;
mpctx->mixer.volstep = volstep;
+ mixer_reinit(&mpctx->mixer);
mpctx->syncing_audio = true;
return;
@@ -2672,8 +2677,11 @@ int reinit_video_chain(struct MPContext *mpctx)
{
struct MPOpts *opts = &mpctx->opts;
sh_video_t * const sh_video = mpctx->sh_video;
- if (!sh_video)
+ if (!sh_video){
+ uninit_player(mpctx, INITIALIZED_VO);
return 0;
+ }
+
double ar = -1.0;
//================== Init VIDEO (codec & libvo) ==========================
if (!opts->fixed_vo || !(mpctx->initialized_flags & INITIALIZED_VO)) {
@@ -3102,26 +3110,6 @@ static void pause_loop(struct MPContext *mpctx)
}
}
-
-// Find the right mute status and record position for new file position
-static void edl_seek_reset(MPContext *mpctx)
-{
- mpctx->edl_muted = 0;
- next_edl_record = edl_records;
-
- while (next_edl_record) {
- if (next_edl_record->start_sec >= get_current_time(mpctx))
- break;
-
- if (next_edl_record->action == EDL_MUTE)
- mpctx->edl_muted = !mpctx->edl_muted;
- next_edl_record = next_edl_record->next;
- }
- if ((mpctx->user_muted | mpctx->edl_muted) != mpctx->mixer.muted)
- mixer_mute(&mpctx->mixer);
-}
-
-
// Execute EDL command for the current position if one exists
static void edl_update(MPContext *mpctx)
{
@@ -3145,10 +3133,7 @@ static void edl_update(MPContext *mpctx)
"[%f], length [%f]\n", next_edl_record->start_sec,
next_edl_record->stop_sec, next_edl_record->length_sec);
} else if (next_edl_record->action == EDL_MUTE) {
- mpctx->edl_muted = !mpctx->edl_muted;
- if ((mpctx->user_muted | mpctx->edl_muted) != mpctx->mixer.muted)
- mixer_mute(&mpctx->mixer);
- mp_msg(MSGT_CPLAYER, MSGL_DBG4, "EDL_MUTE: [%f]\n",
+ mp_msg(MSGT_CPLAYER, MSGL_DBG4, "EDL_MUTE: [%f] ignored\n",
next_edl_record->start_sec);
}
next_edl_record = next_edl_record->next;
@@ -3202,8 +3187,6 @@ static void seek_reset(struct MPContext *mpctx, bool reset_ao)
vobsub_seek(vo_vobsub, mpctx->sh_video->pts);
}
- edl_seek_reset(mpctx);
-
mpctx->hrseek_active = false;
mpctx->hrseek_framedrop = false;
mpctx->total_avsync_change = 0;
@@ -3984,6 +3967,7 @@ int main(int argc, char *argv[])
.file_format = DEMUXER_TYPE_UNKNOWN,
.last_dvb_step = 1,
.paused_cache_fill = -1,
+ .terminal_osd_text = talloc_strdup(mpctx, ""),
};
InitTimer();
@@ -4641,6 +4625,9 @@ goto_enable_cache:
if (mpctx->demuxer->type == DEMUXER_TYPE_EDL)
build_edl_timeline(mpctx);
+ if (mpctx->demuxer->type == DEMUXER_TYPE_CUE)
+ build_cue_timeline(mpctx);
+
if (mpctx->timeline) {
mpctx->timeline_part = 0;
mpctx->demuxer = mpctx->timeline[0].source->demuxer;
@@ -5015,6 +5002,9 @@ goto_enable_cache:
vo_control(mpctx->video_out,
mpctx->paused ? VOCTRL_PAUSE : VOCTRL_RESUME, NULL);
+ if (mpctx->opts.start_paused)
+ add_step_frame(mpctx);
+
while (!mpctx->stop_play)
run_playloop(mpctx);