# HG changeset patch # User aurel # Date 1220627226 0 # Node ID d895515b366dbb04ddb9ff55c2553956b165bf8b # Parent ed77f7dee121a19c87fe19dcf4abaf1b7028b314 libass: add a new ass_process_data() to process demuxed subtitle packets conforming to the ASS spec diff -r ed77f7dee121 -r d895515b366d libass/ass.c --- a/libass/ass.c Fri Sep 05 14:18:05 2008 +0000 +++ b/libass/ass.c Fri Sep 05 15:07:06 2008 +0000 @@ -717,21 +717,33 @@ } /** - * \brief Process CodecPrivate section of subtitle stream + * \brief Process a chunk of subtitle stream data. * \param track track * \param data string to parse * \param size length of data - CodecPrivate section contains [Stream Info] and [V4+ Styles] ([V4 Styles] for SSA) sections -*/ -void ass_process_codec_private(ass_track_t* track, char *data, int size) +*/ +void ass_process_data(ass_track_t* track, char* data, int size) { char* str = malloc(size + 1); memcpy(str, data, size); str[size] = '\0'; + mp_msg(MSGT_ASS, MSGL_V, "event: %s\n", str); process_text(track, str); free(str); +} + +/** + * \brief Process CodecPrivate section of subtitle stream + * \param track track + * \param data string to parse + * \param size length of data + CodecPrivate section contains [Stream Info] and [V4+ Styles] ([V4 Styles] for SSA) sections +*/ +void ass_process_codec_private(ass_track_t* track, char *data, int size) +{ + ass_process_data(track, data, size); if (!track->event_format) { // probably an mkv produced by ancient mkvtoolnix diff -r ed77f7dee121 -r d895515b366d libass/ass.h --- a/libass/ass.h Fri Sep 05 14:18:05 2008 +0000 +++ b/libass/ass.h Fri Sep 05 15:07:06 2008 +0000 @@ -154,6 +154,14 @@ void ass_free_event(ass_track_t* track, int eid); /** + * \brief Parse a chunk of subtitle stream data. + * \param track track + * \param data string to parse + * \param size length of data + */ +void ass_process_data(ass_track_t* track, char* data, int size); + +/** * \brief Parse Codec Private section of subtitle stream * \param track target track * \param data string to parse diff -r ed77f7dee121 -r d895515b366d mpcommon.c --- a/mpcommon.c Fri Sep 05 14:18:05 2008 +0000 +++ b/mpcommon.c Fri Sep 05 15:07:06 2008 +0000 @@ -122,9 +122,7 @@ ass_track = sh ? sh->ass_track : NULL; if (!ass_track) continue; if (type == 'a') { // ssa/ass subs with libass - ass_process_chunk(ass_track, packet, len, - (long long)(pts*1000 + 0.5), - (long long)((endpts-pts)*1000 + 0.5)); + ass_process_data(ass_track, packet, len); } else { // plaintext subs with libass vo_sub = NULL; if (pts != MP_NOPTS_VALUE) {