mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-25 04:11:44 +00:00
Removed the now unnecessary extra function for handling text subtitles.
This commit is contained in:
parent
d63e41dedc
commit
3b016fda19
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: r_matroska.cpp,v 1.8 2003/04/20 20:08:02 mosu Exp $
|
||||
\version \$Id: r_matroska.cpp,v 1.9 2003/04/21 10:06:48 mosu Exp $
|
||||
\brief Matroska reader
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -173,44 +173,6 @@ int mkv_reader_c::packets_available() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void mkv_reader_c::handle_subtitles(mkv_track_t *t, KaxBlock &block) {
|
||||
int len;
|
||||
u_int32_t block_nr;
|
||||
char *s1, *buffer;
|
||||
long duration;
|
||||
int64_t start;
|
||||
|
||||
for (block_nr = 0; block_nr < block.NumberFrames(); block_nr++) {
|
||||
DataBuffer &data = block.GetBuffer(block_nr);
|
||||
len = data.Size();
|
||||
buffer = (char *)malloc(len + 1);
|
||||
if (buffer == NULL) {
|
||||
printf("[mkv] Could not allocate memory for subtitles.\n");
|
||||
return;
|
||||
}
|
||||
memcpy(buffer, data.Buffer(), len);
|
||||
buffer[len] = 0;
|
||||
|
||||
// Extract the duration (which is the first line).
|
||||
s1 = buffer;
|
||||
while ((*s1 != 0) && (*s1 != '\n') && (*s1 != '\r'))
|
||||
s1++;
|
||||
if (*s1 == 0)
|
||||
return;
|
||||
|
||||
*s1 = 0;
|
||||
s1++;
|
||||
duration = strtol(buffer, NULL, 10); // in ms
|
||||
while ((*s1 == '\n') || (*s1 == '\r'))
|
||||
s1++;
|
||||
|
||||
start = cluster_tc + block.Timecod();
|
||||
t->packetizer->process((unsigned char *)s1, 0, start, duration);
|
||||
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
mkv_track_t *mkv_reader_c::new_mkv_track() {
|
||||
mkv_track_t *t;
|
||||
|
||||
@ -884,6 +846,12 @@ void mkv_reader_c::handle_blocks() {
|
||||
if (num_buffers == 0)
|
||||
return;
|
||||
|
||||
if ((block_track->type == 't') && (block_duration == -1)) {
|
||||
fprintf(stdout, "Warning: Text subtitle block does not contain a "
|
||||
"block duration element. This file is broken.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
last_timecode = block_timecode;
|
||||
|
||||
if (block_ref1 > 0) {
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/*!
|
||||
\file
|
||||
\version \$Id: r_matroska.h,v 1.4 2003/04/20 20:08:02 mosu Exp $
|
||||
\version \$Id: r_matroska.h,v 1.5 2003/04/21 10:06:48 mosu Exp $
|
||||
\brief class definitions for the Matroska reader
|
||||
\author Moritz Bunkus <moritz @ bunkus.org>
|
||||
*/
|
||||
@ -117,7 +117,6 @@ private:
|
||||
virtual mkv_track_t *find_track_by_num(u_int32_t num, mkv_track_t *c = NULL);
|
||||
virtual void verify_tracks();
|
||||
virtual int packets_available();
|
||||
virtual void handle_subtitles(mkv_track_t *t, KaxBlock &block);
|
||||
virtual void add_buffer(DataBuffer &dbuffer);
|
||||
virtual void free_buffers();
|
||||
virtual void handle_blocks();
|
||||
|
Loading…
Reference in New Issue
Block a user