Mercurial > mplayer.hg
changeset 27498:d895515b366d
libass: add a new ass_process_data() to process demuxed subtitle packets
conforming to the ASS spec
author | aurel |
---|---|
date | Fri, 05 Sep 2008 15:07:06 +0000 |
parents | ed77f7dee121 |
children | 1dfad1b382fa |
files | libass/ass.c libass/ass.h mpcommon.c |
diffstat | 3 files changed, 25 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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
--- 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) {