comparison subreader.c @ 8363:ae74be3e2ed0

dump subtitles in SAMI format patch by Salvatore Falco <sfalco@studenti.ing.uniroma1.it>
author arpi
date Thu, 05 Dec 2002 00:07:59 +0000
parents b5478134c853
children 36d5c7137876
comparison
equal deleted inserted replaced
8362:b5478134c853 8363:ae74be3e2ed0
1510 } 1510 }
1511 fclose(fd); 1511 fclose(fd);
1512 mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Subtitles dumped in \'dumpsub.js\'.\n"); 1512 mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Subtitles dumped in \'dumpsub.js\'.\n");
1513 } 1513 }
1514 1514
1515 void dump_sami(subtitle* subs, float fps) {
1516 int i,j;
1517 FILE * fd;
1518 subtitle * onesub;
1519 unsigned long temp;
1520
1521 if (!sub_uses_time && sub_fps == 0)
1522 sub_fps = fps;
1523 fd=fopen("dumpsub.smi","w");
1524 if(!fd)
1525 {
1526 perror("dump_jacosub: fopen");
1527 return;
1528 }
1529 fprintf(fd, "<SAMI>\n"
1530 "<HEAD>\n"
1531 " <STYLE TYPE=\"Text/css\">\n"
1532 " <!--\n"
1533 " P {margin-left: 29pt; margin-right: 29pt; font-size: 24pt; text-align: center; font-family: Tahoma; font-weight: bold; color: #FCDD03; background-color: #000000;}\n"
1534 " .SUBTTL {Name: 'Subtitles'; Lang: en-US; SAMIType: CC;}\n"
1535 " -->\n"
1536 " </STYLE>\n"
1537 "</HEAD>\n"
1538 "<BODY>\n");
1539 for(i=0;i<sub_num;i++)
1540 {
1541 onesub=subs+i; //=&subs[i];
1542
1543 temp=onesub->start;
1544 if (!sub_uses_time)
1545 temp = temp * 100 / sub_fps;
1546 temp -= sub_delay * 100;
1547 fprintf(fd,"\t<SYNC Start=%lu>\n"
1548 "\t <P>", temp * 10);
1549
1550 for(j=0;j<onesub->lines;j++)
1551 fprintf(fd,"%s%s",j ? "<br>" : "", onesub->text[j]);
1552
1553 fprintf(fd,"\n");
1554
1555 temp=onesub->end;
1556 if (!sub_uses_time)
1557 temp = temp * 100 / sub_fps;
1558 temp -= sub_delay * 100;
1559 fprintf(fd,"\t<SYNC Start=%lu>\n"
1560 "\t <P>&nbsp;\n", temp * 10);
1561 }
1562 fprintf(fd, "</BODY>\n"
1563 "</SAMI>\n");
1564 fclose(fd);
1565 mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Subtitles dumped in \'dumpsub.smi\'.\n");
1566 }
1567
1515 void sub_free( subtitle * subs ) 1568 void sub_free( subtitle * subs )
1516 { 1569 {
1517 int i; 1570 int i;
1518 1571
1519 if ( !subs ) return; 1572 if ( !subs ) return;