[MPlayer-cvslog] r27530 - in trunk: libass/ass.c libass/ass.h mpcommon.c
aurel
subversion at mplayerhq.hu
Fri Sep 5 17:07:07 CEST 2008
Author: aurel
Date: Fri Sep 5 17:07:06 2008
New Revision: 27530
Log:
libass: add a new ass_process_data() to process demuxed subtitle packets
conforming to the ASS spec
Modified:
trunk/libass/ass.c
trunk/libass/ass.h
trunk/mpcommon.c
Modified: trunk/libass/ass.c
==============================================================================
--- trunk/libass/ass.c (original)
+++ trunk/libass/ass.c Fri Sep 5 17:07:06 2008
@@ -717,21 +717,33 @@ static int process_text(ass_track_t* tra
}
/**
- * \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
Modified: trunk/libass/ass.h
==============================================================================
--- trunk/libass/ass.h (original)
+++ trunk/libass/ass.h Fri Sep 5 17:07:06 2008
@@ -154,6 +154,14 @@ void ass_free_style(ass_track_t* track,
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
Modified: trunk/mpcommon.c
==============================================================================
--- trunk/mpcommon.c (original)
+++ trunk/mpcommon.c Fri Sep 5 17:07:06 2008
@@ -122,9 +122,7 @@ void update_subtitles(sh_video_t *sh_vid
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) {
More information about the MPlayer-cvslog
mailing list