changeset 34494:fede902a408c

Fix per-file ASS options like -ass-force-style. Previously the per-file settings were (sometimes at least) completely ignored and only the global ones used.
author reimar
date Thu, 19 Jan 2012 23:20:37 +0000
parents da31318562d9
children a5f7e1b5b0ce
files mencoder.c mplayer.c sub/ass_mp.c sub/ass_mp.h
diffstat 4 files changed, 27 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mencoder.c	Thu Jan 19 14:36:17 2012 +0000
+++ b/mencoder.c	Thu Jan 19 23:20:37 2012 +0000
@@ -638,6 +638,16 @@
 	mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_MissingFilename);
 	mencoder_exit(1,NULL);
   }
+
+  if (vobsub_name)
+    vo_vobsub = vobsub_open(vobsub_name, spudec_ifo, 1, &vo_spudec);
+#ifdef CONFIG_ASS
+  // must be before demuxer open, since the settings are
+  // used in generating the ASSTrack
+  if (ass_enabled && ass_library)
+    ass_mp_reset_config(ass_library);
+#endif
+
   stream=open_stream(filename,0,&file_format);
 
   if(!stream){
@@ -769,9 +779,6 @@
     }
   }
 
-  if (vobsub_name)
-    vo_vobsub = vobsub_open(vobsub_name, spudec_ifo, 1, &vo_spudec);
-
 // set up video encoder:
 
 if (!curfile) { // curfile is non zero when a second file is opened
--- a/mplayer.c	Thu Jan 19 14:36:17 2012 +0000
+++ b/mplayer.c	Thu Jan 19 23:20:37 2012 +0000
@@ -3165,6 +3165,12 @@
         // setup global sub numbering
         mpctx->sub_counts[SUB_SOURCE_VOBSUB] = vobsub_get_indexes_count(vo_vobsub);
     }
+#ifdef CONFIG_ASS
+    // must be before demuxer open, since the settings are
+    // used in generating the ASSTrack
+    if (ass_enabled && ass_library)
+        ass_mp_reset_config(ass_library);
+#endif
 
 //============ Open & Sync STREAM --- fork cache2 ====================
 
--- a/sub/ass_mp.c	Thu Jan 19 14:36:17 2012 +0000
+++ b/sub/ass_mp.c	Thu Jan 19 23:20:37 2012 +0000
@@ -303,14 +303,22 @@
 	}
 }
 
+/**
+ * Reset all per-file settings for next file.
+ */
+void ass_mp_reset_config(ASS_Library *l) {
+	ass_set_extract_fonts(l, extract_embedded_fonts);
+	ass_set_style_overrides(l, ass_force_style_list);
+	ass_force_reload = 1;
+}
+
 ASS_Library* ass_init(void) {
 	ASS_Library* priv;
 	char* path = get_path("fonts");
 	priv = ass_library_init();
 	ass_set_message_cb(priv, message_callback, NULL);
 	ass_set_fonts_dir(priv, path);
-	ass_set_extract_fonts(priv, extract_embedded_fonts);
-	ass_set_style_overrides(priv, ass_force_style_list);
+	ass_mp_reset_config(priv);
 	free(path);
 	return priv;
 }
--- a/sub/ass_mp.h	Thu Jan 19 14:36:17 2012 +0000
+++ b/sub/ass_mp.h	Thu Jan 19 23:20:37 2012 +0000
@@ -52,6 +52,7 @@
 
 void ass_configure(ASS_Renderer* priv, int w, int h, int hinting);
 void ass_configure_fonts(ASS_Renderer* priv);
+void ass_mp_reset_config(ASS_Library *l);
 ASS_Library* ass_init(void);
 
 typedef struct {