[MPlayer-cvslog] r23559 - trunk/libass/ass.c

eugeni subversion at mplayerhq.hu
Sat Jun 16 00:15:28 CEST 2007


Author: eugeni
Date: Sat Jun 16 00:15:27 2007
New Revision: 23559

Log:
Make sure there is at least one style in ass_track when parsing events.
Before it was only checked for embedded subtitles.


Modified:
   trunk/libass/ass.c

Modified: trunk/libass/ass.c
==============================================================================
--- trunk/libass/ass.c	(original)
+++ trunk/libass/ass.c	Sat Jun 16 00:15:27 2007
@@ -271,6 +271,14 @@ static int process_event_tail(ass_track_
 	char* format = strdup(track->event_format);
 	char* q = format; // format scanning pointer
 
+	if (track->n_styles == 0) {
+		// add "Default" style to the end
+		// will be used if track does not contain a default style (or even does not contain styles at all)
+		int sid = ass_alloc_style(track);
+		track->styles[sid].Name = strdup("Default");
+		track->styles[sid].FontName = strdup("Arial");
+	}
+
 	for (i = 0; i < n_ignored; ++i) {
 		NEXT(q, tname);
 	}
@@ -697,7 +705,6 @@ static int process_text(ass_track_t* tra
 void ass_process_codec_private(ass_track_t* track, char *data, int size)
 {
 	char* str = malloc(size + 1);
-	int sid;
 
 	memcpy(str, data, size);
 	str[size] = '\0';
@@ -705,12 +712,6 @@ void ass_process_codec_private(ass_track
 	process_text(track, str);
 	free(str);
 
-	// add "Default" style to the end
-	// will be used if track does not contain a default style (or even does not contain styles at all)
-	sid = ass_alloc_style(track);
-	track->styles[sid].Name = strdup("Default");
-	track->styles[sid].FontName = strdup("Arial");
-	
 	if (!track->event_format) {
 		// probably an mkv produced by ancient mkvtoolnix
 		// such files don't have [Events] and Format: headers



More information about the MPlayer-cvslog mailing list