[MPlayer-cvslog] r25682 - in trunk/libmpdemux: demux_mkv.c demuxer.c
eugeni
subversion at mplayerhq.hu
Fri Jan 11 22:45:15 CET 2008
Author: eugeni
Date: Fri Jan 11 22:45:15 2008
New Revision: 25682
Log:
Init and destroy ass_tracks in demuxer.c based on sh_sub->type value.
Modified:
trunk/libmpdemux/demux_mkv.c
trunk/libmpdemux/demuxer.c
Modified: trunk/libmpdemux/demux_mkv.c
==============================================================================
--- trunk/libmpdemux/demux_mkv.c (original)
+++ trunk/libmpdemux/demux_mkv.c Fri Jan 11 22:45:15 2008
@@ -956,10 +956,6 @@ demux_mkv_free_trackentry(mkv_track_t *t
free (track->audio_buf);
if (track->audio_timestamp)
free (track->audio_timestamp);
-#ifdef USE_ASS
- if (track->sh_sub && track->sh_sub->ass_track)
- ass_free_track (track->sh_sub->ass_track);
-#endif
demux_mkv_free_encodings(track->encodings, track->num_encodings);
free(track);
}
@@ -2254,38 +2250,6 @@ demux_mkv_parse_vobsub_data (demuxer_t *
}
}
-/** \brief Parse the private data for SSA/ASS subtitle tracks.
-
- This function tries to parse the private data for all SSA/ASS tracks.
- The private data contains the normal text from the original script,
- from the start to the beginning of 'Events' section, including '[Events]' line.
-
- \param demuxer The generic demuxer.
-*/
-#ifdef USE_ASS
-static void
-demux_mkv_parse_ass_data (demuxer_t *demuxer)
-{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- mkv_track_t *track;
- int i;
-
- for (i = 0; i < mkv_d->num_tracks; i++)
- {
- track = mkv_d->tracks[i];
- if (track->type != MATROSKA_TRACK_SUBTITLE ||
- track->subtitle_type == MATROSKA_SUBTYPE_VOBSUB)
- continue;
-
- if (track->subtitle_type == MATROSKA_SUBTYPE_SSA)
- {
- track->sh_sub->ass_track = ass_new_track(ass_library);
- ass_process_codec_private(track->sh_sub->ass_track, track->private_data, track->private_size);
- }
- }
-}
-#endif
-
static int
demux_mkv_open_sub (demuxer_t *demuxer, mkv_track_t *track, int sid)
{
@@ -2549,10 +2513,7 @@ demux_mkv_open (demuxer_t *demuxer)
}
demux_mkv_parse_vobsub_data (demuxer);
-#ifdef USE_ASS
- if (ass_enabled)
- demux_mkv_parse_ass_data (demuxer);
-#endif
+
/* DO NOT automatically select a subtitle track and behave like DVD */
/* playback: only show subtitles if the user explicitely wants them. */
track = NULL;
Modified: trunk/libmpdemux/demuxer.c
==============================================================================
--- trunk/libmpdemux/demuxer.c (original)
+++ trunk/libmpdemux/demuxer.c Fri Jan 11 22:45:15 2008
@@ -22,6 +22,11 @@
#include "libaf/af_format.h"
+#ifdef USE_ASS
+#include "libass/ass.h"
+#include "libass/ass_mp.h"
+#endif
+
extern void resync_video_stream(sh_video_t *sh_video);
extern void resync_audio_stream(sh_audio_t *sh_audio);
@@ -239,6 +244,7 @@ sh_sub_t *new_sh_sub_sid(demuxer_t *demu
void free_sh_sub(sh_sub_t *sh) {
mp_msg(MSGT_DEMUXER, MSGL_DBG2, "DEMUXER: freeing sh_sub at %p\n", sh);
if (sh->extradata) free(sh->extradata);
+ if (sh->ass_track) ass_free_track(sh->ass_track);
free(sh);
}
@@ -813,6 +819,18 @@ int biComp=le2me_32(sh_video->bih->biCom
sh_video->i_bps*0.008f,
sh_video->i_bps/1024.0f );
}
+#ifdef USE_ASS
+ if (ass_enabled && ass_library) {
+ for (i = 0; i < MAX_S_STREAMS; ++i) {
+ sh_sub_t* sh = demuxer->s_streams[i];
+ if (sh && sh->type == 'a') {
+ sh->ass_track = ass_new_track(ass_library);
+ if (sh->ass_track && sh->extradata)
+ ass_process_codec_private(sh->ass_track, sh->extradata, sh->extradata_len);
+ }
+ }
+ }
+#endif
return demuxer;
}
More information about the MPlayer-cvslog
mailing list