summaryrefslogtreecommitdiffstats
path: root/sub/dec_sub.c
diff options
context:
space:
mode:
Diffstat (limited to 'sub/dec_sub.c')
-rw-r--r--sub/dec_sub.c34
1 files changed, 0 insertions, 34 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c
index a9267112f4..4372c0be91 100644
--- a/sub/dec_sub.c
+++ b/sub/dec_sub.c
@@ -346,37 +346,6 @@ static void multiply_timings(struct packet_list *subs, double factor)
}
}
-#define MS_TS(f_ts) ((long long)((f_ts) * 1000 + 0.5))
-
-// Remove overlaps and fill gaps between adjacent subtitle packets. This is done
-// by adjusting the duration of the earlier packet. If the gaps or overlap are
-// larger than the threshold, or if the durations are close to the threshold,
-// don't change the events.
-// The algorithm is maximally naive and doesn't work if there are multiple
-// overlapping lines. (It's not worth the trouble.)
-static void fix_overlaps_and_gaps(struct packet_list *subs)
-{
- double threshold = SUB_GAP_THRESHOLD;
- double keep = SUB_GAP_KEEP;
- for (int i = 0; i < subs->num_packets - 1; i++) {
- struct demux_packet *cur = subs->packets[i];
- struct demux_packet *next = subs->packets[i + 1];
- if (cur->pts != MP_NOPTS_VALUE && cur->duration > 0 &&
- next->pts != MP_NOPTS_VALUE && next->duration > 0)
- {
- double end = cur->pts + cur->duration;
- if (fabs(next->pts - end) <= threshold && cur->duration >= keep &&
- next->duration >= keep)
- {
- // Conceptually: cur->duration = next->pts - cur->pts;
- // But make sure the rounding and conversion to integers in
- // sd_ass.c can't produce overlaps.
- cur->duration = (MS_TS(next->pts) - MS_TS(cur->pts)) / 1000.0;
- }
- }
- }
-}
-
static void add_sub_list(struct dec_sub *sub, int at, struct packet_list *subs)
{
struct sd *sd = sub_get_last_sd(sub);
@@ -478,9 +447,6 @@ bool sub_read_all_packets(struct dec_sub *sub, struct sh_stream *sh)
if (sub_speed != 1.0)
multiply_timings(subs, sub_speed);
- if (opts->sub_fix_timing)
- fix_overlaps_and_gaps(subs);
-
add_sub_list(sub, preprocess, subs);
pthread_mutex_unlock(&sub->lock);