summaryrefslogtreecommitdiffstats
path: root/subreader.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-01-07 12:06:48 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-01-07 12:06:48 +0000
commit44ecf3956720cf8ea9631f7e1d2cb1a351cfe1ec (patch)
treee9083e7bd83f1c67849669d260587c4e053c7530 /subreader.c
parent8665071a0eab9591325d19fc703efe0f43efe59b (diff)
downloadmpv-44ecf3956720cf8ea9631f7e1d2cb1a351cfe1ec.tar.bz2
mpv-44ecf3956720cf8ea9631f7e1d2cb1a351cfe1ec.tar.xz
Document sub_add_text and sub_clear_text
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21851 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'subreader.c')
-rw-r--r--subreader.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/subreader.c b/subreader.c
index 932cf1f96f..511356a3a1 100644
--- a/subreader.c
+++ b/subreader.c
@@ -2255,6 +2255,17 @@ void sub_free( sub_data * subd )
}
#define MAX_SUBLINE 512
+/**
+ * \brief parse text and append it to subtitle in sub
+ * \param sub subtitle struct to add text to
+ * \param txt text to parse
+ * \param len length of text in txt
+ * \param endpts pts at which this subtitle text should be removed again
+ *
+ * <> and {} are interpreted as comment delimiters, "\n", "\N", '\n', '\r'
+ * and '\0' are interpreted as newlines, duplicate, leading and trailing
+ * newlines are ignored.
+ */
void sub_add_text(subtitle *sub, const char *txt, int len, double endpts) {
int comment = 0;
int double_newline = 1; // ignore newlines at the beginning
@@ -2307,6 +2318,13 @@ void sub_add_text(subtitle *sub, const char *txt, int len, double endpts) {
}
#define MP_NOPTS_VALUE (-1LL<<63)
+/**
+ * \brief remove outdated subtitle lines.
+ * \param sub subtitle struct to modify
+ * \param pts current pts. All lines with endpts <= this will be removed.
+ * Use MP_NOPTS_VALUE to remove all lines
+ * \return 1 if sub was modified, 0 otherwise.
+ */
int sub_clear_text(subtitle *sub, double pts) {
int i = 0;
int changed = 0;