summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2011-01-11 17:48:45 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2011-01-11 17:55:05 +0200
commita1692437d0a2cc88a2b3440bbcfb5e6f66cfd90e (patch)
treef3ce630d220edecfa5c476658a3bda2a65695ee8
parentf95674fb6cbd459e6b484caf94b490b7efede9d5 (diff)
downloadmpv-a1692437d0a2cc88a2b3440bbcfb5e6f66cfd90e.tar.bz2
mpv-a1692437d0a2cc88a2b3440bbcfb5e6f66cfd90e.tar.xz
core: move global "subdata" and "vo_sub_last" to mpctx
-rw-r--r--command.c17
-rw-r--r--libvo/sub.h1
-rw-r--r--mp_core.h3
-rw-r--r--mpcommon.c13
-rw-r--r--mpcommon.h1
-rw-r--r--mplayer.c18
6 files changed, 27 insertions, 26 deletions
diff --git a/command.c b/command.c
index 4408a584a6..238e62cd04 100644
--- a/command.c
+++ b/command.c
@@ -193,15 +193,16 @@ static void log_sub(struct MPContext *mpctx)
char *fname;
FILE *f;
int i;
+ struct subtitle *vo_sub_last = mpctx->vo_sub_last;
- if (subdata == NULL || vo_sub_last == NULL)
+ if (mpctx->subdata == NULL || vo_sub_last == NULL)
return;
fname = get_path("subtitle_log");
f = fopen(fname, "a");
if (!f)
return;
fprintf(f, "----------------------------------------------------------\n");
- if (subdata->sub_uses_time) {
+ if (mpctx->subdata->sub_uses_time) {
fprintf(f,
"N: %s S: %02ld:%02ld:%02ld.%02ld E: %02ld:%02ld:%02ld.%02ld\n",
mpctx->filename, vo_sub_last->start / 360000,
@@ -1542,8 +1543,8 @@ static int mp_property_sub(m_option_t *prop, int action, void *arg,
*(char **) arg = malloc(64);
(*(char **) arg)[63] = 0;
sub_name = 0;
- if (subdata)
- sub_name = subdata->filename;
+ if (mpctx->subdata)
+ sub_name = mpctx->subdata->filename;
#ifdef CONFIG_ASS
if (ass_track && ass_track->name)
sub_name = ass_track->name;
@@ -1644,7 +1645,7 @@ static int mp_property_sub(m_option_t *prop, int action, void *arg,
mpctx->global_sub_pos, source);
mpctx->set_of_sub_pos = -1;
- subdata = NULL;
+ mpctx->subdata = NULL;
vobsub_id = -1;
opts->sub_id = -1;
@@ -1667,7 +1668,7 @@ static int mp_property_sub(m_option_t *prop, int action, void *arg,
else
#endif
{
- subdata = mpctx->set_of_subtitles[mpctx->set_of_sub_pos];
+ mpctx->subdata = mpctx->set_of_subtitles[mpctx->set_of_sub_pos];
vo_osd_changed(OSDTYPE_SUBTITLE);
}
} else if (source == SUB_SOURCE_DEMUX) {
@@ -2692,7 +2693,7 @@ static void remove_subtitle_range(MPContext *mpctx, int start, int count)
if (mpctx->set_of_sub_pos >= start && mpctx->set_of_sub_pos < end) {
mpctx->global_sub_pos = -2;
- subdata = NULL;
+ mpctx->subdata = NULL;
#ifdef CONFIG_ASS
ass_track = NULL;
#endif
@@ -2931,7 +2932,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
case MP_CMD_SUB_STEP:
if (sh_video) {
int movement = cmd->args[0].v.i;
- step_sub(subdata, mpctx->video_pts, movement);
+ step_sub(mpctx->subdata, mpctx->video_pts, movement);
#ifdef CONFIG_ASS
if (ass_track)
sub_delay +=
diff --git a/libvo/sub.h b/libvo/sub.h
index d5a30e0b86..f3a6f072c2 100644
--- a/libvo/sub.h
+++ b/libvo/sub.h
@@ -73,7 +73,6 @@ struct osd_state {
#include "subreader.h"
-extern sub_data* subdata; //currently used subtitles
extern subtitle* vo_sub;
extern void* vo_osd_teletext_page;
diff --git a/mp_core.h b/mp_core.h
index 00b8fa91ef..f8b286e5b9 100644
--- a/mp_core.h
+++ b/mp_core.h
@@ -88,6 +88,9 @@ typedef struct MPContext {
struct mp_fifo *key_fifo;
struct input_ctx *input;
struct osd_state *osd;
+ struct sub_data *subdata; // current sub_data style subtitles if any
+ // last sub_data style sub line if any, used by log_sub() only
+ struct subtitle *vo_sub_last;
bool add_osd_seek_info;
// if nonzero, hide current OSD contents when GetTimerMS() reaches this
diff --git a/mpcommon.c b/mpcommon.c
index a7e89d9ee1..2af26314bb 100644
--- a/mpcommon.c
+++ b/mpcommon.c
@@ -39,15 +39,13 @@
#include "libmpcodecs/dec_teletext.h"
#include "ffmpeg_files/intreadwrite.h"
#include "m_option.h"
+#include "mp_core.h"
#ifdef CONFIG_ASS
#include "ass_mp.h"
ASS_Track *ass_track = 0; // current track to render
#endif
-sub_data* subdata = NULL;
-subtitle* vo_sub_last = NULL;
-
const char *mencoder_version = "MEncoder " VERSION;
const char *mplayer_version = "MPlayer " VERSION;
@@ -123,12 +121,13 @@ void update_subtitles(struct MPContext *mpctx, struct MPOpts *opts,
return;
}
// find sub
- if (subdata) {
+ if (mpctx->subdata) {
if (sub_fps==0) sub_fps = sh_video ? sh_video->fps : 25;
current_module = "find_sub";
- find_sub(mpctx, subdata, curpts *
- (subdata->sub_uses_time ? 100. : sub_fps));
- if (vo_sub) vo_sub_last = vo_sub;
+ find_sub(mpctx, mpctx->subdata, curpts *
+ (mpctx->subdata->sub_uses_time ? 100. : sub_fps));
+ if (vo_sub)
+ mpctx->vo_sub_last = vo_sub;
}
// DVD sub:
diff --git a/mpcommon.h b/mpcommon.h
index e0baee4f8d..5d114f38a5 100644
--- a/mpcommon.h
+++ b/mpcommon.h
@@ -24,7 +24,6 @@
struct subtitle;
extern struct ass_track *ass_track;
-extern struct subtitle *vo_sub_last;
extern const char *mencoder_version;
extern const char *mplayer_version;
diff --git a/mplayer.c b/mplayer.c
index 6565f75904..567114cfd3 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -4415,14 +4415,14 @@ if(vo_spudec==NULL &&
mpctx->sub_counts[SUB_SOURCE_SUBS] = mpctx->set_of_sub_size;
if (select_subtitle(mpctx)) {
- if(subdata)
+ if(mpctx->subdata)
switch (stream_dump_type) {
- case 3: list_sub_file(subdata); break;
- case 4: dump_mpsub(subdata, mpctx->sh_video->fps); break;
- case 6: dump_srt(subdata, mpctx->sh_video->fps); break;
- case 7: dump_microdvd(subdata, mpctx->sh_video->fps); break;
- case 8: dump_jacosub(subdata, mpctx->sh_video->fps); break;
- case 9: dump_sami(subdata, mpctx->sh_video->fps); break;
+ case 3: list_sub_file(mpctx->subdata); break;
+ case 4: dump_mpsub(mpctx->subdata, mpctx->sh_video->fps); break;
+ case 6: dump_srt(mpctx->subdata, mpctx->sh_video->fps); break;
+ case 7: dump_microdvd(mpctx->subdata, mpctx->sh_video->fps); break;
+ case 8: dump_jacosub(mpctx->subdata, mpctx->sh_video->fps); break;
+ case 9: dump_sami(mpctx->subdata, mpctx->sh_video->fps); break;
}
}
@@ -4645,8 +4645,8 @@ if(mpctx->set_of_sub_size > 0) {
}
mpctx->set_of_sub_size = 0;
}
-vo_sub_last = vo_sub=NULL;
-subdata=NULL;
+mpctx->vo_sub_last = vo_sub=NULL;
+mpctx->subdata=NULL;
#ifdef CONFIG_ASS
ass_track = NULL;
if(ass_library)