more icons from sam, --with-git-ffmpeg=url
authorGood Guy <good1.2guy@gmail.com>
Sun, 15 Oct 2017 00:21:49 +0000 (18:21 -0600)
committerGood Guy <good1.2guy@gmail.com>
Sun, 15 Oct 2017 00:21:49 +0000 (18:21 -0600)
50 files changed:
cinelerra-5.1/configure.ac
cinelerra-5.1/ffmpeg/plugin.opts
cinelerra-5.1/picon_cinfinity/ff_atadenoise.png
cinelerra-5.1/picon_cinfinity/ff_bwdif.png
cinelerra-5.1/picon_cinfinity/ff_colormatrix.png
cinelerra-5.1/picon_cinfinity/ff_crop.png
cinelerra-5.1/picon_cinfinity/ff_cropdetect.png
cinelerra-5.1/picon_cinfinity/ff_deflate.png
cinelerra-5.1/picon_cinfinity/ff_dilation.png
cinelerra-5.1/picon_cinfinity/ff_fade.png
cinelerra-5.1/picon_cinfinity/ff_field.png
cinelerra-5.1/picon_cinfinity/ff_fieldorder.png
cinelerra-5.1/picon_cinfinity/ff_idet.png
cinelerra-5.1/picon_cinfinity/ff_il.png
cinelerra-5.1/picon_cinfinity/ff_inflate.png
cinelerra-5.1/picon_cinfinity/ff_lenscorrection.png
cinelerra-5.1/picon_cinfinity/ff_loop.png
cinelerra-5.1/picon_cinfinity/ff_lut.png
cinelerra-5.1/picon_cinfinity/ff_mcdeint.png
cinelerra-5.1/picon_cinfinity/ff_negate.png
cinelerra-5.1/picon_cinfinity/ff_owdenoise.png
cinelerra-5.1/picon_cinfinity/ff_phase.png
cinelerra-5.1/picon_cinfinity/ff_pp7.png
cinelerra-5.1/picon_cinfinity/ff_removegrain.png
cinelerra-5.1/picon_cinfinity/ff_repeatfields.png
cinelerra-5.1/picon_cinfinity/ff_separatefields.png
cinelerra-5.1/picon_cinfinity/ff_shuffleframes.png
cinelerra-5.1/picon_cinfinity/ff_spp.png
cinelerra-5.1/picon_cinfinity/ff_stereo3d.png
cinelerra-5.1/picon_cinfinity/ff_tinterlace.png
cinelerra-5.1/picon_cinfinity/ff_uspp.png
cinelerra-5.1/picon_cinfinity/ff_vaguedenoiser.png
cinelerra-5.1/plugins/decimate/picon_cinfinity.png
cinelerra-5.1/plugins/fieldframe/picon_cinfinity.png
cinelerra-5.1/plugins/framefield/picon_cinfinity.png
cinelerra-5.1/plugins/swapframes/picon_cinfinity.png
cinelerra-5.1/thirdparty/Makefile
cinelerra-5.1/thirdparty/src/a52dec-0.7.4.patch1 [moved from cinelerra-5.1/thirdparty/src/a52dec.patch1 with 100% similarity]
cinelerra-5.1/thirdparty/src/djbfft-0.76.patch1 [moved from cinelerra-5.1/thirdparty/src/djbfft.patch1 with 100% similarity]
cinelerra-5.1/thirdparty/src/encore-5.0.patch1 [moved from cinelerra-5.1/thirdparty/src/encore.patch1 with 100% similarity]
cinelerra-5.1/thirdparty/src/ffmpeg-3.3.4.patch1 [moved from cinelerra-5.1/thirdparty/src/ffmpeg.patch1 with 100% similarity]
cinelerra-5.1/thirdparty/src/ffmpeg-3.3.4.patch2 [moved from cinelerra-5.1/thirdparty/src/ffmpeg.patch2 with 100% similarity]
cinelerra-5.1/thirdparty/src/ffmpeg-3.3.4.patch4 [moved from cinelerra-5.1/thirdparty/src/ffmpeg.patch4 with 100% similarity]
cinelerra-5.1/thirdparty/src/ffmpeg-3.3.4.patch5 [moved from cinelerra-5.1/thirdparty/src/ffmpeg.patch5 with 100% similarity]
cinelerra-5.1/thirdparty/src/ffmpeg.git.patch1 [new file with mode: 0644]
cinelerra-5.1/thirdparty/src/ffmpeg.git.patch2 [new file with mode: 0644]
cinelerra-5.1/thirdparty/src/ffmpeg.git.patch3 [new file with mode: 0644]
cinelerra-5.1/thirdparty/src/mjpegtools-2.1.0.patch1 [moved from cinelerra-5.1/thirdparty/src/mjpegtools.patch1 with 100% similarity]
cinelerra-5.1/thirdparty/src/mjpegtools-2.1.0.patch2 [moved from cinelerra-5.1/thirdparty/src/mjpegtools.patch2 with 100% similarity]
cinelerra-5.1/thirdparty/src/x264-snapshot-20170426-2245.patch1 [moved from cinelerra-5.1/thirdparty/src/x264.patch1 with 100% similarity]

index 7ba17ed63dba0304a9412abb0da8e8c21d632a95..9d54bc7dab7e7b9b26d68a6884312ba3839dd51c 100644 (file)
@@ -9,7 +9,7 @@ AC_LANG_C
 AC_PROG_CXX
 
 CFG_CFLAGS+=" -fno-omit-frame-pointer -fno-math-errno -fno-signed-zeros"
-CFG_CFLAGS+=" -pthread -Wall -Wno-unused-result"
+CFG_CFLAGS+=" -pthread -Wall -Wno-unused-result -Wno-format-truncation"
 CFG_CFLAGS+=" -D__STDC_CONSTANT_MACROS"
 CFG_CFLAGS+=" -D__STDC_LIMIT_MACROS"
 CFG_CFLAGS+=" -DPNG_SKIP_SETJMP_CHECK=1"
@@ -33,6 +33,7 @@ CHECK_WITH([plugin-dir],[plugin install dir],[PLUGIN_DIR],[auto])
 CHECK_WITH([ladspa-dir],[ladspa install dir],[LADSPA_DIR],[auto])
 CHECK_WITH([config-dir],[.bcast config dir],[CONFIG_DIR],[$$HOME/.bcast5])
 CHECK_WITH([browser],[cin_browser path],[CIN_BROWSER],[firefox])
+CHECK_WITH([git-ffmpeg],[git ffmpeg using url],[GIT_FFMPEG],[no])
 
 if test "x$WANT_CINBIN_BUILD" = "xyes"; then
   WANT_LOCALE_DIR='$$CIN_LIB/locale'
@@ -136,6 +137,10 @@ PKG_3RD([ffmpeg],[yes],
     libswresample/libswresample.a ],
   [ . ])
 
+if test "x$WANT_GIT_FFMPEG" != "xno" ; then
+  ver_ffmpeg="ffmpeg.git"
+fi
+
 PKG_3RD([fftw],[auto],
   [fftw-3.3.6-pl2],
   [ .libs/libfftw3.a \
@@ -684,6 +689,7 @@ echo "  using: with-browser = $WANT_CIN_BROWSER"
 echo "  using: with-plugin-dir = $WANT_PLUGIN_DIR"
 echo "  using: with-ladspa-dir = $WANT_LADSPA_DIR"
 echo "  using: with-opencv = $WANT_OPENCV"
+echo "  using: with-git-ffmpeg = $WANT_GIT_FFMPEG"
 echo ""
 echo "  using: single-user  = $WANT_CINBIN_BUILD"
 echo "  using: static-build = $WANT_STATIC_BUILD"
@@ -826,3 +832,6 @@ if test "x$HAVE_tiff" = "xyes"; then
   fi
 fi
 
+if test "x$WANT_GIT_FFMPEG" != "xno"; then
+echo "ffmpeg.git := $WANT_GIT_FFMPEG"
+fi
index b8f9c6d195bf64259d0e92910f9c6a43339a7531..aea62b6aed19da1ca15fb00089b3f4dcf5128b56 100644 (file)
@@ -302,3 +302,8 @@ xbr
 yadif
 #yuvtestsrc
 zoompan
+; in git
+#afir
+#headphone
+#convolve
+#unpremultiply
index dbf5f65c4a31484ed6af73ddb029a8663e2fd19e..f05d33c66fd8739d343fda40b852154d3dda1d07 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_atadenoise.png and b/cinelerra-5.1/picon_cinfinity/ff_atadenoise.png differ
index 42ae4a8365493daaba75624731dabc7f86f39067..4f6a67233e1071194c4981f0133d047060c61aab 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_bwdif.png and b/cinelerra-5.1/picon_cinfinity/ff_bwdif.png differ
index 0c659f674f8b711698a5567e50b20bcd8dcd41d6..7d5f7edce63bc44f2708b6bddbd49819c8b38b25 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_colormatrix.png and b/cinelerra-5.1/picon_cinfinity/ff_colormatrix.png differ
index 626f8fc9c010936d9d8ddb0680b0ab374f89adec..8c67bb5847895d82371e110dae711a143012b154 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_crop.png and b/cinelerra-5.1/picon_cinfinity/ff_crop.png differ
index 32bb792cadd995b9c313a4d7f94c610ac58a5d5b..83c1b842a9f67b44d55f8955a3ebe16d7689dc77 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_cropdetect.png and b/cinelerra-5.1/picon_cinfinity/ff_cropdetect.png differ
index 7238f071416ecdb44934d229a82bcb2ca4ffeca0..fa0abdb19eb3eb1ccbc28c05bd9bed53d44336be 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_deflate.png and b/cinelerra-5.1/picon_cinfinity/ff_deflate.png differ
index efdef38459f9d662bf06d171294684109ff79d95..90772746ec3fcea8019b08bebd11e322d5e59774 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_dilation.png and b/cinelerra-5.1/picon_cinfinity/ff_dilation.png differ
index cfc83aea2abe3e15673d622e0d71ce467de1712c..53b1756e9bcd563aeb7390c465c9bb44a85534d2 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_fade.png and b/cinelerra-5.1/picon_cinfinity/ff_fade.png differ
index efa6244a88b21c8d896c1fa8f42c96bb2b850a0b..4b6baf141560d660807d6160f2f8dbc224c49ac5 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_field.png and b/cinelerra-5.1/picon_cinfinity/ff_field.png differ
index 3fa5722aa74bd709bd353626988c3f42cb4480f4..30d7675708a6c9f18b01cab76ca421d6581364cf 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_fieldorder.png and b/cinelerra-5.1/picon_cinfinity/ff_fieldorder.png differ
index 56922e04b202b5ab28f0eaf6114d2faed5893280..0f53640dca3e3d9f54375c737133315edf3a7a9e 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_idet.png and b/cinelerra-5.1/picon_cinfinity/ff_idet.png differ
index 51878bcc9c5fce23885c078ebcba9a4ffa7d60ab..e0f2584e4b75478eb5c0ee0689b7652129b8d240 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_il.png and b/cinelerra-5.1/picon_cinfinity/ff_il.png differ
index f508048daada2d304486b6b8037a696215745371..5871317d25f69b53db1e9ebffecb55b38c7c1ca4 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_inflate.png and b/cinelerra-5.1/picon_cinfinity/ff_inflate.png differ
index b1c6ec0971d578dce036d86dd8165dd01b98d70a..c3ecb62534e0afc5c55f26cd5dddbc9d4ca7f53e 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_lenscorrection.png and b/cinelerra-5.1/picon_cinfinity/ff_lenscorrection.png differ
index 51ce35962ffb4a22038f9ecb7fbb49072abecc80..fbeef72c8c7120ecebab6381df1b065f78826cab 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_loop.png and b/cinelerra-5.1/picon_cinfinity/ff_loop.png differ
index ed8dd063813c76bb24d87e95c8c470428351d82e..ac84570ec1bb779288bec562a7067b8b9e4183e0 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_lut.png and b/cinelerra-5.1/picon_cinfinity/ff_lut.png differ
index 7dbdf2356d9c806b78ad2441c757eb849545de27..64bfa9f32573acb51a9619bfb1ddaf480c1137c2 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_mcdeint.png and b/cinelerra-5.1/picon_cinfinity/ff_mcdeint.png differ
index 4b27562ea006757e72316d3aaf5ae5fea3643326..ae0d8b6fd4789a137c11663b86fe2b11d48ea8b9 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_negate.png and b/cinelerra-5.1/picon_cinfinity/ff_negate.png differ
index 81890ea1ae4e01aad79cc643cda0bf276fbf77a7..d2ceb2e46a11fbec2c9d4be299cf5827eb439be6 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_owdenoise.png and b/cinelerra-5.1/picon_cinfinity/ff_owdenoise.png differ
index b1804adf718620318f9d3549e786bf3e6665117c..667e4ea2894019c9b1c1f468584a4a6c8bca8f20 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_phase.png and b/cinelerra-5.1/picon_cinfinity/ff_phase.png differ
index b0a726896e066af196fd264fa78f918cea4e5738..eb8203094ec6db5a53778f5f3a9c48cb653cb983 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_pp7.png and b/cinelerra-5.1/picon_cinfinity/ff_pp7.png differ
index f386af46a9a82b58bd01e35c94b00b09803f8380..7cfded8e5000f6125b857cb536232f89fa9af6eb 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_removegrain.png and b/cinelerra-5.1/picon_cinfinity/ff_removegrain.png differ
index 5be755ffe84d01f422b8ccb8dfd73886f73faecc..52f1ce627c4f8fa10007551f168ffc1287e7ca25 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_repeatfields.png and b/cinelerra-5.1/picon_cinfinity/ff_repeatfields.png differ
index dd92314099b6e75ffc70634bcb8a684e51bf7137..169771e71365841665f2ebc7e4a7d9828984b4c4 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_separatefields.png and b/cinelerra-5.1/picon_cinfinity/ff_separatefields.png differ
index acba03bf8fa4daa510386d934f4b67bf5c7b8765..a763baa46640f24cd6fbe7ad61a808289a1a6a8b 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_shuffleframes.png and b/cinelerra-5.1/picon_cinfinity/ff_shuffleframes.png differ
index a95c2554f71943ea83e39ab4e03194ffc07ceee7..f265da02992365c29f545e28a26e13c2b9df7a23 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_spp.png and b/cinelerra-5.1/picon_cinfinity/ff_spp.png differ
index 1ba8550ae125baa0745588dc2166a467c95e7d08..a0d8b2d9374dd1f3b4c504eb3fbc1013d83b80a8 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_stereo3d.png and b/cinelerra-5.1/picon_cinfinity/ff_stereo3d.png differ
index 4f54ef853eda23dc6e0d1f80e66a6b6a47c071ad..74def23f447cf141ed0dff7a67af8005424c191e 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_tinterlace.png and b/cinelerra-5.1/picon_cinfinity/ff_tinterlace.png differ
index 1d13779a8b2129770967f1da7392b084204eb623..bc77f6ae8afd2126323fc3dcebc4ad4353556b26 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_uspp.png and b/cinelerra-5.1/picon_cinfinity/ff_uspp.png differ
index 583e9c2e19bede5ec6971a500ffed1c82d2b784f..98d9ed63430c5f072a6462b0816037d273c7b2ce 100644 (file)
Binary files a/cinelerra-5.1/picon_cinfinity/ff_vaguedenoiser.png and b/cinelerra-5.1/picon_cinfinity/ff_vaguedenoiser.png differ
index 556741219e3b2719c170bcfcb4bbf3f30f87bf20..12a5a4a23fcd01386e61a64a80079edbfcb00e64 100644 (file)
Binary files a/cinelerra-5.1/plugins/decimate/picon_cinfinity.png and b/cinelerra-5.1/plugins/decimate/picon_cinfinity.png differ
index cdc77885ebcd3ec739353200ec94b5108d496bf3..59a4a696be999b9513a53e82f761955a4eaad7d8 100644 (file)
Binary files a/cinelerra-5.1/plugins/fieldframe/picon_cinfinity.png and b/cinelerra-5.1/plugins/fieldframe/picon_cinfinity.png differ
index f8c5049562662de13e1e2689e2d454189032a456..17ae87237ba96eceff311251b8730c68fd4c9eed 100644 (file)
Binary files a/cinelerra-5.1/plugins/framefield/picon_cinfinity.png and b/cinelerra-5.1/plugins/framefield/picon_cinfinity.png differ
index e2508f75df352d6897aace608c71be7700238bc7..377345a142b7aa5e34366249e986f26595b3364f 100644 (file)
Binary files a/cinelerra-5.1/plugins/swapframes/picon_cinfinity.png and b/cinelerra-5.1/plugins/swapframes/picon_cinfinity.png differ
index 4b220efdc16eaf90aeb4aec04af55fa8edee588c..4d3c1457e44db3d1af2906373afa597598275d69 100644 (file)
@@ -42,15 +42,16 @@ pkg-config=$(BLD)/$(1).configure
 pkg-built=$(BLD)/$(1).built
 
 ext=$(lastword $(subst ., ,$(1)))
-tarball=$(lastword $(sort $(wildcard src/$(1)*.tar.*)))
+tarball=$(if $($(1).git),$(1).git,$(lastword $(sort $(wildcard src/$(1)*.tar.*))))
 unpack=$(call unpack_$(call ext,$(1)),$(1))
+unpack_git=git clone $($(1)) $(1)
 unpack_gz=tar -xzf $(1)
 unpack_bz2=tar -xjf $(1)
 unpack_xz=tar -xJf $(1)
 bld_depends=$(if $(ver_$(1)),$(call pkg-built,$(1)))
 bld_path=$(ver_$(1))/$(2)
 inc_path=$(inc_$(1))
-ld_path=$(if $(ver_$(1)),-L$(call bld_path,$(1),$(2)))
+ld_path=$(if $(ver_$(1)),-L$(call bld_path,$(1),$(2)) $(lib_$(1)))
 
 #$(eval $(call std-build,pkg,deps...))
 #$(pkg.cflags) added as CFLAGS+=$(cflags) to pkg.vars
@@ -71,7 +72,7 @@ $(1)-clean:
 
 $(call pkg-source,$(1)):
        $(call unpack,$(call tarball,$(1))) \
-       $(foreach pch,$(sort $(wildcard src/$(1).patch*)),
+       $(foreach pch,$(sort $(wildcard src/$(notdir $(ver_$(1))).patch*)),
                patch -d $(1)* -p1 < $(pch))
        touch $$@
 
@@ -129,6 +130,7 @@ ffmpeg.cfg_params= \
                $(call inc_path,twolame,libtwolame) \
                $(call inc_path,lame,include) \
                $(call inc_path,openjpeg,src/lib/openjp2) \
+               $(call inc_path,libogg,include) \
                $(call inc_path,libvorbis,include) \
                $(call inc_path,libtheora,include) \
                $(call inc_path,libvpx) \
@@ -140,18 +142,19 @@ ffmpeg.cfg_params= \
                $(call inc_path,fdk,libSYS) \
                $(call inc_path,fdk,libSYS/include)" \
        --extra-cxxflags="-D__STDC_CONSTANT_MACROS" \
-       --extra-libs="\
-               $(call ld_path,faad2,libfaad/.libs) \
-               $(call ld_path,faac,libfaac/.libs) \
+       --pkg-config=true \
+       --extra-libs="-Wl,--start-group \
                $(call ld_path,twolame,libtwolame/.libs) \
                $(call ld_path,lame,libmp3lame/.libs) \
                $(call ld_path,openjpeg,bin) \
+               $(call ld_path,libogg,lib/.libs) \
                $(call ld_path,libvorbis,lib/.libs) \
                $(call ld_path,libtheora,lib/.libs) \
                $(call ld_path,libvpx) \
                $(call ld_path,x264) \
                $(call ld_path,x265) \
                $(call ld_path,fdk,.libs) \
+               -Wl,--end-group -lm -lstdc++ -pthread \
                $(EXTRA_LIBS)" $(FFMPEG_EXTRA_CFG) \
 
 cmake_config=echo "exec cmake \$$$$@ $(1)" > ./configure; chmod +x ./configure;
diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg.git.patch1 b/cinelerra-5.1/thirdparty/src/ffmpeg.git.patch1
new file mode 100644 (file)
index 0000000..2e9797e
--- /dev/null
@@ -0,0 +1,12 @@
+diff -ur a/libavformat/bluray.c b/libavformat/bluray.c
+--- a/libavformat/bluray.c     2017-10-13 16:31:25.000000000 -0600
++++ b/libavformat/bluray.c     2017-10-13 20:05:45.910046165 -0600
+@@ -28,7 +28,7 @@
+ #include "libavutil/opt.h"
+ #define BLURAY_PROTO_PREFIX     "bluray:"
+-#define MIN_PLAYLIST_LENGTH     180     /* 3 min */
++#define MIN_PLAYLIST_LENGTH     0
+ typedef struct {
+     const AVClass *class;
diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg.git.patch2 b/cinelerra-5.1/thirdparty/src/ffmpeg.git.patch2
new file mode 100644 (file)
index 0000000..fac1164
--- /dev/null
@@ -0,0 +1,499 @@
+diff -ur a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
+--- a/libavformat/mpegtsenc.c  2017-10-13 16:31:25.000000000 -0600
++++ b/libavformat/mpegtsenc.c  2017-10-13 20:06:27.930649088 -0600
+@@ -56,9 +56,8 @@
+     int sid;           /* service ID */
+     char *name;
+     char *provider_name;
+-    int pcr_pid;
+-    int pcr_packet_count;
+-    int pcr_packet_period;
++    int64_t pcr, pcr_packet_timer, pcr_packet_period;
++    int pcr_sid, pcr_pid;
+     AVProgram *program;
+ } MpegTSService;
+@@ -78,14 +77,12 @@
+     MpegTSSection pat; /* MPEG-2 PAT table */
+     MpegTSSection sdt; /* MPEG-2 SDT table context */
+     MpegTSService **services;
+-    int sdt_packet_count;
+-    int sdt_packet_period;
+-    int pat_packet_count;
+-    int pat_packet_period;
++    int64_t sdt_packet_timer, sdt_packet_period;
++    int64_t pat_packet_timer, pat_packet_period;
+     int nb_services;
+     int onid;
+     int tsid;
+-    int64_t first_pcr;
++    int64_t pcr, first_pcr, delay;
+     int mux_rate; ///< set to 1 when VBR
+     int pes_payload_size;
+@@ -95,12 +92,14 @@
+     int service_type;
+     int pmt_start_pid;
++    int pcr_start_pid;
+     int start_pid;
+     int m2ts_mode;
++    int64_t ts_offset;
+     int reemit_pat_pmt; // backward compatibility
+-    int pcr_period;
++    double pcr_period;
+ #define MPEGTS_FLAG_REEMIT_PAT_PMT  0x01
+ #define MPEGTS_FLAG_AAC_LATM        0x02
+ #define MPEGTS_FLAG_PAT_PMT_AT_FRAMES           0x04
+@@ -111,8 +110,6 @@
+     int tables_version;
+     double pat_period;
+     double sdt_period;
+-    int64_t last_pat_ts;
+-    int64_t last_sdt_ts;
+     int omit_video_pes_length;
+ } MpegTSWrite;
+@@ -222,10 +219,10 @@
+ #define DEFAULT_PROVIDER_NAME   "FFmpeg"
+ #define DEFAULT_SERVICE_NAME    "Service01"
+-/* we retransmit the SI info at this rate */
++/* we retransmit the SI info at this rate (ms) */
+ #define SDT_RETRANS_TIME 500
+ #define PAT_RETRANS_TIME 100
+-#define PCR_RETRANS_TIME 20
++#define PCR_RETRANS_TIME 50
+ typedef struct MpegTSWriteStream {
+     struct MpegTSService *service;
+@@ -721,6 +718,7 @@
+     service->pmt.pid       = ts->pmt_start_pid + ts->nb_services;
+     service->sid           = sid;
+     service->pcr_pid       = 0x1fff;
++    service->pcr_sid       = 0x1fff;
+     service->provider_name = av_strdup(provider_name);
+     service->name          = av_strdup(name);
+     if (!service->provider_name || !service->name)
+@@ -736,18 +734,11 @@
+     return NULL;
+ }
+-static int64_t get_pcr(const MpegTSWrite *ts, AVIOContext *pb)
+-{
+-    return av_rescale(avio_tell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) +
+-           ts->first_pcr;
+-}
+-
+ static void mpegts_prefix_m2ts_header(AVFormatContext *s)
+ {
+     MpegTSWrite *ts = s->priv_data;
+     if (ts->m2ts_mode) {
+-        int64_t pcr = get_pcr(s->priv_data, s->pb);
+-        uint32_t tp_extra_header = pcr % 0x3fffffff;
++        uint32_t tp_extra_header = ts->pcr % 0x3fffffff;
+         tp_extra_header = AV_RB32(&tp_extra_header);
+         avio_write(s->pb, (unsigned char *) &tp_extra_header,
+                    sizeof(tp_extra_header));
+@@ -768,6 +759,7 @@
+     MpegTSService *service;
+     AVStream *st, *pcr_st = NULL;
+     AVDictionaryEntry *title, *provider;
++    double clk_rate;
+     int i, j;
+     const char *service_name;
+     const char *provider_name;
+@@ -776,6 +768,15 @@
+     if (s->max_delay < 0) /* Not set by the caller */
+         s->max_delay = 0;
++    ts->delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE);
++
++    if (ts->m2ts_mode == -1) {
++        if (av_match_ext(s->filename, "m2ts")) {
++            ts->m2ts_mode = 1;
++        } else {
++            ts->m2ts_mode = 0;
++        }
++    }
+     // round up to a whole number of TS packets
+     ts->pes_payload_size = (ts->pes_payload_size + 14 + 183) / 184 * 184 - 14;
+@@ -822,6 +823,8 @@
+             service->program          = program;
+         }
+     }
++    if (ts->m2ts_mode > 1)
++        service->pmt.pid = 0x00ff + ts->service_id;
+     ts->pat.pid          = PAT_PID;
+     /* Initialize at 15 so that it wraps and is equal to 0 for the
+@@ -907,10 +910,9 @@
+         ts_st->discontinuity   = ts->flags & MPEGTS_FLAG_DISCONT;
+         /* update PCR pid by using the first video stream */
+         if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
+-            service->pcr_pid == 0x1fff) {
+-            service->pcr_pid = ts_st->pid;
++            service->pcr_sid == 0x1fff)
+             pcr_st           = st;
+-        }
++
+         if (st->codecpar->codec_id == AV_CODEC_ID_AAC &&
+             st->codecpar->extradata_size > 0) {
+             AVStream *ast;
+@@ -946,78 +948,47 @@
+     av_freep(&pids);
+     /* if no video stream, use the first stream as PCR */
+-    if (service->pcr_pid == 0x1fff && s->nb_streams > 0) {
+-        pcr_st           = s->streams[0];
+-        ts_st            = pcr_st->priv_data;
+-        service->pcr_pid = ts_st->pid;
+-    } else
+-        ts_st = pcr_st->priv_data;
+-
+-    if (ts->mux_rate > 1) {
+-        service->pcr_packet_period = (int64_t)ts->mux_rate * ts->pcr_period /
+-                                     (TS_PACKET_SIZE * 8 * 1000);
+-        ts->sdt_packet_period      = (int64_t)ts->mux_rate * SDT_RETRANS_TIME /
+-                                     (TS_PACKET_SIZE * 8 * 1000);
+-        ts->pat_packet_period      = (int64_t)ts->mux_rate * PAT_RETRANS_TIME /
+-                                     (TS_PACKET_SIZE * 8 * 1000);
+-
+-        if (ts->copyts < 1)
+-            ts->first_pcr = av_rescale(s->max_delay, PCR_TIME_BASE, AV_TIME_BASE);
+-    } else {
+-        /* Arbitrary values, PAT/PMT will also be written on video key frames */
+-        ts->sdt_packet_period = 200;
+-        ts->pat_packet_period = 40;
+-        if (pcr_st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
+-            int frame_size = av_get_audio_frame_duration2(pcr_st->codecpar, 0);
+-            if (!frame_size) {
+-                av_log(s, AV_LOG_WARNING, "frame size not set\n");
+-                service->pcr_packet_period =
+-                    pcr_st->codecpar->sample_rate / (10 * 512);
+-            } else {
+-                service->pcr_packet_period =
+-                    pcr_st->codecpar->sample_rate / (10 * frame_size);
+-            }
+-        } else {
+-            // max delta PCR 0.1s
+-            // TODO: should be avg_frame_rate
+-            service->pcr_packet_period =
+-                ts_st->user_tb.den / (10 * ts_st->user_tb.num);
+-        }
+-        if (!service->pcr_packet_period)
+-            service->pcr_packet_period = 1;
+-    }
+-
+-    ts->last_pat_ts = AV_NOPTS_VALUE;
+-    ts->last_sdt_ts = AV_NOPTS_VALUE;
+-    // The user specified a period, use only it
+-    if (ts->pat_period < INT_MAX/2) {
+-        ts->pat_packet_period = INT_MAX;
++    if (!pcr_st && s->nb_streams > 0)
++        pcr_st = s->streams[0];
++    if (!pcr_st) {
++        av_log(s, AV_LOG_ERROR, "no streams\n");
++        ret = AVERROR(EINVAL);
++        goto fail;
+     }
+-    if (ts->sdt_period < INT_MAX/2) {
+-        ts->sdt_packet_period = INT_MAX;
++    ts_st  = pcr_st->priv_data;
++    if (service->pcr_sid == 0x1fff)
++        service->pcr_sid   = ts_st->pid;
++    if (service->pcr_pid == 0x1fff)
++        service->pcr_pid   = ts->m2ts_mode > 1 ?
++            0x1000 + ts->service_id : service->pcr_sid ;
++    if (service->pmt.pid == service->pcr_pid) {
++        av_log(s, AV_LOG_ERROR, "Duplicate stream id %d\n", service->pcr_pid);
++        ret = AVERROR(EINVAL);
++        goto fail;
+     }
++    clk_rate = ts->mux_rate > 1 ? ts->mux_rate : PCR_TIME_BASE;
++    ts->sdt_packet_period      = ts->sdt_period < 0 ? -1 : ts->sdt_period/1000 * clk_rate;
++    ts->pat_packet_period      = ts->pat_period/1000 * clk_rate;
++    service->pcr_packet_period = ts->pcr_period/1000 * clk_rate;
++    if (service->pcr_packet_period < (TS_PACKET_SIZE*8*10))
++        service->pcr_packet_period = (TS_PACKET_SIZE*8*10);
++    av_log(s, AV_LOG_VERBOSE, "clk_rate %f: ticks/pkt %d pcr, %d sdt, %d pmt\n", clk_rate,
++        (int)service->pcr_packet_period, (int)ts->sdt_packet_period, (int)ts->pat_packet_period);
++
++    if (ts->copyts < 1)
++        ts->first_pcr = av_rescale(s->max_delay, PCR_TIME_BASE, AV_TIME_BASE);
++
+     // output a PCR as soon as possible
+-    service->pcr_packet_count = service->pcr_packet_period;
+-    ts->pat_packet_count      = ts->pat_packet_period - 1;
+-    ts->sdt_packet_count      = ts->sdt_packet_period - 1;
++    ts->pcr = 0;
++    service->pcr_packet_timer = 0;
++    ts->pat_packet_timer      = 0;
++    ts->sdt_packet_timer      = 0;
+     if (ts->mux_rate == 1)
+         av_log(s, AV_LOG_VERBOSE, "muxrate VBR, ");
+     else
+         av_log(s, AV_LOG_VERBOSE, "muxrate %d, ", ts->mux_rate);
+-    av_log(s, AV_LOG_VERBOSE,
+-           "pcr every %d pkts, sdt every %d, pat/pmt every %d pkts\n",
+-           service->pcr_packet_period,
+-           ts->sdt_packet_period, ts->pat_packet_period);
+-
+-    if (ts->m2ts_mode == -1) {
+-        if (av_match_ext(s->filename, "m2ts")) {
+-            ts->m2ts_mode = 1;
+-        } else {
+-            ts->m2ts_mode = 0;
+-        }
+-    }
+     return 0;
+@@ -1032,22 +1003,12 @@
+     MpegTSWrite *ts = s->priv_data;
+     int i;
+-    if (++ts->sdt_packet_count == ts->sdt_packet_period ||
+-        (dts != AV_NOPTS_VALUE && ts->last_sdt_ts == AV_NOPTS_VALUE) ||
+-        (dts != AV_NOPTS_VALUE && dts - ts->last_sdt_ts >= ts->sdt_period*90000.0)
+-    ) {
+-        ts->sdt_packet_count = 0;
+-        if (dts != AV_NOPTS_VALUE)
+-            ts->last_sdt_ts = FFMAX(dts, ts->last_sdt_ts);
++    if ( ts->sdt_packet_period >= 0 && ts->pcr >= ts->sdt_packet_timer ) {
++        ts->sdt_packet_timer = ts->pcr + ts->sdt_packet_period;
+         mpegts_write_sdt(s);
+     }
+-    if (++ts->pat_packet_count == ts->pat_packet_period ||
+-        (dts != AV_NOPTS_VALUE && ts->last_pat_ts == AV_NOPTS_VALUE) ||
+-        (dts != AV_NOPTS_VALUE && dts - ts->last_pat_ts >= ts->pat_period*90000.0) ||
+-        force_pat) {
+-        ts->pat_packet_count = 0;
+-        if (dts != AV_NOPTS_VALUE)
+-            ts->last_pat_ts = FFMAX(dts, ts->last_pat_ts);
++    if (ts->pcr >= ts->pat_packet_timer || force_pat) {
++        ts->pat_packet_timer = ts->pcr + ts->pat_packet_period;
+         mpegts_write_pat(s);
+         for (i = 0; i < ts->nb_services; i++)
+             mpegts_write_pmt(s, ts->services[i]);
+@@ -1089,13 +1050,14 @@
+ {
+     MpegTSWrite *ts = s->priv_data;
+     MpegTSWriteStream *ts_st = st->priv_data;
++    uint32_t pcr_pid = ts_st->service->pcr_pid;
+     uint8_t *q;
+     uint8_t buf[TS_PACKET_SIZE];
+     q    = buf;
+     *q++ = 0x47;
+-    *q++ = ts_st->pid >> 8;
+-    *q++ = ts_st->pid;
++    *q++ = pcr_pid >> 8;
++    *q++ = pcr_pid;
+     *q++ = 0x20 | ts_st->cc;   /* Adaptation only */
+     /* Continuity Count field does not increment (see 13818-1 section 2.4.3.3) */
+     *q++ = TS_PACKET_SIZE - 5; /* Adaptation Field Length */
+@@ -1106,7 +1068,7 @@
+     }
+     /* PCR coded into 6 bytes */
+-    q += write_pcr_bits(q, get_pcr(ts, s->pb));
++    q += write_pcr_bits(q, ts->pcr);
+     /* stuffing bytes */
+     memset(q, 0xFF, TS_PACKET_SIZE - (q - buf));
+@@ -1175,8 +1137,6 @@
+     uint8_t *q;
+     int val, is_start, len, header_len, write_pcr, is_dvb_subtitle, is_dvb_teletext, flags;
+     int afc_len, stuffing_len;
+-    int64_t pcr = -1; /* avoid warning */
+-    int64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE);
+     int force_pat = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && key && !ts_st->prev_payload_key;
+     av_assert0(ts_st->payload != buf || st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO);
+@@ -1186,28 +1146,33 @@
+     is_start = 1;
+     while (payload_size > 0) {
++        ts->pcr = ts->first_pcr + (ts->mux_rate == 1 ?
++            (dts == AV_NOPTS_VALUE ? 0 : (dts - ts->delay) * 300) :
++            // add 11, pcr references the last byte of program clock reference base
++            av_rescale(avio_tell(s->pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate));
++
+         retransmit_si_info(s, force_pat, dts);
+         force_pat = 0;
+         write_pcr = 0;
+-        if (ts_st->pid == ts_st->service->pcr_pid) {
+-            if (ts->mux_rate > 1 || is_start) // VBR pcr period is based on frames
+-                ts_st->service->pcr_packet_count++;
+-            if (ts_st->service->pcr_packet_count >=
+-                ts_st->service->pcr_packet_period) {
+-                ts_st->service->pcr_packet_count = 0;
++        if (ts_st->pid == ts_st->service->pcr_sid) {
++            if( ts->pcr >= ts_st->service->pcr_packet_timer ) {
++                ts_st->service->pcr_packet_timer = ts->pcr + ts_st->service->pcr_packet_period;
+                 write_pcr = 1;
+             }
+         }
+-
++        if (write_pcr && ts_st->service->pcr_sid != ts_st->service->pcr_pid) {
++           mpegts_insert_pcr_only(s, st);
++           continue;
++        }
+         if (ts->mux_rate > 1 && dts != AV_NOPTS_VALUE &&
+-            (dts - get_pcr(ts, s->pb) / 300) > delay) {
+-            /* pcr insert gets priority over null packet insert */
+-            if (write_pcr)
+-                mpegts_insert_pcr_only(s, st);
++               (dts - ts->pcr / 300) > ts->delay) {
++           /* pcr insert gets priority over null packet insert */
++           if (write_pcr)
++               mpegts_insert_pcr_only(s, st);
+             else
+-                mpegts_insert_null_packet(s);
+-            /* recalculate write_pcr and possibly retransmit si_info */
++               mpegts_insert_null_packet(s);
++            /* recalculate write_pcr and possibly retransimit si_info */
+             continue;
+         }
+@@ -1217,6 +1182,10 @@
+         val  = ts_st->pid >> 8;
+         if (is_start)
+             val |= 0x40;
++        if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
++          st->codecpar->codec_id == AV_CODEC_ID_AC3 &&
++          ts->m2ts_mode > 1)
++            val |= 0x20;
+         *q++      = val;
+         *q++      = ts_st->pid;
+         ts_st->cc = ts_st->cc + 1 & 0xf;
+@@ -1228,7 +1197,7 @@
+         }
+         if (key && is_start && pts != AV_NOPTS_VALUE) {
+             // set Random Access for key frames
+-            if (ts_st->pid == ts_st->service->pcr_pid)
++            if (ts_st->pid == ts_st->service->pcr_sid)
+                 write_pcr = 1;
+             set_af_flag(buf, 0x40);
+             q = get_ts_payload_start(buf);
+@@ -1236,14 +1205,10 @@
+         if (write_pcr) {
+             set_af_flag(buf, 0x10);
+             q = get_ts_payload_start(buf);
+-            // add 11, pcr references the last byte of program clock reference base
+             if (ts->mux_rate > 1)
+-                pcr = get_pcr(ts, s->pb);
+-            else
+-                pcr = (dts - delay) * 300;
+-            if (dts != AV_NOPTS_VALUE && dts < pcr / 300)
++            if (dts != AV_NOPTS_VALUE && dts < ts->pcr / 300)
+                 av_log(s, AV_LOG_WARNING, "dts < pcr, TS is invalid\n");
+-            extend_af(buf, write_pcr_bits(q, pcr));
++            extend_af(buf, write_pcr_bits(q, ts->pcr));
+             q = get_ts_payload_start(buf);
+         }
+         if (is_start) {
+@@ -1344,11 +1309,13 @@
+             *q++ = flags;
+             *q++ = header_len;
+             if (pts != AV_NOPTS_VALUE) {
+-                write_pts(q, flags >> 6, pts);
++                int64_t ts_pts = pts + ts->ts_offset;
++                write_pts(q, flags >> 6, ts_pts);
+                 q += 5;
+             }
+             if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) {
+-                write_pts(q, 1, dts);
++                int64_t ts_dts = dts + ts->ts_offset;
++                write_pts(q, 1, ts_dts);
+                 q += 5;
+             }
+             if (pes_extension && st->codecpar->codec_id == AV_CODEC_ID_DIRAC) {
+@@ -1519,7 +1486,6 @@
+     uint8_t *data = NULL;
+     MpegTSWrite *ts = s->priv_data;
+     MpegTSWriteStream *ts_st = st->priv_data;
+-    const int64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE) * 2;
+     int64_t dts = pkt->dts, pts = pkt->pts;
+     int opus_samples = 0;
+     int side_data_size;
+@@ -1540,16 +1506,15 @@
+     }
+     if (ts->flags & MPEGTS_FLAG_REEMIT_PAT_PMT) {
+-        ts->pat_packet_count = ts->pat_packet_period - 1;
+-        ts->sdt_packet_count = ts->sdt_packet_period - 1;
++        ts->pat_packet_timer = ts->sdt_packet_timer = 0;
+         ts->flags           &= ~MPEGTS_FLAG_REEMIT_PAT_PMT;
+     }
+     if (ts->copyts < 1) {
+         if (pts != AV_NOPTS_VALUE)
+-            pts += delay;
++            pts += 2*ts->delay;
+         if (dts != AV_NOPTS_VALUE)
+-            dts += delay;
++            dts += 2*ts->delay;
+     }
+     if (ts_st->first_pts_check && pts == AV_NOPTS_VALUE) {
+@@ -1737,7 +1702,7 @@
+             AVStream *st2 = s->streams[i];
+             MpegTSWriteStream *ts_st2 = st2->priv_data;
+             if (   ts_st2->payload_size
+-               && (ts_st2->payload_dts == AV_NOPTS_VALUE || dts - ts_st2->payload_dts > delay/2)) {
++               && (ts_st2->payload_dts == AV_NOPTS_VALUE || dts - ts_st2->payload_dts > ts->delay)) {
+                 mpegts_write_pes(s, st2, ts_st2->payload, ts_st2->payload_size,
+                                  ts_st2->payload_pts, ts_st2->payload_dts,
+                                  ts_st2->payload_flags & AV_PKT_FLAG_KEY, stream_id);
+@@ -1908,12 +1873,18 @@
+     { "mpegts_pmt_start_pid", "Set the first pid of the PMT.",
+       offsetof(MpegTSWrite, pmt_start_pid), AV_OPT_TYPE_INT,
+       { .i64 = 0x1000 }, 0x0010, 0x1f00, AV_OPT_FLAG_ENCODING_PARAM },
++    { "mpegts_pcr_start_pid", "Set the first pid of the PCR.",
++      offsetof(MpegTSWrite, pcr_start_pid), AV_OPT_TYPE_INT,
++      { .i64 = 0x1000 }, 0x0010, 0x1f00, AV_OPT_FLAG_ENCODING_PARAM },
+     { "mpegts_start_pid", "Set the first pid.",
+       offsetof(MpegTSWrite, start_pid), AV_OPT_TYPE_INT,
+       { .i64 = 0x0100 }, 0x0010, 0x0f00, AV_OPT_FLAG_ENCODING_PARAM },
+     { "mpegts_m2ts_mode", "Enable m2ts mode.",
+       offsetof(MpegTSWrite, m2ts_mode), AV_OPT_TYPE_BOOL,
+-      { .i64 = -1 }, -1, 1, AV_OPT_FLAG_ENCODING_PARAM },
++      { .i64 = -1 }, -1, 2, AV_OPT_FLAG_ENCODING_PARAM },
++    { "mpegts_pcr_offset", "clock offset.",
++      offsetof(MpegTSWrite, ts_offset), AV_OPT_TYPE_BOOL,
++      { .i64 = 0 }, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+     { "muxrate", NULL,
+       offsetof(MpegTSWrite, mux_rate), AV_OPT_TYPE_INT,
+       { .i64 = 1 }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+@@ -1951,15 +1922,15 @@
+     { "omit_video_pes_length", "Omit the PES packet length for video packets",
+       offsetof(MpegTSWrite, omit_video_pes_length), AV_OPT_TYPE_BOOL,
+       { .i64 = 1 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
+-    { "pcr_period", "PCR retransmission time in milliseconds",
+-      offsetof(MpegTSWrite, pcr_period), AV_OPT_TYPE_INT,
+-      { .i64 = PCR_RETRANS_TIME }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+-    { "pat_period", "PAT/PMT retransmission time limit in seconds",
++    { "pcr_period", "PCR retransmission time limit in msecs",
++      offsetof(MpegTSWrite, pcr_period), AV_OPT_TYPE_DOUBLE,
++      { .dbl = PCR_RETRANS_TIME }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
++    { "pat_period", "PAT/PMT retransmission time limit in msecs",
+       offsetof(MpegTSWrite, pat_period), AV_OPT_TYPE_DOUBLE,
+-      { .dbl = INT_MAX }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+-    { "sdt_period", "SDT retransmission time limit in seconds",
++      { .dbl = PAT_RETRANS_TIME }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
++    { "sdt_period", "SDT retransmission time limit in msecs",
+       offsetof(MpegTSWrite, sdt_period), AV_OPT_TYPE_DOUBLE,
+-      { .dbl = INT_MAX }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
++      { .dbl = SDT_RETRANS_TIME }, -1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+     { NULL },
+ };
+Only in b/libavformat: mpegtsenc.c.orig
diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg.git.patch3 b/cinelerra-5.1/thirdparty/src/ffmpeg.git.patch3
new file mode 100644 (file)
index 0000000..c774d19
--- /dev/null
@@ -0,0 +1,72 @@
+diff -ur a/libavformat/avformat.h b/libavformat/avformat.h
+--- a/libavformat/avformat.h   2017-10-13 16:31:25.000000000 -0600
++++ b/libavformat/avformat.h   2017-10-13 20:07:24.178440418 -0600
+@@ -504,6 +504,9 @@
+                                         The user or muxer can override this through
+                                         AVFormatContext.avoid_negative_ts
+                                         */
++#define AVFMT_SEEK_NOSTREAMS  0x80000 /**< Stream index ignored by seek,
++                                           or some streams fail to seek
++                                           */
+ #define AVFMT_SEEK_TO_PTS   0x4000000 /**< Seeking is based on PTS */
+@@ -664,7 +667,8 @@
+     /**
+      * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
+      * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
+-     * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS.
++     * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS,
++     * AVFMT_SEEK_NOSTREAMS
+      */
+     int flags;
+diff -ur a/libavformat/dv.c b/libavformat/dv.c
+--- a/libavformat/dv.c 2017-10-13 16:31:25.000000000 -0600
++++ b/libavformat/dv.c 2017-10-13 20:07:24.178440418 -0600
+@@ -632,6 +632,7 @@
+ AVInputFormat ff_dv_demuxer = {
+     .name           = "dv",
+     .long_name      = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
++    .flags          = AVFMT_SEEK_NOSTREAMS,
+     .priv_data_size = sizeof(RawDVContext),
+     .read_probe     = dv_probe,
+     .read_header    = dv_read_header,
+diff -ur a/libavformat/matroskadec.c b/libavformat/matroskadec.c
+--- a/libavformat/matroskadec.c        2017-10-13 16:31:25.000000000 -0600
++++ b/libavformat/matroskadec.c        2017-10-13 20:07:24.180440304 -0600
+@@ -3984,6 +3984,7 @@
+ AVInputFormat ff_matroska_demuxer = {
+     .name           = "matroska,webm",
+     .long_name      = NULL_IF_CONFIG_SMALL("Matroska / WebM"),
++    .flags          = AVFMT_SEEK_NOSTREAMS,
+     .extensions     = "mkv,mk3d,mka,mks",
+     .priv_data_size = sizeof(MatroskaDemuxContext),
+     .read_probe     = matroska_probe,
+@@ -3997,6 +3998,7 @@
+ AVInputFormat ff_webm_dash_manifest_demuxer = {
+     .name           = "webm_dash_manifest",
+     .long_name      = NULL_IF_CONFIG_SMALL("WebM DASH Manifest"),
++    .flags          = AVFMT_SEEK_NOSTREAMS,
+     .priv_data_size = sizeof(MatroskaDemuxContext),
+     .read_header    = webm_dash_manifest_read_header,
+     .read_packet    = webm_dash_manifest_read_packet,
+Only in b/libavformat: matroskadec.c.orig
+diff -ur a/libavformat/utils.c b/libavformat/utils.c
+--- a/libavformat/utils.c      2017-10-13 16:31:25.000000000 -0600
++++ b/libavformat/utils.c      2017-10-13 20:07:24.182440190 -0600
+@@ -2415,6 +2415,13 @@
+         return seek_frame_byte(s, stream_index, timestamp, flags);
+     }
++    if (stream_index != -1 && (s->iformat->flags & AVFMT_SEEK_NOSTREAMS)) {
++            timestamp = av_rescale_q(timestamp,
++                    s->streams[stream_index]->time_base,
++                    AV_TIME_BASE_Q);
++            stream_index = -1;
++    }
++
+     if (stream_index < 0) {
+         stream_index = av_find_default_stream_index(s);
+         if (stream_index < 0)
+Only in b/libavformat: utils.c.orig