[MPlayer-dev-eng] [PATCH] support for new subtitle format

Salvatore Falco sfalco at studenti.ing.uniroma1.it
Tue Oct 29 19:28:27 CET 2002


Hi all!

This patch is to add support for Jacosub subtitles format, and is
made against 20021028 cvs snapshot.
Jacosub is a well known format in Japanese animation fansub.

The patch in 'patch_Jacosub_1028.h.diff' adds a new #define for
this format (number 12).

The patch in 'patch_Jacosub_1028.c.diff' adds a new sub_read_line_x
to read lines from a Jacosub script, the code to autodetect Jacosub
subtitles and the typical script exstension.

Bye all,
    Salvatore Falco

-------------- next part --------------
LS0tIHN1YnJlYWRlci5jLm9yaWcJMjAwMi0xMC0xNyAwMjo1MzoxNC4wMDAwMDAwMDAgKzAyMDAK
KysrIHN1YnJlYWRlci5jCTIwMDItMTAtMjkgMDE6MDg6NDEuMDAwMDAwMDAwICswMTAwCkBAIC02
MDMsNiArNjAzLDE5NiBAQAogICAgIHJldHVybiBjdXJyZW50OwogfQogCitzdWJ0aXRsZSAqc3Vi
X3JlYWRfbGluZV9qYWNvc3ViKEZJTEUgKiBmZCwgc3VidGl0bGUgKiBjdXJyZW50KQoreworICAg
IGNoYXIgY29tbWFuZHNbTElORV9MRU5dLCBsaW5lMVtMSU5FX0xFTl0sIGxpbmUyW0xJTkVfTEVO
XSwKKwl0ZXh0W0xJTkVfTEVOXSwgKnAsICpxOworICAgIGludCBhMSwgYTIsIGEzLCBhNCwgYjEs
IGIyLCBiMywgYjQsIGNvbW1lbnQgPSAwOworICAgIHVuc2lnbmVkIHNob3J0IGRpcmVjdGl2ZSA9
IDA7CisKKyAgICBiemVybyhjdXJyZW50LCBzaXplb2Yoc3VidGl0bGUpKTsKKyAgICBiemVybyhj
b21tYW5kcywgc2l6ZW9mKGNoYXIpICogTElORV9MRU4pOworICAgIGJ6ZXJvKGxpbmUxLCBzaXpl
b2YoY2hhcikgKiBMSU5FX0xFTik7CisgICAgYnplcm8obGluZTIsIHNpemVvZihjaGFyKSAqIExJ
TkVfTEVOKTsKKyAgICB3aGlsZSAo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AgICB9CisJICAgIGJyZWFrOworCWNhc2UgJ1sn
OgorCSAgICBkaXJlY3RpdmUgPSAxOworCSAgICBicmVhazsKKwljYXNlICd+JzoKKwkgICAgZGly
ZWN0aXZlID0gMjsKKwl9CisJaWYgKGRpcmVjdGl2ZSA9PSAxKSB7CisJICAgIHN0cmNweShsaW5l
MSwgbGluZTIpOworCSAgICBzc2NhbmYobGluZTEsICIlcyAlW15cblxyXSIsIGNvbW1hbmRzLCBs
aW5lMik7CisJfSBlbHNlIGlmIChkaXJlY3RpdmUgPT0gMikgeworCSAgICBjb250aW51ZTsKKwl9
CisJY3VycmVudC0+c3RhcnQgPSBhMSAqIDM2MDAwMCArIGEyICogNjAwMCArIGEzICogMTAwICsg
YTQ7CisJY3VycmVudC0+ZW5kID0gYjEgKiAzNjAwMDAgKyBiMiAqIDYwMDAgKyBiMyAqIDEwMCAr
IGI0OworCWN1cnJlbnQtPmxpbmVzID0gMDsKKworCXEgPSB0ZXh0OworCXAgPSBsaW5lMjsKKwl3
aGlsZSAoKCpwKSA9PSAnICcpCisJICAgIHArKzsKKworCWZvciAoOyAoIWVvbCgqcCkpICYmIChj
dXJyZW50LT5saW5lcyA8IFNVQl9NQVhfVEVYVCk7IHArKykgeworCSAgICBzd2l0Y2ggKCpwKSB7
CisJICAgIGNhc2UgJ3snOgorCQljb21tZW50Kys7CisJCWJyZWFrOworCSAgICBjYXNlICd9JzoK
KwkJY29tbWVudC0tOworCQkvL3RoZSBuZXh0IHRvIGdldCByaWQgb2YgYSBibGFuayBhZnRlciB0
aGUgY29tbWVudAorCQlpZiAoKCoocCArIDEpKSA9PSAnICcpCisJCSAgICBwKys7CisJCWJyZWFr
OworCSAgICBjYXNlICdcXCc6CisJCWlmICgqKHAgKyAxKSA9PSAnbicpIHsKKwkJICAgICpxID0g
J1wwJzsKKwkJICAgIHEgPSB0ZXh0OworCQkgICAgY3VycmVudC0+dGV4dFtjdXJyZW50LT5saW5l
cysrXSA9IHN0cmR1cCh0ZXh0KTsKKwkJICAgIHArKzsKKwkJICAgIGJyZWFrOworCQl9IGVsc2Ug
aWYgKHRvdXBwZXIoKihwICsgMSkpID09ICdDJykgeworCQkgICAgcCsrOworCQkgICAgcCsrOwor
CQkgICAgYnJlYWs7CisJCX0gZWxzZSBpZiAoKHRvdXBwZXIoKihwICsgMSkpID09ICdJJykKKwkJ
CSAgIHx8ICh0b3VwcGVyKCoocCArIDEpKSA9PSAnQicpCisJCQkgICB8fCAodG91cHBlcigqKHAg
KyAxKSkgPT0gJ04nKSkgeworCQkgICAgcCsrOworCQkgICAgYnJlYWs7CisJCX0gZWxzZSBpZiAo
ZW9sKCoocCArIDEpKSkgeworCQkgICAgaWYgKCFmZ2V0cyhsaW5lMSwgTElORV9MRU4sIGZkKSkK
KwkJCXJldHVybiBOVUxMOworCQkgICAgdHJhaWxfc3BhY2UobGluZTEpOworCQkgICAgcCA9IGxp
bmUxOworCQl9CisJICAgIGRlZmF1bHQ6CisJCWlmICghY29tbWVudCkgeworCQkgICAgKnEgPSAq
cDsKKwkJICAgIHErKzsKKwkJfQorCSAgICB9CisJfQorCSpxID0gJ1wwJzsKKwljdXJyZW50LT50
ZXh0W2N1cnJlbnQtPmxpbmVzXSA9IHN0cmR1cCh0ZXh0KTsKKyAgICB9CisgICAgY3VycmVudC0+
bGluZXMrKzsKKyAgICByZXR1cm4gY3VycmVudDsKK30KIAogaW50IHN1Yl9hdXRvZGV0ZWN0IChG
SUxFICpmZCkgewogICAgIGNoYXIgbGluZVtMSU5FX0xFTisxXTsKQEAgLTYyNiw2ICs4MTYsOCBA
QAogCQl7c3ViX3VzZXNfdGltZT0xO3JldHVybiBTVUJfU1VCVklFV0VSMjt9CiAJaWYgKHN0cnN0
ciAobGluZSwgIjxTQU1JPiIpKQogCQl7c3ViX3VzZXNfdGltZT0xOyByZXR1cm4gU1VCX1NBTUk7
fQorCWlmIChzc2NhbmYobGluZSwgIiVkOiVkOiVkLiVkICVkOiVkOiVkLiVkIiwgJmksICZpLCA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fcmVhZF9saW5lX3N1YnJpcDA5Ci0KKwkgICAgc3ViX3JlYWRf
bGluZV9zdWJyaXAwOSwKKwkgICAgc3ViX3JlYWRfbGluZV9qYWNvc3ViCisJICAgIAogICAgIH07
CiAgICAgaWYoZmlsZW5hbWU9PU5VTEwpIHJldHVybiBOVUxMOyAvL3FueCBzZWdmYXVsdAogICAg
IGZkPWZvcGVuIChmaWxlbmFtZSwgInIiKTsgaWYgKCFmZCkgcmV0dXJuIE5VTEw7CkBAIC04ODQs
NyArMTA3Nyw5IEBACiAgICAgIi5zc2EiLAogICAgICIuU1NBIiwKICAgICAiLmFxdCIsCi0gICAg
Ii5BUVQifTsKKyAgICAiLkFRVCIsCisgICAgIi5qcyIsCisgICAgIi5KUyIgfTsKIAogCiAgaWYg
KCBmbmFtZSA9PSBOVUxMICkgcmV0dXJuIE5VTEw7Cg==
-------------- next part --------------
LS0tIHN1YnJlYWRlci5oLm9yaWcJMjAwMi0xMC0yOSAwMToxNjoyMC4wMDAwMDAwMDAgKzAxMDAK
KysrIHN1YnJlYWRlci5oCTIwMDItMTAtMjkgMDA6MzE6MTIuMDAwMDAwMDAwICswMTAwCkBAIC0x
OSw2ICsxOSw3IEBACiAjZGVmaW5lIFNVQl9BUVRJVExFICAgOQogI2RlZmluZSBTVUJfU1VCVklF
V0VSMiAxMAogI2RlZmluZSBTVUJfU1VCUklQMDkgMTEKKyNkZWZpbmUgU1VCX0pBQ09TVUIgIDEy
CiAKIC8vIE9uZSBvZiB0aGUgU1VCXyogY29uc3RhbnQgYWJvdmUKIGV4dGVybiBpbnQgc3ViX2Zv
cm1hdDsK


More information about the MPlayer-dev-eng mailing list