summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_mkv.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-03-31 03:06:21 +0300
committerUoti Urpala <uau@mplayer2.org>2011-03-31 03:44:37 +0300
commit56504de6ff0e33e3d375acb15ea31af9c83e3cb0 (patch)
treec62ddc826ff966a2c1201ee3f4b7b4d5e523472e /libmpdemux/demux_mkv.c
parent993bc6a83fbec9dc6241b5e6d6dd8bebd5347c18 (diff)
downloadmpv-56504de6ff0e33e3d375acb15ea31af9c83e3cb0.tar.bz2
mpv-56504de6ff0e33e3d375acb15ea31af9c83e3cb0.tar.xz
demux_mkv: use generic packet handling code for subtitles
Duration may now be set for packet types other than subtitles; as far as I can tell nothing should care. A check requiring valid duration values for subtitles is removed, because duration may not be properly set for all bitmap subtitle types; hopefully this doesn't make the behavior with (already broken) subtitles without duration worse.
Diffstat (limited to 'libmpdemux/demux_mkv.c')
-rw-r--r--libmpdemux/demux_mkv.c32
1 files changed, 5 insertions, 27 deletions
diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c
index 58570855ae..85bea70780 100644
--- a/libmpdemux/demux_mkv.c
+++ b/libmpdemux/demux_mkv.c
@@ -1867,26 +1867,6 @@ static int demux_mkv_read_block_lacing(uint8_t *buffer, uint64_t *size,
return 1;
}
-static void handle_subtitles(demuxer_t *demuxer, mkv_track_t *track,
- char *block, int64_t size,
- uint64_t block_duration, uint64_t timecode)
-{
- demux_packet_t *dp;
-
- if (block_duration == 0) {
- mp_msg(MSGT_DEMUX, MSGL_WARN,
- "[mkv] Warning: No BlockDuration for subtitle track found.\n");
- return;
- }
-
- sub_utf8 = 1;
- dp = new_demux_packet(size);
- memcpy(dp->buffer, block, size);
- dp->pts = timecode / 1e9;
- dp->duration = block_duration / 1e9;
- ds_add_packet(demuxer->sub, dp);
-}
-
static void handle_realvideo(demuxer_t *demuxer, mkv_track_t *track,
uint8_t *buffer, uint32_t size, int64_t block_bref)
{
@@ -2101,15 +2081,12 @@ static int handle_block(demuxer_t *demuxer, uint8_t *block, uint64_t length,
} else if (track->type == MATROSKA_TRACK_SUBTITLE
&& track->id == demuxer->sub->id) {
ds = demuxer->sub;
- if (track->subtitle_type != MATROSKA_SUBTYPE_VOBSUB) {
- uint8_t *buffer;
- int size = length;
- demux_mkv_decode(track, block, &buffer, &size, 1);
- handle_subtitles(demuxer, track, buffer, size, block_duration, tc);
- if (buffer != block)
- talloc_free(buffer);
+ if (laces > 1) {
+ mp_msg(MSGT_DEMUX, MSGL_WARN, "[mkv] Subtitles use Matroska "
+ "lacing. This is abnormal and not supported.\n");
use_this_block = 0;
}
+ sub_utf8 = 1; // XXX this variable should be eventually removed
} else
use_this_block = 0;
@@ -2142,6 +2119,7 @@ static int handle_block(demuxer_t *demuxer, uint8_t *block, uint64_t length,
if (i == 0 || track->default_duration)
dp->pts =
mkv_d->last_pts + i * track->default_duration;
+ dp->duration = block_duration / 1e9;
ds_add_packet(ds, dp);
}
}