diff --git a/Makefile b/Makefile index ba184bc..b3ebd8d 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CC=i586-mingw32msvc-gcc CFLAGS=-O3 -Iinc/ -Wall -DLE_ARCH LDFLAGS=-lpng -lz -lvfw32 -Llib/ -liberty -OBJS=avs2bdnxml.o auto_split.o palletize.o sup.o sort.o +OBJS=avs2bdnxml.o auto_split.o palletize.o sup.o sort.o ass.o ASMOBJS=frame-a.o EXE=avs2bdnxml.exe diff --git a/ass.c b/ass.c new file mode 100644 index 0000000..7bf00f9 --- /dev/null +++ b/ass.c @@ -0,0 +1,64 @@ +/*---------------------------------------------------------------------------- + * avs2bdnxml - Generates BluRay subtitle stuff from RGBA AviSynth scripts + * Copyright (C) 2008-2013 Arne Bochem + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *----------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include "ass.h" +#include "abstract_lists.h" + +#ifndef DEBUG +#define DEBUG 0 +#endif + +void parse_ass(char *filename) +{ + char l[BUFSIZ]; + char p[128]; + int start[4], end[4]; + FILE *fh; + + if ((fh = fopen(filename, "r")) == NULL) + { + perror("Error opening input ASS file"); + exit(1); + } + + int i = 0; + while (fgets(l, BUFSIZ - 1, fh) != NULL) { + i++; + if (l[0] == 0 || l[0] == '\n' || l[0] == '\r') + continue; + size_t x = sscanf(l, "Dialogue: %*d,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%s[127]", &start[0], &start[1], &start[2], &start[3], &end[0], &end[1], &end[2], &end[3], p); + if (x == 9) { + char *subchar_start = strstr(p, ","); + if (subchar_start == NULL) { + printf("Error while parsing ASS in line %d - no ',' found after end timestamp.", i); + exit(1); + } + subchar_start++; + if (subchar_start[0] == '!') { + printf("%d forced!\n", i); + } + } + } + + fclose(fh); +} diff --git a/ass.h b/ass.h new file mode 100644 index 0000000..b446014 --- /dev/null +++ b/ass.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------- + * avs2bdnxml - Generates BluRay subtitle stuff from RGBA AviSynth scripts + * Copyright (C) 2008-2010 Arne Bochem + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *----------------------------------------------------------------------------*/ + +#ifndef SUP_H +#define SUP_H + +#include "abstract_lists.h" + +typedef struct ass_sub_info_s +{ + int start; + int end; + int forced; +} ass_sub_info_t; + + +DECLARE_LIST(asi, ass_sub_info_t) + +typedef struct ass_reader_s +{ + FILE *fh; + asi_list_t *asil; +} ass_reader_t; + + +void parse_ass(char *filename); + +#endif +