From ccb05d396f591dc32e79c7d4ab92410c860102f6 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 16 Nov 2005 21:50:58 +0000 Subject: [PATCH] Refuse to append AVC/h.264 video tracks that do not have matching codec private blocks. Invalidates Anthill bug #163. --- ChangeLog | 6 ++++++ src/output/p_video.cpp | 25 +++++++++++++++++++++++++ src/output/p_video.h | 3 +++ 3 files changed, 34 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2049d029a..f0add51c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-11-16 Moritz Bunkus + + * mkvmerge: bug fix: mkvmerge will now refuse to append AVC/h.264 + video tracks whose codec initialization data blocks do not + match. Invalidates Anthill bug #163. + 2005-11-12 Moritz Bunkus * mkvmerge: bug fix: Fixed a crash If the granulepos (the diff --git a/src/output/p_video.cpp b/src/output/p_video.cpp index 09da4e791..d72c0a67e 100644 --- a/src/output/p_video.cpp +++ b/src/output/p_video.cpp @@ -779,3 +779,28 @@ mpeg4_p10_video_packetizer_c::process(packet_cptr packet) { return FILE_STATUS_MOREDATA; } +connection_result_e +mpeg4_p10_video_packetizer_c::can_connect_to(generic_packetizer_c *src, + string &error_message) { + connection_result_e result; + mpeg4_p10_video_packetizer_c *vsrc; + + vsrc = dynamic_cast(src); + if (NULL == vsrc) + return CAN_CONNECT_NO_FORMAT; + + result = video_packetizer_c::can_connect_to(src, error_message); + if (CAN_CONNECT_YES != result) + return result; + + if ((NULL != ti.private_data) && + memcmp(ti.private_data, vsrc->ti.private_data, ti.private_size)) { + error_message = mxsprintf("The codec's private data does not match." + "Both have the same length (%d) but different " + "content.", ti.private_size); + return CAN_CONNECT_NO_PARAMETERS; + } + + return CAN_CONNECT_YES; +} + diff --git a/src/output/p_video.h b/src/output/p_video.h index b24a68887..2e990e98b 100644 --- a/src/output/p_video.h +++ b/src/output/p_video.h @@ -108,6 +108,9 @@ public: track_info_c &_ti); virtual int process(packet_cptr packet); + virtual connection_result_e can_connect_to(generic_packetizer_c *src, + string &error_message); + protected: virtual void extract_aspect_ratio(); };