1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-30 03:32:50 +00:00

libass: add a new ass_process_data() to process demuxed subtitle packets

conforming to the ASS spec


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27530 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
aurel 2008-09-05 15:07:06 +00:00
parent 79874cb4ea
commit 81058d5af2
3 changed files with 25 additions and 7 deletions

View File

@ -717,21 +717,33 @@ static int process_text(ass_track_t* track, char* str)
}
/**
* \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

View File

@ -153,6 +153,14 @@ void ass_free_style(ass_track_t* track, int sid);
*/
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

View File

@ -122,9 +122,7 @@ void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, int reset)
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) {