diff --git a/ChangeLog b/ChangeLog index de306ce13..7b494d5af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-10-28 Moritz Bunkus + + * mkvmerge, mkvextract: The Matroska reader and the OGM reader + (mkvmerge) as well as mkvextract will discard empty or 'cleaning + only' subtitle packets as they are appear in OGMs in order to mark + the end of an entry. + 2003-10-27 Moritz Bunkus * mkvmerge: new feature: Added the ability to read timecodes from diff --git a/src/mkvextract_tracks.cpp b/src/mkvextract_tracks.cpp index 6739a7da8..73092de38 100644 --- a/src/mkvextract_tracks.cpp +++ b/src/mkvextract_tracks.cpp @@ -514,6 +514,11 @@ static void handle_data(KaxBlock *block, int64_t block_duration, track->warning_printed = true; } + buffer[0] = *data.Buffer(); + if ((data.Size() < 2) && + ((buffer[0] != ' ') || (buffer[0] != 0) || !iscr(buffer[0]))) + break; + // Do the charset conversion. s = (char *)safemalloc(data.Size() + 1); memcpy(s, data.Buffer(), data.Size()); diff --git a/src/r_matroska.cpp b/src/r_matroska.cpp index f68339f99..491932e33 100644 --- a/src/r_matroska.cpp +++ b/src/r_matroska.cpp @@ -1548,17 +1548,21 @@ int kax_reader_c::read(generic_packetizer_c *) { 1); if ((block_track->type == 's') && (block_track->sub_type == 't')) { - char *lines; + if ((re_size > 2) || + ((re_size > 0) && (*re_buffer != ' ') && + (*re_buffer != 0) && !iscr(*re_buffer))) { + char *lines; - lines = (char *)safemalloc(re_size + 1); - lines[re_size] = 0; - memcpy(lines, re_buffer, re_size); - block_track->packetizer->process((unsigned char *)lines, 0, - (int64_t)last_timecode, - block_duration, - block_bref, - block_fref); - safefree(lines); + lines = (char *)safemalloc(re_size + 1); + lines[re_size] = 0; + memcpy(lines, re_buffer, re_size); + block_track->packetizer->process((unsigned char *)lines, 0, + (int64_t)last_timecode, + block_duration, + block_bref, + block_fref); + safefree(lines); + } } else block_track->packetizer->process(re_buffer, re_size, (int64_t)last_timecode, diff --git a/src/r_ogm.cpp b/src/r_ogm.cpp index 9cd95f7f0..f56b45bd0 100644 --- a/src/r_ogm.cpp +++ b/src/r_ogm.cpp @@ -565,7 +565,9 @@ void ogm_reader_c::process_page(ogg_page *og) { } else if (dmx->stype == OGM_STREAM_TYPE_TEXT) { dmx->units_processed++; - if ((op.bytes - 1 - hdrlen) > 1) + if (((op.bytes - 1 - hdrlen) > 2) || + ((op.packet[hdrlen + 1] != ' ') && + (op.packet[hdrlen + 1] != 0) && !iscr(op.packet[hdrlen + 1]))) dmx->packetizer->process(&op.packet[hdrlen + 1], op.bytes - 1 - hdrlen, ogg_page_granulepos(og), lenbytes);