libass (0.13.2 - unreleased)
+ * Add ass_set_check_readorder() API function to disable use of the ReadOrder
+ field for duplicate checking in ass_process_chunk().
* Bug fixes
* Fix an issue with the new duplicate checking, which could lead to
missing subtitles after seeking.
// contains bitmap of ReadOrder IDs of all read events
uint32_t *read_order_bitmap;
int read_order_elems; // size in uint32_t units of read_order_bitmap
+ int check_readorder;
};
#define ASS_STYLES_ALLOC 20
return 0;
}
+void ass_set_check_readorder(ASS_Track *track, int check_readorder)
+{
+ track->parser_priv->check_readorder = check_readorder == 1;
+}
+
/**
* \brief Process a chunk of subtitle stream data. In Matroska, this contains exactly 1 event (or a commentary).
* \param track track
char *p;
char *token;
ASS_Event *event;
+ int check_readorder = track->parser_priv->check_readorder;
- if (!track->parser_priv->read_order_bitmap) {
+ if (check_readorder && !track->parser_priv->read_order_bitmap) {
for (int i = 0; i < track->n_events; i++) {
if (test_and_set_read_order_bit(track, track->events[i].ReadOrder) < 0)
break;
do {
NEXT(p, token);
event->ReadOrder = atoi(token);
- if (check_duplicate_event(track, event->ReadOrder))
+ if (check_readorder && check_duplicate_event(track, event->ReadOrder))
break;
NEXT(p, token);
free(track);
return NULL;
}
+ track->parser_priv->check_readorder = 1;
return track;
}
#include <stdarg.h>
#include "ass_types.h"
-#define LIBASS_VERSION 0x01301000
+#define LIBASS_VERSION 0x01302000
#ifdef __cplusplus
extern "C" {
void ass_process_chunk(ASS_Track *track, char *data, int size,
long long timecode, long long duration);
+/**
+ * \brief Set whether the ReadOrder field when processing a packet with
+ * ass_process_chunk() should be used for eliminating duplicates.
+ * \param check_readorder 0 means do not try to eliminate duplicates; 1 means
+ * use the ReadOrder field embedded in the packet as unique identifier, and
+ * discard the packet if there was already a packet with the same ReadOrder.
+ * Other values are undefined.
+ */
+void ass_set_check_readorder(ASS_Track *track, int check_readorder);
+
/**
* \brief Flush buffered events.
* \param track track
ass_set_pixel_aspect
ass_set_selective_style_override_enabled
ass_set_selective_style_override
+ass_set_check_readorder