added the asa subtitle demux from equinox. the file asademux_defs.h is

generated by running ./preparse imports in asa/lib/import so should
probably not be in source tree, but I don't think asa
generates/installs this file by default yet.

Added build changes for csri module and subtitle_asa.

This is the last remaining changes of equinoxes Summer of Code project
parent 7371aa24
...@@ -3818,6 +3818,40 @@ AS_IF( [test "${enable_telx}" = "yes"],[ ...@@ -3818,6 +3818,40 @@ AS_IF( [test "${enable_telx}" = "yes"],[
VLC_ADD_PLUGINS([telx]) VLC_ADD_PLUGINS([telx])
]) ])
dnl
dnl asa/csri subtitle rendering module
dnl
AC_ARG_ENABLE(csri,
[ --enable-csri Subtitle support using CSRI / asa (default disabled)])
AS_IF( [test "${enable_csri}" != "no"], [
PKG_CHECK_MODULES(CSRI,
csri >= 0.1.0,
[
VLC_ADD_LDFLAGS([csri],[$CSRI_LIBS])
VLC_ADD_CFLAGS([csri],[$CSRI_CFLAGS])
VLC_ADD_PLUGINS([csri])
],[
AC_MSG_WARN([CSRI helper library not found])
])
])
dnl
dnl asa demuxer
dnl
AC_ARG_ENABLE(asademux,
[ --enable-asademux asa subtitle demuxing (default disabled)])
AS_IF( [test "${enable_asa}" != "no"], [
PKG_CHECK_MODULES(PCRE,
libpcre >= 6.5,
[
VLC_ADD_LDFLAGS([asademux],[$PCRE_LIBS])
VLC_ADD_CFLAGS([asademux],[$PCRE_CFLAGS])
VLC_ADD_PLUGINS([asademux])
],[
AC_MSG_WARN([PCRE library not found (required for asademux)])
])
])
dnl dnl
dnl CMML plugin dnl CMML plugin
dnl dnl
......
...@@ -18,6 +18,7 @@ SOURCES_pva = pva.c ...@@ -18,6 +18,7 @@ SOURCES_pva = pva.c
SOURCES_aiff = aiff.c SOURCES_aiff = aiff.c
SOURCES_mjpeg = mjpeg.c SOURCES_mjpeg = mjpeg.c
SOURCES_subtitle = subtitle.c SOURCES_subtitle = subtitle.c
SOURCES_asademux = subtitle_asa.c asademux.c
SOURCES_ty = ty.c ../codec/cc.h SOURCES_ty = ty.c ../codec/cc.h
SOURCES_vobsub = vobsub.c SOURCES_vobsub = vobsub.c
SOURCES_voc = voc.c SOURCES_voc = voc.c
......
This diff is collapsed.
/*****************************************************************************
* asademux.c: asa demuxer VM
*****************************************************************************
* Copyright (C) 2007 the VideoLAN team
*
* Originated from asa: portable digital subtitle renderer
*
* Authors: David Lamparter <equinox at diac24 dot net>
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
****************************************************************************/
/****************************************************************************
* Changes from asa version:
* - headers adapted
* - external definition file support dropped
* - integer timestamps
****************************************************************************
* Please retain Linux kernel CodingStyle for sync.
* base commit d8c269b0fae9a8f8904e16e92313da165d664c74
****************************************************************************/
#ifndef _ASADEMUX_H
#define _ASADEMUX_H
#include <pcre.h>
/** parser reuse. imports-to-C uses char *, real VM uses pcre * */
typedef union {
pcre *pcre;
char *str;
} asa_pcre;
/** pcre_compile wrapper.
* used to allow loading differently for imports-to-C conversion.
* @param out output (parsed pcre)
* @param str regular expression string
* @return 0 on success, any other on error
*/
extern int asa_pcre_compile(asa_pcre *out, const char *str);
/** import instruction code */
enum asa_import_insn_type {
ASAI_COMMIT = 0, /**< put current buffer as line */
ASAI_DISCARD, /**< discard current buffer */
ASAI_BREAK, /**< leave child group */
ASAI_SELECT, /**< select source matchgroup */
ASAI_SG, /**< execute search & replace on selected */
ASAI_SGU, /**< like ASAI_SG, but update matchgroups */
ASAI_APPEND, /**< append selected source to buffer */
ASAI_FPS, /**< set fixed fps */
ASAI_SHOW, /**< set start time */
ASAI_HIDE, /**< set end time */
ASAI_CHILD /**< child regex match */
};
/** replacement element for ASAI_SG / ASAI_SGU */
struct asa_repl {
struct asa_repl *next; /**< next element */
int group; /**< -1 if fixed string, else source group */
char *text; /**< fixed string for group == -1 */
};
/** time specification element */
struct asa_tspec {
struct asa_tspec *next; /**< next element */
int group; /**< source matchgroup */
double mult, /**< ts multiplier. 1.0 = 1 second */
fps_mult; /**< fps multiplier. probably 0.0 or 1.0 */
};
/** single import instruction */
struct asa_import_insn {
struct asa_import_insn
*parent, /**< owner insn, NULL if format child */
*next; /**< next instruction */
enum asa_import_insn_type insn; /**< instruction code */
/** instruction parameters */
union {
int break_depth; /**< depth to break out */
int select; /**< matchgroup to select */
/** search-replace parameters */
struct {
asa_pcre regex; /**< search for */
struct asa_repl *repl; /**< replace by */
} sg;
/** time specification */
struct {
struct asa_tspec *tsp; /**< sources to sum up */
int delta_select; /**< -1 or delta index */
} tspec;
/** child instructions */
struct {
asa_pcre regex; /** <if this matches... */
struct asa_import_insn *insns; /**< do this. */
} child;
double fps_value; /**< fixed fps value */
} v;
};
/** destination format of import rules */
enum asa_import_target {
ASAI_TARGET_TEXT = (1 << 0), /**< plain text packets */
ASAI_TARGET_SSA = (1 << 1) /**< MKV ASS packets */
};
/** importing instructions for format */
struct asa_import_format {
struct asa_import_format *next, /**< next format */
*prevtgt, /**< previous target */
*nexttgt; /**< next target of this*/
char *name; /**< format name */
enum asa_import_target target; /**< target */
struct asa_import_insn *insns; /**< instructions */
};
/** format detection rules */
struct asa_import_detect {
struct asa_import_detect *next; /**< next rule */
asa_pcre re; /**< if this matches... */
char *name; /**< use this format */
struct asa_import_format *fmt; /**< through this pointer */
};
extern struct asa_import_detect *asa_det_first, **asa_det_last;
extern struct asa_import_format *asa_fmt_first, **asa_fmt_last;
typedef int (asa_import_callback)(demux_t *demux, void *arg,
int64_t start, int64_t stop,
const char *buffer, size_t buffer_length);
extern struct asa_import_detect *asa_imports_detect(const void *data,
size_t dlen);
extern int asa_import(demux_t *d, const void *data, size_t dlen,
int64_t usecperframe, struct asa_import_detect *det,
asa_import_callback *callback, void *arg);
extern void asa_init_import(void);
#endif
/* AUTOGENERATED FILE, DO NOT EDIT */
/* generated from "./imports" on 2007-08-31T13:23:59+00:00 */
void preparse_add()
{
#define insn_init { NULL, NULL, 0, { 0 } }
#define det(n,r) { static struct asa_import_detect d = { NULL }; \
d.name = n; \
if (!asa_pcre_compile(&d.re, r)) \
asa_det_last = &(*asa_det_last = &d)->next; }
#define fmt_b(n,t) { static struct asa_import_format f = { NULL }; \
struct asa_import_insn *i, **i0 = NULL; \
f.name = n; f.target = t;
#define fmt_e() \
}
#define insn(n,t) { static struct asa_import_insn ii = insn_init; \
i = &ii; *n = i; n = &i->next; i->insn = t; }
#define insn_b(n, m, t, r) { struct asa_import_insn **m;\
{ static struct asa_import_insn ii = insn_init; \
i = &ii; ii.insn = t; \
m = &ii.v.child.insns; \
}\
if (!asa_pcre_compile(&i->v.child.regex, r)) { \
*n = i; n = &i->next;
#define insn_e() } }
#define insn_sg(n, t, r) { struct asa_repl **repl;\
{ static struct asa_import_insn ii = insn_init; \
i = &ii; ii.insn = t; \
repl = &ii.v.sg.repl; \
}\
if (!asa_pcre_compile(&i->v.sg.regex, r)) { \
*n = i; n = &i->next;
#define insn_sge() } }
#define repl(g, t) { static struct asa_repl r = { NULL, g, t }; \
*repl = &r; repl = &r.next; }
#define insn_ts(n, t, d) { struct asa_tspec **tsp;\
{ static struct asa_import_insn ii = insn_init; \
i = &ii; ii.insn = t; ii.v.tspec.delta_select = d; \
tsp = &ii.v.tspec.tsp; \
}\
*n = i; n = &i->next;
#define insn_tse() }
#define tsp(g, m, f) { static struct asa_tspec t = { NULL, g, m, f }; \
*tsp = &t; tsp = &t.next; }
det("qttext","^\\{QTtext\\}")
det("rtf","^\\{\\\\rtf")
det("viplay","^\\{\\* VIPLAY")
det("zerog","^% Zero G")
det("sst","^SST ")
det("philips","^# PHILIPS SVCD DESIGNER")
det("ulead","^#Ulead subtitle")
det("sonicscenarist","^st_format\\s*\\d")
det("dvdjunior","^Subtitle File Mark")
det("captionsdat","^\\0\\r#")
det("inscriber","^@@.*\\n@@\\d Created by URUSoft")
det("ssa","(?mi)^(ScriptType:|\\[Script Info)")
det("subrip","^\\d+\\s*\\n\\d\\d:\\d\\d:\\d\\d,\\d\\d\\d\\s+-->\\s+\\d\\d:\\d\\d:\\d\\d,\\d\\d\\d\\s*\\n")
det("microdvd","^\\{\\d+\\}\\{\\d+\\}")
det("sami","(?i)<SAMI")
det("smil","(?i)<SMIL")
det("smil_rt","(?i)<WINDOW")
det("html","(?i)<HTML")
det("jacosub","(?m)^#([DT]\\d+)")
det("sasamis2k","(?m)^;(Env|Set)\\.")
det("phoenix","^[ \\d]+,[ \\d]+, \".*\"")
det("vkt","(?m)^\\{\\d+ .*\\}")
det("e2","^\\[\\d+\\]\\[\\d+\\]")
det("powerdivx","^\\{\\d+:\\d\\d:\\d\\d\\}\\{\\d+:\\d\\d:\\d\\d\\}")
det("sbt","^\\d\\d:\\d\\d:\\d\\d\\s*\\n\\d\\d:\\d\\d:\\d\\d\\s*\\n\\s*\\n")
det("karaokelrc","(?m)^\\[\\d\\d:\\d\\d\\.\\d\\d\\]")
det("dks","^\\[\\d\\d:\\d\\d:\\d\\d\\]")
det("aqtitle","^-->> \\d+\\s*\\n")
det("panimator","^\\/(c|d \\d+ \\d+)\\s*\\n")
det("tmplayer","^\\d\\d:\\d\\d:\\d\\d,\\d=")
det("cap32","^\\d\\d:\\d\\d:\\d\\d:\\d\\d , \\d\\d:\\d\\d:\\d\\d:\\d\\d , ")
det("not_encore","(?m)^\\d\\d:\\d\\d:\\d\\d:\\d\\d \\d\\d:\\d\\d:\\d\\d:\\d\\d ")
det("encore_ntsc","(?m)^\\d+ \\d+;\\d+;\\d+;\\d+ \\d+;\\d+;\\d+;\\d+ ")
det("encore_pal","(?m)^\\d+ \\d+:\\d+:\\d+:\\d+ \\d+:\\d+:\\d+:\\d+ ")
det("turbotitler","^\\d+:\\d\\d:\\d\\d\\.\\d\\d,\\d+:\\d\\d:\\d\\d\\.\\d\\d,")
det("macdvdpro","^\\d\\d:\\d\\d:\\d\\d:\\d\\d\\t\\d\\d:\\d\\d:\\d\\d:\\d\\d\\t")
det("powerpixel","^\\d\\d:\\d\\d:\\d\\d:\\d\\d\\t\\d\\d:\\d\\d:\\d\\d:\\d\\d\\r?\\n")
det("ovr","^\\d\\d:\\d\\d:\\d\\d:\\d\\d [^[:digit:][:space:][:punct:]]")
det("fab","^\\d\\d:\\d\\d:\\d\\d:\\d\\d \\d\\d:\\d\\d:\\d\\d:\\d\\d\\s*\\n[^[:digit:][:space:][:punct:]]")
det("sonicdvd","^\\d{4} \\d\\d:\\d\\d:\\d\\d:\\d\\d \\d\\d:\\d\\d:\\d\\d:\\d\\d ")
det("koalaplayer","(?m)^\\d+:\\d\\d:\\d\\d:[^[:digit:][:space:][:punct:]]")
det("subcreator1","^\\d+:\\d\\d:\\d\\d\\.\\d+:")
fmt_b("subrip", 2)
insn_b(i0, i1, ASAI_CHILD, "^\\d+\\s*\\n(\\d\\d):(\\d\\d):(\\d\\d),(\\d\\d\\d)\\s+-->\\s+(\\d\\d):(\\d\\d):(\\d\\d),(\\d\\d\\d)\\s*\\r?\\n")
insn_ts(i1, 8, -1); tsp(1, 3600.000000, 0.000000)
tsp(2, 60.000000, 0.000000)
tsp(3, 1.000000, 0.000000)
tsp(4, 0.001000, 0.000000)
insn_tse()
insn_ts(i1, 9, -1); tsp(5, 3600.000000, 0.000000)
tsp(6, 60.000000, 0.000000)
tsp(7, 1.000000, 0.000000)
tsp(8, 0.001000, 0.000000)
insn_tse()
insn_b(i1, i2, ASAI_CHILD, "(?s)^(.*?)\\s*\\n\\s*\\n")
insn(i2, ASAI_SELECT); i->v.select = 1;
insn_sg(i2, 4, "\\\\")
repl(-1, "\\\\")
insn_sge()
insn_sg(i2, 4, "\\{")
repl(-1, "\\{")
insn_sge()
insn_sg(i2, 4, "\\}")
repl(-1, "\\}")
insn_sge()
insn_sg(i2, 4, "\\n")
repl(-1, "\\n")
insn_sge()
insn_sg(i2, 4, "<[Bb]>")
repl(-1, "{\\b1}")
insn_sge()
insn_sg(i2, 4, "<\\/[Bb]>")
repl(-1, "{\\b0}")
insn_sge()
insn_sg(i2, 4, "<[Ii]>")
repl(-1, "{\\i1}")
insn_sge()
insn_sg(i2, 4, "<\\/[Ii]>")
repl(-1, "{\\i0}")
insn_sge()
insn_sg(i2, 4, "<\\/(.*?)>")
repl(-1, "{")
repl(12, NULL)
repl(-1, "3}")
insn_sge()
insn_sg(i2, 4, "&lt;")
repl(-1, "<")
insn_sge()
insn_sg(i2, 4, "&gt;")
repl(-1, ">")
insn_sge()
insn_sg(i2, 4, "&amp;")
repl(-1, "&")
insn_sge()
insn_sg(i2, 4, "^")
repl(-1, ",,,0,0,0,,")
insn_sge()
insn(i2, 6);
insn(i2, 0);
insn(i2, ASAI_BREAK); i->v.break_depth = 1;
insn_e()
insn_e()
fmt_e()
fmt_b("encore_pal", 1)
insn(i0, ASAI_FPS); i->v.fps_value = 25.000000;
insn_b(i0, i1, ASAI_CHILD, "^\\d+ (\\d+):(\\d+):(\\d+):(\\d+) (\\d+):(\\d+):(\\d+):(\\d+) (.*(\\n[^\\d].*)*)\\n")
insn_ts(i1, 8, -1); tsp(1, 3600.000000, 0.000000)
tsp(2, 60.000000, 0.000000)
tsp(3, 1.000000, 0.000000)
tsp(4, 0.000000, 1.000000)
insn_tse()
insn_ts(i1, 9, -1); tsp(5, 3600.000000, 0.000000)
tsp(6, 60.000000, 0.000000)
tsp(7, 1.000000, 0.000000)
tsp(8, 0.000000, 1.000000)
insn_tse()
insn(i1, ASAI_SELECT); i->v.select = 9;
insn_sg(i1, 4, "\\/\\/")
repl(-1, "\x0a")
insn_sge()
insn(i1, 6);
insn(i1, 0);
insn_e()
fmt_e()
fmt_b("encore_ntsc", 1)
insn(i0, ASAI_FPS); i->v.fps_value = 29.969999;
insn_b(i0, i1, ASAI_CHILD, "^\\d+ (\\d+);(\\d+);(\\d+);(\\d+) (\\d+);(\\d+);(\\d+);(\\d+) (.*(\\n[^\\d].*)*)\\n")
insn_ts(i1, 8, -1); tsp(1, 3600.000000, 0.000000)
tsp(2, 60.000000, 0.000000)
tsp(3, 1.000000, 0.000000)
tsp(4, 0.000000, 1.000000)
insn_tse()
insn_ts(i1, 9, -1); tsp(5, 3600.000000, 0.000000)
tsp(6, 60.000000, 0.000000)
tsp(7, 1.000000, 0.000000)
tsp(8, 0.000000, 1.000000)
insn_tse()
insn(i1, ASAI_SELECT); i->v.select = 9;
insn_sg(i1, 4, "\\/\\/")
repl(-1, "\x0a")
insn_sge()
insn(i1, 6);
insn(i1, 0);
insn_e()
fmt_e()
fmt_b("microdvd", 1)
insn_b(i0, i1, ASAI_CHILD, "^\\{\\s*(\\d+)\\}\\{\\s*(\\d+)\\}(.*?)\\s*\\n")
insn_ts(i1, 8, -1); tsp(1, 0.000000, 1.000000)
insn_tse()
insn_ts(i1, 9, -1); tsp(2, 0.000000, 1.000000)
insn_tse()
insn(i1, ASAI_SELECT); i->v.select = 3;
insn_sg(i1, 4, "\\|")
repl(-1, "\x0a")
insn_sge()
insn(i1, 6);
insn(i1, 0);
insn_e()
fmt_e()
fmt_b("vkt", 1)
insn_b(i0, i1, ASAI_CHILD, "^#.*\\n")
insn_e()
insn_b(i0, i1, ASAI_CHILD, "^{(\\d+) (.*)}\\s*\\n")
insn_ts(i1, 9, -1); tsp(1, 0.000000, 1.000000)
insn_tse()
insn(i1, 0);
insn_ts(i1, 8, -1); tsp(1, 0.000000, 1.000000)
insn_tse()
insn(i1, ASAI_SELECT); i->v.select = 2;
insn(i1, 6);
insn_e()
fmt_e()
}
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment