From 19d612a645f6fa72221890892df7f4d46c865f80 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sat, 30 Jun 2007 15:27:47 +0000 Subject: [PATCH] Some tools (e.g. Surcode) can create DTS files which are somehow padded with zero bytes. These zero bytes can and should be skipped without printing a warning. --- src/output/p_dts.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/output/p_dts.cpp b/src/output/p_dts.cpp index fc776a3d2..bb00255b8 100644 --- a/src/output/p_dts.cpp +++ b/src/output/p_dts.cpp @@ -130,10 +130,19 @@ dts_packetizer_c::get_dts_packet(dts_header_t &dtsheader) { return get_dts_packet(dtsheader); } - if (verbose && (pos > 0) && !skipping_is_normal) - mxwarn("dts_packetizer: skipping %d bytes (no valid DTS header " - "found). This might make audio/video go out of sync, but this " - "stream is damaged.\n", pos); + if (verbose && (0 < pos) && !skipping_is_normal) { + int i; + bool all_zeroes = true; + + for (i = 0; i < pos; ++i) + if (packet_buffer[i]) { + all_zeroes = false; + break; + } + + if (!all_zeroes) + mxwarn("dts_packetizer: skipping %d bytes (no valid DTS header found). This might make audio/video go out of sync, but this stream is damaged.\n", pos); + } buf = (unsigned char *)safememdup(packet_buffer + pos, dtsheader.frame_byte_size);