diff --git a/ChangeLog b/ChangeLog index 1856c542e..65bfed423 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-11-18 Moritz Bunkus + + * mkvmerge: Rewrote the SPU packet parsing code. It should not + abort anymore. + + * everything: Committed a lot of cross-OS compatibility fixes + (thanks to Haali and thedj). + 2003-11-16 Moritz Bunkus * Released v0.7.7. diff --git a/configure.in b/configure.in index 4513a402e..a3281df24 100644 --- a/configure.in +++ b/configure.in @@ -656,7 +656,11 @@ AC_ARG_WITH(avilib, AC_MSG_CHECKING(which AVI libraries to use) # Defaults: use aviclasses and prefer the new avilib. - have_aviclasses=yes + if test x"`uname -s`" = x"Darwin"; then + have_aviclasses=no + else + have_aviclasses=yes + fi if test "x$with_avilib_given" = "xyes"; then set - `echo ${with_avilib} | sed 's/,/ /g'` while test "x$1" != "x"; do @@ -686,21 +690,10 @@ AC_ARG_WITH(avilib, AVICLASSES_LIBS="-laviclasses" avi_libs_to_use="classes " fi - if test "x$have_avilib0_6_10" = "xyes" -a "x$have_avilib" = "xyes"; then - echo "" - echo "*** You cannot include both the old avilib and the new" - echo "*** one (0.6.10)." - exit 1 - fi - if test "x$have_avilib" = "xyes"; then - avi_libs_to_use="${avi_libs_to_use}old " - else - AC_DEFINE(HAVE_AVILIB0_6_10, 1, - [Define if the newer avilib from transcode 0.6.10 should be used.]) - avi_libs_to_use="${avi_libs_to_use}0.6.10 " - have_avilib0_6_10=yes - fi - AM_CONDITIONAL(HAVE_AVILIB, test x"$have_avilib0_6_10" != "xyes") + AC_DEFINE(HAVE_AVILIB0_6_10, 1, + [Define if the newer avilib from transcode 0.6.10 should be used.]) + avi_libs_to_use="${avi_libs_to_use}0.6.10 " + have_avilib0_6_10=yes AM_CONDITIONAL(HAVE_AVILIB0_6_10, test x"$have_avilib0_6_10" = "xyes") AM_CONDITIONAL(HAVE_AVICLASSES, test x"$have_aviclasses" = "xyes") diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 013a91e11..65ed18a65 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -1,7 +1,3 @@ -if HAVE_AVILIB -avilib_incdirs = -I$(top_srcdir)/avilib -avilib_libdirs = -L$(top_srcdir)/avilib -endif if HAVE_AVILIB0_6_10 avilib0_6_10_incdirs = -I$(top_srcdir)/avilib-0.6.10 avilib0_6_10_libdirs = -L$(top_srcdir)/avilib-0.6.10 diff --git a/src/input/Makefile.am b/src/input/Makefile.am index acd1b00b0..af8bed1d1 100644 --- a/src/input/Makefile.am +++ b/src/input/Makefile.am @@ -1,7 +1,3 @@ -if HAVE_AVILIB -avilib_incdirs = -I$(top_srcdir)/avilib -avilib_libdirs = -L$(top_srcdir)/avilib -endif if HAVE_AVILIB0_6_10 avilib0_6_10_incdirs = -I$(top_srcdir)/avilib-0.6.10 avilib0_6_10_libdirs = -L$(top_srcdir)/avilib-0.6.10 diff --git a/src/output/p_vobsub.cpp b/src/output/p_vobsub.cpp index 108da7bd5..568c01e21 100644 --- a/src/output/p_vobsub.cpp +++ b/src/output/p_vobsub.cpp @@ -78,47 +78,91 @@ void vobsub_packetizer_c::set_headers() { (timecode - initial_displacement) % 1000 #define FMT_TIMECODE "%02lld:%02lld:%02lld.%03lld" + +int a,b; /* Temporary vars */ +unsigned int date, type; +unsigned int off; +unsigned int start_off = 0; +unsigned int next_off; +unsigned int start_pts; +unsigned int end_pts; +unsigned int current_nibble[2]; +unsigned int control_start; +unsigned int display = 0; +unsigned int start_col = 0; +unsigned int end_col = 0; +unsigned int start_row = 0; +unsigned int end_row = 0; +unsigned int width = 0; +unsigned int height = 0; +unsigned int stride = 0; + int vobsub_packetizer_c::extract_duration(unsigned char *data, int buf_size, int64_t timecode) { - const int lengths[7] = {0, 0, 0, 2, 2, 6, 4}; - int i, next_ctrlblk, packet_size, data_size, t, len; + uint32_t date, control_start, next_off, start_off, off; + int duration; + bool unknown; - packet_size = (data[0] << 8) | data[1]; - data_size = (data[2] << 8) | data[3]; - next_ctrlblk = data_size; + control_start = get_uint16_be(data + 2); + next_off = control_start; + duration = -1; - do { - i = next_ctrlblk; - t = (data[i] << 8) | data[i + 1]; - i += 2; - next_ctrlblk = (data[i] << 8) | data[i + 1]; - i += 2; - - if((next_ctrlblk > packet_size) || (next_ctrlblk < data_size)) { - mxwarn(PFX "Inconsistent data in the SPU packets (next_ctrlblk: %d, " - "packet_size: %d, data_size: %d, timecode: " FMT_TIMECODE "). " - "Skipping this packet. This is NOT fatal.\n", next_ctrlblk, - packet_size, data_size, TIMECODE); - return -2; + while ((start_off != next_off) && (next_off < buf_size)) { + start_off = next_off; + date = get_uint16_be(data + start_off) * 1024; + next_off = get_uint16_be(data + start_off + 2); + mxverb(4, PFX "date = %u\n", date); + off = start_off + 4; + for (type = data[off++]; type != 0xff; type = data[off++]) { + mxverb(4, PFX "cmd = %d ",type); + unknown = false; + switch(type) { + case 0x00: + /* Menu ID, 1 byte */ + mxverb(4, "menu ID"); + break; + case 0x01: + /* Start display */ + mxverb(4, "start display"); + break; + case 0x02: + /* Stop display */ + mxverb(4, "stop display: %u", date / 90); + duration = date / 90; + break; + case 0x03: + /* Palette */ + mxverb(4, "palette"); + off+=2; + break; + case 0x04: + /* Alpha */ + mxverb(4, "alpha"); + off+=2; + break; + case 0x05: + mxverb(4, "coords"); + off+=6; + break; + case 0x06: + mxverb(4, "graphic lines"); + off+=4; + break; + case 0xff: + /* All done, bye-bye */ + mxverb(4, "done"); + return duration; + default: + mxverb(4, "unknown (0x%02x), skipping %d bytes.", type, + next_off - off); + unknown = true; + } + mxverb(4, "\n"); + if (unknown) + break; } - - if (data[i] <= 0x06) - len = lengths[data[i]]; - else - len = 0; - - if ((i + len) > packet_size) { - mxwarn(PFX "Warning: Wrong subpicture parameter blockending (i: %d, " - "len: %d, packet_size: %d, timecode: " FMT_TIMECODE ")n", i, len, - packet_size, TIMECODE); - break; - } - if (data[i] == 0x02) - return 1024 * t / 90; - i++; - } while ((i <= next_ctrlblk) && (i < packet_size)); - - return -1; + } + return duration; } #define deliver() deliver_packet(dst_buf, dst_size, timecode, duration);