mpsub, FORMAT=<frame> alpha version

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2496 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
laaz 2001-10-26 22:14:19 +00:00
parent 3cdacd4e38
commit c207d215f6
1 changed files with 25 additions and 21 deletions

View File

@ -404,6 +404,7 @@ subtitle *sub_read_line_mpsub(FILE *fd, subtitle *current) {
*q='\0'; *q='\0';
if (strlen(p)) { if (strlen(p)) {
current->text[num]=strdup(p); current->text[num]=strdup(p);
printf (">%s<\n",p);
current->lines = ++num; current->lines = ++num;
} else { } else {
if (num) return current; if (num) return current;
@ -481,8 +482,6 @@ int sub_autodetect (FILE *fd) {
if ( *line == '<' ) if ( *line == '<' )
{sub_uses_time=1;return 5;} {sub_uses_time=1;return 5;}
// I have only seen only 1 piece of .ssa file.
// It may be not correct (tell me if it's not)
if (!memcmp(line, "Dialogue: Marked", 16)) if (!memcmp(line, "Dialogue: Marked", 16))
{sub_uses_time=1; return 6;} {sub_uses_time=1; return 6;}
if (sscanf (line, "%d,%d,\"%c", &i, &i, (char *) &i) == 3) if (sscanf (line, "%d,%d,\"%c", &i, &i, (char *) &i) == 3)
@ -747,10 +746,11 @@ void dump_mpsub(subtitle* subs){
if (sub_uses_time) fprintf (fd,"FORMAT=TIME\n\n"); if (sub_uses_time) fprintf (fd,"FORMAT=TIME\n\n");
else fprintf (fd, "FORMAT=25"); // FIXME: fps else fprintf (fd, "FORMAT=25\n\n"); // FIXME: fps
for(j=0;j<sub_num;j++){ for(j=0;j<sub_num;j++){
subtitle* egysub=&subs[j]; subtitle* egysub=&subs[j];
if (sub_uses_time) {
a=((egysub->start-mpsub_position)/100.0); a=((egysub->start-mpsub_position)/100.0);
b=((egysub->end-egysub->start)/100.0); b=((egysub->end-egysub->start)/100.0);
if ( (float)((int)a) == a) if ( (float)((int)a) == a)
@ -762,6 +762,10 @@ void dump_mpsub(subtitle* subs){
fprintf (fd, " %.0f\n",b); fprintf (fd, " %.0f\n",b);
else else
fprintf (fd, " %.2f\n",b); fprintf (fd, " %.2f\n",b);
} else {
fprintf (fd, "%ld %ld\n", egysub->start-mpsub_position,
egysub->end-egysub->start);
}
mpsub_position = egysub->end; mpsub_position = egysub->end;
for (i=0; i<egysub->lines; i++) { for (i=0; i<egysub->lines; i++) {