~ruther/guix-local

b8e3696fc50826601fe1190380f0d1979378f11d — 宋文武 1 year, 4 months ago c54715b
gnu: ffmpeg: Add 'av_stream_get_first_dts' patch for QtWebEngine.

* gnu/packages/patches/ffmpeg-add-av_stream_get_first_dts-for-chromium.patch:
New patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/video.scm (ffmpeg) [patches]: Add it.

Change-Id: I819076f8eb1cd2d62f2bbf18c7ceee10cb59adba
M gnu/local.mk => gnu/local.mk +1 -0
@@ 1297,6 1297,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/fenics-dolfin-boost.patch		\
  %D%/packages/patches/fenics-dolfin-config-slepc.patch		\
  %D%/packages/patches/fenics-dolfin-hdf5-version-check.patch	\
  %D%/packages/patches/ffmpeg-add-av_stream_get_first_dts-for-chromium.patch	\
  %D%/packages/patches/ffmpeg-jami-change-RTCP-ratio.patch	\
  %D%/packages/patches/ffmpeg-jami-rtp_ext_abs_send_time.patch	\
  %D%/packages/patches/ffmpeg-jami-libopusdec-enable-FEC.patch	\

A gnu/packages/patches/ffmpeg-add-av_stream_get_first_dts-for-chromium.patch => gnu/packages/patches/ffmpeg-add-av_stream_get_first_dts-for-chromium.patch +37 -0
@@ 0,0 1,37 @@
Add 'av_stream_get_first_dts' for Chromium and QtWebEngine.

Taken from Arch Linux:
  <https://gitlab.archlinux.org/archlinux/packaging/packages/ffmpeg/-/blob/a02c1a15706ea832c0d52a4d66be8fb29499801a/add-av_stream_get_first_dts-for-chromium.patch>

---
diff '--color=auto' -rupN ffmpeg.orig/libavformat/avformat.h ffmpeg/libavformat/avformat.h
--- ffmpeg.orig/libavformat/avformat.h	2022-08-19 17:42:47.323422603 +0200
+++ ffmpeg/libavformat/avformat.h	2022-08-19 17:42:51.347130436 +0200
@@ -1128,6 +1128,10 @@ struct AVCodecParserContext *av_stream_g
  */
 int64_t    av_stream_get_end_pts(const AVStream *st);
 
+// Chromium: We use the internal field first_dts vvv
+int64_t    av_stream_get_first_dts(const AVStream *st);
+// Chromium: We use the internal field first_dts ^^^
+
 #define AV_PROGRAM_RUNNING 1
 
 /**
diff '--color=auto' -rupN ffmpeg.orig/libavformat/mux_utils.c ffmpeg/libavformat/mux_utils.c
--- ffmpeg.orig/libavformat/mux_utils.c	2022-08-19 17:42:47.346758108 +0200
+++ ffmpeg/libavformat/mux_utils.c	2022-08-19 17:47:28.549589002 +0200
@@ -37,6 +37,13 @@ int64_t av_stream_get_end_pts(const AVSt
         return AV_NOPTS_VALUE;
 }
 
+// Chromium: We use the internal field first_dts vvv
+int64_t av_stream_get_first_dts(const AVStream *st)
+{
+  return cffstream(st)->first_dts;
+}
+// Chromium: We use the internal field first_dts ^^^
+
 int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id,
                          int std_compliance)
 {

M gnu/packages/video.scm => gnu/packages/video.scm +4 -1
@@ 1863,7 1863,10 @@ audio/video codec library.")
                                  version ".tar.xz"))
              (sha256
               (base32
                "0s7r2qv8gh2a3w568n9xxgcz0q8j5ww1jdsci1hm9f4l1yqg9146"))))))
                "0s7r2qv8gh2a3w568n9xxgcz0q8j5ww1jdsci1hm9f4l1yqg9146"))
              (patches
               (search-patches
                "ffmpeg-add-av_stream_get_first_dts-for-chromium.patch"))))))

(define-public ffmpeg-5
  (package