aboutsummaryrefslogtreecommitdiffhomepage
path: root/libmpdemux
diff options
context:
space:
mode:
authorGravatar eugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-01-11 21:45:15 +0000
committerGravatar eugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-01-11 21:45:15 +0000
commitd9d27bb8c430f85502aa34cd892f5ed31d0aef81 (patch)
tree398d7a633712d99b71cd0329bc70bd2b8de44726 /libmpdemux
parent2d0715a915acaae5c4a42452ef512c41896d72c1 (diff)
Init and destroy ass_tracks in demuxer.c based on sh_sub->type value.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25682 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demux_mkv.c41
-rw-r--r--libmpdemux/demuxer.c18
2 files changed, 19 insertions, 40 deletions
diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c
index c67e67d7d0..5363649a3b 100644
--- a/libmpdemux/demux_mkv.c
+++ b/libmpdemux/demux_mkv.c
@@ -956,10 +956,6 @@ demux_mkv_free_trackentry(mkv_track_t *track) {
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 *demuxer)
}
}
-/** \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;
diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c
index 2482ad26be..512178915d 100644
--- a/libmpdemux/demuxer.c
+++ b/libmpdemux/demuxer.c
@@ -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 *demuxer, int id, int sid) {
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->biCompression);
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;
}