From 09dac958832542ac82ec1471574362cd338c9010 Mon Sep 17 00:00:00 2001 From: ajacoutot Date: Thu, 2 Jul 2015 08:30:24 +0000 Subject: [PATCH] Update to mkvtoolnix-8.1.0. from brad (maintainer) --- multimedia/mkvtoolnix/Makefile | 6 +- multimedia/mkvtoolnix/distinfo | 4 +- multimedia/mkvtoolnix/patches/patch-ac_qt5_m4 | 10 +- .../patch-src_mpegparser_M2VParser_cpp | 104 ++++++++++++++++++ .../patches/patch-src_mpegparser_M2VParser_h | 58 ++++++++++ 5 files changed, 172 insertions(+), 10 deletions(-) create mode 100644 multimedia/mkvtoolnix/patches/patch-src_mpegparser_M2VParser_cpp create mode 100644 multimedia/mkvtoolnix/patches/patch-src_mpegparser_M2VParser_h diff --git a/multimedia/mkvtoolnix/Makefile b/multimedia/mkvtoolnix/Makefile index d9be7436b82..d4a5689de06 100644 --- a/multimedia/mkvtoolnix/Makefile +++ b/multimedia/mkvtoolnix/Makefile @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile,v 1.37 2015/06/20 20:30:08 ajacoutot Exp $ +# $OpenBSD: Makefile,v 1.38 2015/07/02 08:30:24 ajacoutot Exp $ COMMENT= create, alter and inspect Matroska files -DISTNAME= mkvtoolnix-8.0.0 +DISTNAME= mkvtoolnix-8.1.0 CATEGORIES= multimedia x11 MASTER_SITES= ${HOMEPAGE}/sources/ EXTRACT_SUFX= .tar.xz @@ -58,7 +58,7 @@ FLAVOR?= CONFIGURE_ARGS+= --disable-gui .else MODULES+= x11/qt5 -WANTLIB+= Qt5Core Qt5Gui Qt5Widgets +WANTLIB+= Qt5Core Qt5Gui Qt5Network Qt5Widgets RUN_DEPENDS+= devel/desktop-file-utils \ misc/shared-mime-info \ x11/gtk+3,-guic diff --git a/multimedia/mkvtoolnix/distinfo b/multimedia/mkvtoolnix/distinfo index 6930fcdbfae..7ad0931135b 100644 --- a/multimedia/mkvtoolnix/distinfo +++ b/multimedia/mkvtoolnix/distinfo @@ -1,2 +1,2 @@ -SHA256 (mkvtoolnix-8.0.0.tar.xz) = LriYSzFkY5lbvoP334DibVlNp+s1osKNg1Wb8ZQlNao= -SIZE (mkvtoolnix-8.0.0.tar.xz) = 5760776 +SHA256 (mkvtoolnix-8.1.0.tar.xz) = cV2IQR4jhgwIVjnr3JFjtEmN9/MBaVg6mlcq3XK1cuU= +SIZE (mkvtoolnix-8.1.0.tar.xz) = 5784428 diff --git a/multimedia/mkvtoolnix/patches/patch-ac_qt5_m4 b/multimedia/mkvtoolnix/patches/patch-ac_qt5_m4 index 7775f9ef54e..2ad64a23af4 100644 --- a/multimedia/mkvtoolnix/patches/patch-ac_qt5_m4 +++ b/multimedia/mkvtoolnix/patches/patch-ac_qt5_m4 @@ -1,9 +1,9 @@ -$OpenBSD: patch-ac_qt5_m4,v 1.1 2015/05/27 21:18:48 ajacoutot Exp $ +$OpenBSD: patch-ac_qt5_m4,v 1.2 2015/07/02 08:30:25 ajacoutot Exp $ Workaround for OpenBSD's pkg-config. ---- ac/qt5.m4.orig Mon May 25 03:46:47 2015 -+++ ac/qt5.m4 Mon May 25 03:48:53 2015 +--- ac/qt5.m4.orig Sat Jun 27 02:44:45 2015 ++++ ac/qt5.m4 Thu Jul 2 02:11:28 2015 @@ -124,13 +124,12 @@ if test x"$enable_qt" = "xyes" -a \ fi @@ -13,8 +13,8 @@ Workaround for OpenBSD's pkg-config. - with_qt_pkg_config_modules="$with_qt_pkg_config_modules," + with_qt_pkg_config_modules="$with_qt_pkg_config_modules" fi -- with_qt_pkg_config_modules="$with_qt_pkg_config_modules,Qt5Core,Qt5Gui,Qt5Widgets" -+ with_qt_pkg_config_modules="$with_qt_pkg_config_modules Qt5Core Qt5Gui Qt5Widgets" +- with_qt_pkg_config_modules="$with_qt_pkg_config_modules,Qt5Core,Qt5Gui,Qt5Widgets,Qt5Network" ++ with_qt_pkg_config_modules="$with_qt_pkg_config_modules Qt5Core Qt5Gui Qt5Widgets Qt5Network" PKG_CHECK_EXISTS([$with_qt_pkg_config_modules],,[ok=0]) - PKG_CHECK_EXISTS([Qt5PlatformSupport],[with_qt_pkg_config_modules="$with_qt_pkg_config_modules,Qt5PlatformSupport"]) + PKG_CHECK_EXISTS([Qt5PlatformSupport],[with_qt_pkg_config_modules="$with_qt_pkg_config_modules Qt5PlatformSupport"]) diff --git a/multimedia/mkvtoolnix/patches/patch-src_mpegparser_M2VParser_cpp b/multimedia/mkvtoolnix/patches/patch-src_mpegparser_M2VParser_cpp new file mode 100644 index 00000000000..ae9c53bbcba --- /dev/null +++ b/multimedia/mkvtoolnix/patches/patch-src_mpegparser_M2VParser_cpp @@ -0,0 +1,104 @@ +$OpenBSD: patch-src_mpegparser_M2VParser_cpp,v 1.1 2015/07/02 08:30:25 ajacoutot Exp $ + +MPEG parser: don't use potentially dangling pointers for remembering timescodes + +--- src/mpegparser/M2VParser.cpp.orig Thu Jul 2 03:44:51 2015 ++++ src/mpegparser/M2VParser.cpp Thu Jul 2 03:56:35 2015 +@@ -27,12 +27,6 @@ + + #define BUFF_SIZE 2*1024*1024 + +-void MPEGFrameRef::TryUpdate(){ +- // if frame set, stamped and no timecode yet, derive it +- if (frame && frame->stamped && (timecode == -1)) +- timecode = frame->timecode; +-} +- + MPEGFrame::MPEGFrame(binary *n_data, uint32_t n_size, bool n_bCopy): + size(n_size), bCopy(n_bCopy) { + +@@ -111,7 +105,8 @@ void M2VParser::DumpQueues(){ + } + + M2VParser::M2VParser() +- : throwOnError{} ++ : frameCounter{} ++ , throwOnError{} + { + mpgBuf = new MPEGVideoBuffer(BUFF_SIZE); + +@@ -231,20 +226,21 @@ void M2VParser::StampFrame(MPEGFrame* frame){ + previousDuration = frame->duration; + + frame->stamped = true; ++ frameTimecodes[frame->frameNumber] = frame->timecode; + + // update affected ref timecodes + for (int i = 0; i < 2; i++) +- if (refs[i].frame == frame) +- refs[i].TryUpdate(); ++ if (refs[i].frameNumber == frame->frameNumber) ++ TryUpdate(refs[i]); + } + + void M2VParser::UpdateFrame(MPEGFrame* frame){ + // derive ref timecodes + for (int i = 0; i < 2; i++) { +- if (!frame->tmpRefs[i].frame) ++ if (!frame->tmpRefs[i].HasFrameNumber()) + continue; +- frame->tmpRefs[i].TryUpdate(); +- assert(frame->tmpRefs[i].timecode != -1); // ensure the timecode indeed has been set (sometime before) ++ TryUpdate(frame->tmpRefs[i]); ++ assert(frame->tmpRefs[i].HasTimecode()); // ensure the timecode indeed has been set (sometime before) + frame->refs[i] = frame->tmpRefs[i].timecode; + } + } +@@ -324,6 +320,7 @@ int32_t M2VParser::PrepareFrame(MPEGChunk* chunk, Medi + } + + outBuf = new MPEGFrame(pData, dataLen, bCopy); ++ outBuf->frameNumber = frameCounter++; + + if (seqHdrChunk && !keepSeqHdrsInBitstream && + (MPEG2_I_FRAME == picHdr.frameType)) { +@@ -368,7 +365,7 @@ void M2VParser::ShoveRef(MPEGFrame *ref){ + if(ref->frameType == 'I' || ref->frameType == 'P'){ + refs[0] = refs[1]; + refs[1].Clear(); +- refs[1].frame = ref; ++ refs[1].frameNumber = ref->frameNumber; + } + } + +@@ -441,12 +438,12 @@ int32_t M2VParser::FillQueues(){ + notReachedFirstGOP = false; + break; + case MPEG2_P_FRAME: +- if (!refs[1].frame) ++ if (!refs[1].HasFrameNumber()) + break; + PrepareFrame(chunk, myTime, picHdr); + break; + default: //B-frames +- if (!refs[0].frame || !refs[1].frame) { ++ if (!refs[0].HasFrameNumber() || !refs[1].HasFrameNumber()) { + if (!m_gopHdr.closedGOP && !m_gopHdr.brokenLink && !probing && !b_frame_warning_printed) { + mxwarn(Y("Found at least one B frame without second reference in a non closed GOP.\n")); + b_frame_warning_printed = true; +@@ -488,4 +485,15 @@ M2VParser::AddTimecode(int64_t timecode) { + void + M2VParser::SetThrowOnError(bool doThrow) { + throwOnError = doThrow; ++} ++ ++void ++M2VParser::TryUpdate(MPEGFrameRef &frame) { ++ // if frame set, stamped and no timecode yet, derive it ++ if (frame.HasTimecode() || !frame.HasFrameNumber()) ++ return; ++ ++ auto itr = frameTimecodes.find(frame.frameNumber); ++ if (itr != frameTimecodes.end()) ++ frame.timecode = itr->second; + } diff --git a/multimedia/mkvtoolnix/patches/patch-src_mpegparser_M2VParser_h b/multimedia/mkvtoolnix/patches/patch-src_mpegparser_M2VParser_h new file mode 100644 index 00000000000..2de63794912 --- /dev/null +++ b/multimedia/mkvtoolnix/patches/patch-src_mpegparser_M2VParser_h @@ -0,0 +1,58 @@ +$OpenBSD: patch-src_mpegparser_M2VParser_h,v 1.1 2015/07/02 08:30:25 ajacoutot Exp $ + +MPEG parser: don't use potentially dangling pointers for remembering timescodes + +--- src/mpegparser/M2VParser.h.orig Thu Jul 2 03:44:58 2015 ++++ src/mpegparser/M2VParser.h Thu Jul 2 03:49:17 2015 +@@ -39,17 +39,22 @@ enum MPEG2ParserState_e { + class MPEGFrame; + class MPEGFrameRef { + public: +- MPEGFrame *frame; ++ uint64_t frameNumber; + MediaTime timecode; + + MPEGFrameRef() { + Clear(); + } + void Clear() { +- frame = nullptr; +- timecode = -1; ++ frameNumber = std::numeric_limits::max(); ++ timecode = -1; + } +- void TryUpdate(); ++ bool HasFrameNumber() const { ++ return std::numeric_limits::max() != frameNumber; ++ } ++ bool HasTimecode() const { ++ return -1 != timecode; ++ } + }; + + class MPEGFrame { +@@ -71,6 +76,7 @@ class MPEGFrame { (public) + bool progressive; + uint8_t pictureStructure; + bool bCopy; ++ uint64_t frameNumber; + + MPEGFrame(binary* data, uint32_t size, bool bCopy); + ~MPEGFrame(); +@@ -81,6 +87,8 @@ class M2VParser { (private) + std::vector chunks; //Hold the chunks until we can order them + std::vector waitQueue; //Holds unstamped buffers until we can stamp them. + std::queue buffers; //Holds stamped buffers until they are requested. ++ std::unordered_map frameTimecodes; ++ uint64_t frameCounter; + MediaTime previousTimecode; + MediaTime previousDuration; + //Added to allow reading the header's raw data, contains first found seq hdr. +@@ -169,6 +177,7 @@ class M2VParser { (private) + void SetThrowOnError(bool doThrow); + + void TimestampWaitingFrames(); ++ void TryUpdate(MPEGFrameRef &frame); + }; + +