summaryrefslogtreecommitdiffstats
path: root/sub/ass_mp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sub/ass_mp.c')
-rw-r--r--sub/ass_mp.c79
1 files changed, 0 insertions, 79 deletions
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index 4be89fb004..85105a33ad 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -102,85 +102,6 @@ ASS_Track *mp_ass_default_track(ASS_Library *library, struct MPOpts *opts)
return track;
}
-/**
- * \brief Convert subtitle to ASS_Events for the given track
- * \param track track
- * \param sub subtitle to convert
- * \return event id
- * note: assumes that subtitle is _not_ fps-based; caller must manually correct
- * Start and Duration in other case.
- **/
-static int ass_process_subtitle(ASS_Track *track, subtitle *sub)
-{
- int eid;
- ASS_Event *event;
- int len = 0, j;
- char *p;
- char *end;
-
- eid = ass_alloc_event(track);
- event = track->events + eid;
-
- event->Start = sub->start * 10;
- event->Duration = (sub->end - sub->start) * 10;
- event->Style = track->default_style;
-
- for (j = 0; j < sub->lines; ++j)
- len += sub->text[j] ? strlen(sub->text[j]) : 0;
-
- len += 2 * sub->lines; // '\N', including the one after the last line
- len += 6; // {\anX}
- len += 1; // '\0'
-
- event->Text = malloc(len);
- end = event->Text + len;
- p = event->Text;
-
- if (sub->alignment)
- p += snprintf(p, end - p, "{\\an%d}", sub->alignment);
-
- for (j = 0; j < sub->lines; ++j)
- p += snprintf(p, end - p, "%s\\N", sub->text[j]);
-
- if (sub->lines > 0)
- p -= 2; // remove last "\N"
- *p = 0;
-
- mp_msg(MSGT_ASS, MSGL_V,
- "plaintext event at %" PRId64 ", +%" PRId64 ": %s \n",
- (int64_t) event->Start, (int64_t) event->Duration, event->Text);
-
- return eid;
-}
-
-
-/**
- * \brief Convert subdata to ASS_Track
- * \param subdata subtitles struct from subreader
- * \param fps video framerate
- * \return newly allocated ASS_Track, filled with subtitles from subdata
- */
-ASS_Track *mp_ass_read_subdata(ASS_Library *library, struct MPOpts *opts,
- sub_data *subdata, double fps)
-{
- ASS_Track *track;
- int i;
-
- track = mp_ass_default_track(library, opts);
- track->name = subdata->filename ? strdup(subdata->filename) : 0;
-
- for (i = 0; i < subdata->sub_num; ++i) {
- int eid = ass_process_subtitle(track, subdata->subtitles + i);
- if (eid < 0)
- continue;
- if (!subdata->sub_uses_time) {
- track->events[eid].Start *= 100. / fps;
- track->events[eid].Duration *= 100. / fps;
- }
- }
- return track;
-}
-
ASS_Track *mp_ass_read_stream(ASS_Library *library, const char *fname,
char *charset)
{