[Mplayer-cvslog] CVS: main subreader.c,1.121,1.122 subreader.h,1.28,1.29
Jindrich Makovicka CVS
henry at mplayerhq.hu
Sun Sep 21 15:20:38 CEST 2003
Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv6760
Modified Files:
subreader.c subreader.h
Log Message:
Subtitle alignment & smart splitting by Salvatore Falco
Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -r1.121 -r1.122
--- subreader.c 2 Sep 2003 17:26:33 -0000 1.121
+++ subreader.c 21 Sep 2003 13:20:00 -0000 1.122
@@ -811,11 +811,17 @@
|| (strstr(directive, "RLG") != NULL)) {
continue;
}
+ if (strstr(directive, "JL") != NULL) {
+ current->alignment = SUB_ALIGNMENT_HLEFT;
+ } else if (strstr(directive, "JR") != NULL) {
+ current->alignment = SUB_ALIGNMENT_HRIGHT;
+ } else {
+ current->alignment = SUB_ALIGNMENT_HCENTER;
+ }
strcpy(line2, line1);
p = line2;
}
- for (q = line1; (!eol(*p)) && (current->lines + 1 < SUB_MAX_TEXT);
- ++p) {
+ for (q = line1; (!eol(*p)) && (current->lines < SUB_MAX_TEXT); ++p) {
switch (*p) {
case '{':
comment++;
@@ -1266,6 +1272,7 @@
first[sub_num].start = sub->start;
first[sub_num].end = sub->end;
first[sub_num].lines = sub->lines;
+ first[sub_num].alignment = sub->alignment;
for(i = 0; i < sub->lines; ++i){
first[sub_num].text[i] = sub->text[i];
}
@@ -1278,6 +1285,7 @@
first[j + 1].start = first[j].start;
first[j + 1].end = first[j].end;
first[j + 1].lines = first[j].lines;
+ first[j + 1].alignment = first[j].alignment;
for(i = 0; i < first[j].lines; ++i){
first[j + 1].text[i] = first[j].text[i];
}
@@ -1285,6 +1293,7 @@
first[j].start = sub->start;
first[j].end = sub->end;
first[j].lines = sub->lines;
+ first[j].alignment = sub->alignment;
for(i = 0; i < SUB_MAX_TEXT; ++i){
first[j].text[i] = sub->text[i];
}
@@ -1471,6 +1480,7 @@
second[sub_num + j].start = first[sub_first + j].start;
second[sub_num + j].end = first[sub_first + j].end;
second[sub_num + j].lines = first[sub_first + j].lines;
+ second[sub_num + j].alignment = first[sub_first + j].alignment;
for (ls = 0; ls < second[sub_num + j].lines; ls++) {
second[sub_num + j].text[ls] = strdup(first[sub_first + j].text[ls]);
}
@@ -1487,6 +1497,7 @@
memset(&second[sub_num], '\0', sizeof(subtitle));
second[sub_num].start = local_start;
second[sub_num].end = local_end;
+ second[sub_num].alignment = SUB_ALIGNMENT_HCENTER;
n_max = (lines_to_add < SUB_MAX_TEXT) ? lines_to_add : SUB_MAX_TEXT;
for (i = 0, j = 0; j < n_max; ++j) {
if (placeholder[counter][j] != -1) {
Index: subreader.h
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- subreader.h 9 Apr 2003 18:04:04 -0000 1.28
+++ subreader.h 21 Sep 2003 13:20:00 -0000 1.29
@@ -27,6 +27,9 @@
#define MAX_SUBTITLE_FILES 128
#define SUB_MAX_TEXT 10
+#define SUB_ALIGNMENT_HLEFT 1
+#define SUB_ALIGNMENT_HCENTER 0
+#define SUB_ALIGNMENT_HRIGHT 2
typedef struct {
@@ -36,6 +39,7 @@
unsigned long end;
char *text[SUB_MAX_TEXT];
+ unsigned char alignment;
} subtitle;
typedef struct {
More information about the MPlayer-cvslog
mailing list