From 5884c94b1f92c00406d137c9f308c098e5268a59 Mon Sep 17 00:00:00 2001 From: PA4WDH Date: Tue, 13 Jul 2021 19:47:04 +0200 Subject: Initial commit --- media-video/mplayer/files/configure-riscv.patch | 10 +++ media-video/mplayer/files/dump_ffmpeg.sh | 74 ++++++++++++++++++++++ media-video/mplayer/files/ffmpeg44.patch | 12 ++++ .../mplayer/files/mplayer-1.3-CVE-2016-4352.patch | 24 +++++++ media-video/mplayer/files/prepare_mplayer.sh | 25 ++++++++ 5 files changed, 145 insertions(+) create mode 100644 media-video/mplayer/files/configure-riscv.patch create mode 100644 media-video/mplayer/files/dump_ffmpeg.sh create mode 100644 media-video/mplayer/files/ffmpeg44.patch create mode 100644 media-video/mplayer/files/mplayer-1.3-CVE-2016-4352.patch create mode 100644 media-video/mplayer/files/prepare_mplayer.sh (limited to 'media-video/mplayer/files') diff --git a/media-video/mplayer/files/configure-riscv.patch b/media-video/mplayer/files/configure-riscv.patch new file mode 100644 index 0000000..debec44 --- /dev/null +++ b/media-video/mplayer/files/configure-riscv.patch @@ -0,0 +1,10 @@ +--- MPlayer-1.4/configure 2018-12-15 16:38:24.000000000 +0100 ++++ MPlayer-1.4-mod/configure 2021-06-19 20:41:00.735402324 +0200 +@@ -1761,6 +1761,7 @@ + nios2) host_arch=nios2 ;; + vax) host_arch=vax ;; + xtensa*) host_arch=xtensa ;; ++ riscv*) host_arch=generic ;; + *) host_arch=UNKNOWN ;; + esac + } diff --git a/media-video/mplayer/files/dump_ffmpeg.sh b/media-video/mplayer/files/dump_ffmpeg.sh new file mode 100644 index 0000000..885946d --- /dev/null +++ b/media-video/mplayer/files/dump_ffmpeg.sh @@ -0,0 +1,74 @@ +#!/bin/sh + +FFMPEG_DIR=ffmpeg +FFMPEG_MOVED_DIR=ffmpeg_removed +SYSTEM_FFMPEG_DIR=${EPREFIX}/usr/include + +# Move directories + +[ -d "${FFMPEG_DIR}" ] && mv "${FFMPEG_DIR}" "${FFMPEG_MOVED_DIR}" +[ -d "${FFMPEG_MOVED_DIR}" ] || exit 1 +[ -d "${FFMPEG_DIR}" ] || mkdir "${FFMPEG_DIR}" + +# Keep required files and check them + +SANITIZED_REGEXP='^\#[[:space:]]*include.*\".*[.]h\"' +sanitize_includes() { + sed -e "s/^\#[[:space:]]*include.*\"config[.]h\"/#include /" \ + -e "s/^\#[[:space:]]*include.*\"\(libav.*\/.*[.]h\)\"/#include \<\1\>/" \ + -e "/${SANITIZED_REGEXP}/{s:\"\(.*\)\":\<${2}\/\1\>:}" ${1} +} + +check_sanitized_includes() { + grep -q "${SANITIZED_REGEXP}" $1 +} + +get_header_deps() { + grep "^#[[:space:]]*include.*\" ${1} | \ + sed -e "s/^#[[:space:]]*include.*\<\(libav.*[.]h\)\>/\1/" | \ + tr -d '<>' | tr '\n' ' ' +} + +check_header_deps() { + for i ; do + printf "Checking for the presence of ${i}...\n" + if [ ! -f "${SYSTEM_FFMPEG_DIR}/${i}" -a ! -f "${FFMPEG_DIR}/${i}" ] ; then + printf "Header depends on ${i}\n" + printf "... but that file cannot be found, aborting\n" + exit 1 + fi + done +} + +move_file() { + mydir="$(dirname $1)" + printf "Moving and checking file: ${1}\n" + [ -d "${FFMPEG_DIR}/${mydir}" ] || mkdir -p "${FFMPEG_DIR}/${mydir}" + if [ ! -f "${FFMPEG_DIR}/${1}" ] ; then + sanitize_includes "${FFMPEG_MOVED_DIR}/${1}" ${mydir} > "${FFMPEG_DIR}/${1}" + fi + if $(check_sanitized_includes "${FFMPEG_DIR}/${1}") ; then + printf "Error, found non sanitized file in ffmpeg:\n" + printf "${FFMPEG_DIR}/${1}\n" + printf "Please report it at bugs.gentoo.org\n" + exit 1 + fi + if [ "${1%.h}" != "${1}" ] ; then + mydeps=$(get_header_deps "${FFMPEG_DIR}/${1}") + check_header_deps ${mydeps} + fi +} + +# HEADERS (order matters for the consistency checks: leaves come first) +FILES="libavutil/wchar_filename.h libavformat/os_support.h libavformat/internal.h libavutil/x86/asm.h" +# Files that are sed'ed but not compiled, used to check for availability of +# some codecs +FILES="${FILES} libavcodec/allcodecs.c libavformat/allformats.c libavfilter/allfilters.c" + +for i in ${FILES} ; do + move_file $i +done + +rm -rf "${FFMPEG_MOVED_DIR}" + +exit 0 diff --git a/media-video/mplayer/files/ffmpeg44.patch b/media-video/mplayer/files/ffmpeg44.patch new file mode 100644 index 0000000..99d5407 --- /dev/null +++ b/media-video/mplayer/files/ffmpeg44.patch @@ -0,0 +1,12 @@ +Index: MPlayer-1.4/libmpcodecs/ad_spdif.c +=================================================================== +--- MPlayer-1.4.orig/libmpcodecs/ad_spdif.c ++++ MPlayer-1.4/libmpcodecs/ad_spdif.c +@@ -300,7 +300,6 @@ static void uninit(sh_audio_t *sh) + av_freep(&lavf_ctx->pb); + if (lavf_ctx->streams) { + av_freep(&lavf_ctx->streams[0]->codec); +- av_freep(&lavf_ctx->streams[0]->info); + av_freep(&lavf_ctx->streams[0]); + } + av_freep(&lavf_ctx->streams); diff --git a/media-video/mplayer/files/mplayer-1.3-CVE-2016-4352.patch b/media-video/mplayer/files/mplayer-1.3-CVE-2016-4352.patch new file mode 100644 index 0000000..4eabf8b --- /dev/null +++ b/media-video/mplayer/files/mplayer-1.3-CVE-2016-4352.patch @@ -0,0 +1,24 @@ +https://trac.mplayerhq.hu/ticket/2295 + +r37857 + +--- old/libmpdemux/demux_gif.c ++++ new/libmpdemux/demux_gif.c +@@ -304,6 +304,17 @@ + return NULL; + } + ++ // Validate image size, most code in this demuxer assumes w*h <= INT_MAX ++ if ((int64_t)gif->SWidth * gif->SHeight > INT_MAX) { ++ mp_msg(MSGT_DEMUX, MSGL_ERR, ++ "[demux_gif] Unsupported picture size %dx%d.\n", gif->SWidth, ++ gif->SHeight); ++ if (DGifCloseFile(gif) == GIF_ERROR) ++ print_gif_error(NULL); ++ free(priv); ++ return NULL; ++ } ++ + // create a new video stream header + sh_video = new_sh_video(demuxer, 0); + diff --git a/media-video/mplayer/files/prepare_mplayer.sh b/media-video/mplayer/files/prepare_mplayer.sh new file mode 100644 index 0000000..57d4742 --- /dev/null +++ b/media-video/mplayer/files/prepare_mplayer.sh @@ -0,0 +1,25 @@ +#!/bin/sh +VERSION=$(date +%Y%m%d) +PACKAGE="mplayer-1.2_pre${VERSION}" +DUMP_FFMPEG="$(dirname $0)/dump_ffmpeg.sh" + +svn checkout svn://svn.mplayerhq.hu/mplayer/trunk ${PACKAGE} + +pushd ${PACKAGE} > /dev/null + # ffmpeg is in git now so no svn external anymore + rm -rf ffmpeg + git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg/ + sh "$DUMP_FFMPEG" + STORE_VERSION=$(LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2) + printf "$STORE_VERSION" > snapshot_version +popd > /dev/null + +find "${PACKAGE}" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf +find "${PACKAGE}" -type d -name '.git' -prune -print0 | xargs -0 rm -rf + +tar cJf ${PACKAGE}.tar.xz ${PACKAGE} +rm -rf ${PACKAGE}/ + +echo "Tarball: \"${PACKAGE}.tar.xz\"" + +echo "** all done **" -- cgit v1.2.3