Ticket #54480: 0001-VLC-upgrade-to-2.2.6-and-FFmpeg-3.patch

File 0001-VLC-upgrade-to-2.2.6-and-FFmpeg-3.patch, 31.5 KB (added by l2dy (Zero King), 7 years ago)
  • multimedia/VLC/Portfile

    From 8fa581e588d14cec33e07ddd94f4a10172e1568d Mon Sep 17 00:00:00 2001
    From: Zero King <l2dy@macports.org>
    Date: Sat, 19 Aug 2017 10:36:34 +0000
    Subject: [PATCH] VLC: upgrade to 2.2.6 and FFmpeg 3
    
    Fixes: https://trac.macports.org/ticket/54480
    ---
     multimedia/VLC/Portfile                          | 295 ++++++-----------------
     multimedia/VLC/files/patch-ffmpeg3-compat.diff   | 231 ++++++++++++++++++
     multimedia/VLC/files/patch-use-NSGetEnviron.diff |  40 +++
     3 files changed, 351 insertions(+), 215 deletions(-)
     create mode 100644 multimedia/VLC/files/patch-ffmpeg3-compat.diff
     create mode 100644 multimedia/VLC/files/patch-use-NSGetEnviron.diff
    
    diff --git a/multimedia/VLC/Portfile b/multimedia/VLC/Portfile
    index 8086f8d6..222feb20 100644
    a b PortGroup compiler_blacklist_versions 1.0 
    55PortGroup               active_variants 1.1
    66PortGroup               conflicts_build 1.0
    77
     8if {[file exists ${prefix}/etc/macports/locales.tcl]} {
     9    # experimental feature to cut down the NLS/locale files, which take up over 50% of
     10    # the install footprint for VLC. This feature loads the locale_select PortGroup
     11    # if its configuration file exist; a variant is then added which prunes all translations from
     12    # ${destroot}${prefix}/share/locale except those whitelisted in etc/macports/locales.tcl .
     13    PortGroup           locale_select 1.0
     14}
     15
    816name                    VLC
    917
    1018categories              multimedia devel
    subport lib${name} { 
    2533    long_description    libVLC is the core engine and the interface to the multimedia \
    2634                        framework on which VLC media player is based.  It allows developers \
    2735                        to create a wide range of multimedia applications using the VLC features.
    28     conflicts           ${name} VLC-devel libVLC-devel
     36    conflicts           ${name} VLC-devel
    2937    homepage            http://www.videolan.org/vlc/libvlc.html
    3038}
    3139
    32 subport ffmpeg-VLC {}
    33 set FFMPEG_VLC_PREFIX   ${prefix}/lib/vlc/ffmpeg
     40set use_ffmpeg_VLC      no
     41
     42if {[tbool use_ffmpeg_VLC]} {
     43    subport ffmpeg-VLC {}
     44    set FFMPEG_VLC_PREFIX   ${prefix}/lib/vlc/ffmpeg
     45}
    3446
    3547if {${subport} eq ${name}} {
    36     conflicts           lib${name} libVLC-devel VLC-devel
     48    conflicts           lib${name} VLC-devel
    3749}
    3850
    3951# VLC-2.1 and later are x86_64-only: https://trac.videolan.org/vlc/ticket/8161
    supported_archs x86_64 
    4456###################  ports VLC and libVLC  ###################
    4557##
    4658if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} {
    47     version             2.2.4
    48     revision            9
     59    version             2.2.6
    4960    license             GPL-2
    5061
    5162    platforms           darwin
    if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} { 
    5465    distname            vlc-${version}
    5566    use_xz              yes
    5667
    57     checksums           rmd160  2fe178bb9a4b2ad5ca0294d3e52ceb992b22e8ee \
    58                         sha256  1632e91d2a0087e0ef4c3fb4c95c3c2890f7715a9d1d43ffd46329f428cf53be
     68    checksums           rmd160  b2727834bcbbf0d274e3a0b4a3317f3b914f9ad4 \
     69                        sha256  c403d3accd9a400eb2181c958f3e7bc5524fe5738425f4253d42883b425a42a8
    5970
    6071    if {[info exist ::env(MACPORTS_COMPRESS_WORKDIR)] && $::env(MACPORTS_COMPRESS_WORKDIR)} {
    6172        # Enable HFS compression.
    if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} { 
    6778
    6879    depends_build       port:pkgconfig
    6980
    70     depends_lib         port:ffmpeg-VLC \
    71                         port:a52dec \
     81    if {[tbool use_ffmpeg_VLC]} {
     82        depends_lib-append \
     83                        port:ffmpeg-VLC
     84    }
     85    depends_lib-append  port:a52dec \
    7286                        port:avahi \
    7387                        port:bzip2 \
    7488                        port:faad2 \
    if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} { 
    189203                        static_assert.patch \
    190204                        no-sparkle.patch \
    191205                        patch-vlc-no-O4.diff \
    192                         patch-ffmpegVLC.diff \
    193206                        patch-soundfont-path.diff
     207    if {[tbool use_ffmpeg_VLC]} {
     208        patchfiles-append \
     209                        patch-ffmpegVLC.diff
     210    } else {
     211        patchfiles-append \
     212                        patch-ffmpeg3-compat.diff
     213    }
    194214
    195215    post-patch {
    196216        if {[string match *clang* ${configure.cxx}] && ${configure.cxx_stdlib} == "libc++"} {
    197217            reinplace "s:-lstdc\+\+:-lc++:" \
    198                 ${worksrcpath}/configure.ac \
    199218                ${worksrcpath}/modules/access/Makefile.am
    200219        }
    201220
    202221        reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/modules/codec/fluidsynth.c
    203222
    204         # patch source using ffmpeg to use the correct header file locations
    205         foreach dir {libavcodec libavformat libavresample libavutil libpostproc libswresample libswscale} {
    206             foreach module {access codec/avcodec demux/avformat hw/vdpau packetizer video_chroma} {
    207                 foreach cf [glob -nocomplain ${worksrcpath}/modules/${module}/*.c] {
    208                     reinplace "s|${dir}/|${dir}-VLC/|g" ${cf}
    209                 }
    210                 foreach cf [glob -nocomplain ${worksrcpath}/modules/${module}/*.h] {
    211                     reinplace "s|${dir}/|${dir}-VLC/|g" ${cf}
     223        if {[tbool use_ffmpeg_VLC]} {
     224            # patch source using ffmpeg to use the correct header file locations
     225            foreach dir {libavcodec libavformat libavresample libavutil libpostproc libswresample libswscale} {
     226                foreach module {access codec/avcodec demux/avformat hw/vdpau packetizer video_chroma} {
     227                    foreach cf [glob -nocomplain ${worksrcpath}/modules/${module}/*.c] {
     228                        reinplace "s|${dir}/|${dir}-VLC/|g" ${cf}
     229                    }
     230                    foreach cf [glob -nocomplain ${worksrcpath}/modules/${module}/*.h] {
     231                        reinplace "s|${dir}/|${dir}-VLC/|g" ${cf}
     232                    }
    212233                }
     234                reinplace "s|${dir}/|${dir}-VLC/|g" ${worksrcpath}/configure.ac ${worksrcpath}/configure
    213235            }
    214             reinplace "s|${dir}/|${dir}-VLC/|g" ${worksrcpath}/configure.ac ${worksrcpath}/configure
    215         }
    216         reinplace "s|postproc/|postproc-VLC/|g" ${worksrcpath}/configure.ac ${worksrcpath}/configure
    217         reinplace "s|libpostproc/|libpostproc-VLC/|g" ${worksrcpath}/modules/video_filter/postproc.c
    218         reinplace "s|HAVE_LIBAVUTIL_AV|HAVE_LIBAVUTIL_VLC_AV|g" \
     236            reinplace "s|postproc/|postproc-VLC/|g" ${worksrcpath}/configure.ac ${worksrcpath}/configure
     237            reinplace "s|libpostproc/|libpostproc-VLC/|g" ${worksrcpath}/modules/video_filter/postproc.c
     238            reinplace "s|HAVE_LIBAVUTIL_AV|HAVE_LIBAVUTIL_VLC_AV|g" \
    219239                ${worksrcpath}/modules/codec/avcodec/avcommon.h \
    220240                ${worksrcpath}/modules/codec/avcodec/avcommon_compat.h
    221         reinplace "s|HAVE_LIBAVFORMAT_AV|HAVE_LIBAVFORMAT_VLC_AV|g" \
     241            reinplace "s|HAVE_LIBAVFORMAT_AV|HAVE_LIBAVFORMAT_VLC_AV|g" \
    222242                ${worksrcpath}/modules/codec/avcodec/avcommon.h \
    223243                ${worksrcpath}/modules/codec/avcodec/avcommon_compat.h
    224         reinplace "s|HAVE_LIBAVCODEC_AV|HAVE_LIBAVCODEC_VLC_AV|g" \
     244            reinplace "s|HAVE_LIBAVCODEC_AV|HAVE_LIBAVCODEC_VLC_AV|g" \
    225245                ${worksrcpath}/modules/codec/avcodec/avcommon.h \
    226246                ${worksrcpath}/modules/codec/avcodec/avcommon_compat.h
    227         reinplace "s|HAVE_LIBSWSCALE_SW|HAVE_LIBSWSCALE_VLC_SW|g" \
     247            reinplace "s|HAVE_LIBSWSCALE_SW|HAVE_LIBSWSCALE_VLC_SW|g" \
    228248                ${worksrcpath}/modules/codec/avcodec/avcommon.h \
    229249                ${worksrcpath}/modules/codec/avcodec/avcommon_compat.h
     250        }
    230251    }
    231252    post-configure {
    232253        system -W ${worksrcpath} "patch -Np0 -i ${filespath}/patch-static_assert.diff"
    if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} { 
    240261
    241262    configure.env-append \
    242263                        CXXCPP="${configure.cxx} -E"
    243     # splice in ffmpeg-VLC's pkgconfig path, hoping that PKG_CONFIG_PATH hasn't been set by anyone else
    244     configure.env-append \
     264    if {[tbool use_ffmpeg_VLC]} {
     265        # splice in ffmpeg-VLC's pkgconfig path, hoping that PKG_CONFIG_PATH hasn't been set by anyone else
     266        configure.env-append \
    245267                        PKG_CONFIG_PATH=${FFMPEG_VLC_PREFIX}/lib/pkgconfig
     268    }
    246269    build.args-append   DESTDIR=${worksrcpath}/dest_ignore V=1
    247270
    248271    # gl.c:121:3: error: Platform not recognized.
    if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} { 
    439462            description {Enable all variants (except freerdp, currently)} {}
    440463    }
    441464
    442     # this patchfile can probably go with VLC 2.2.2, or should be reviewed then.
    443     # update 2.2.2 : lua 5.3 gives compiler syntax errors so we stick with 5.2 for now.
     465#     # this patchfile can probably go with VLC 2.2.2, or should be reviewed then.
     466#     # update 2.2.2 : lua 5.3 gives compiler syntax errors so we stick with 5.2 for now.
    444467    patchfiles-append           patch-for-lua52.diff
    445468
    446469    # make 10.12 and later ignore all QTKit code in modules/gui/macosx/open.m
    if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} { 
    452475            default_variants-append +qtkit
    453476        }
    454477
    455         configure.args-replace  --disable-macosx-eyetv --enable-macosx-eyetv
    456 
    457         if {${subport} ne "lib${name}"} {
    458             configure.args-replace  --disable-macosx-vlc-app --enable-macosx-vlc-app
    459         }
     478        patchfiles-append       patch-use-NSGetEnviron.diff
    460479
    461480        post-patch {
    462             reinplace "s/Appkit/AppKit/" ${worksrcpath}/configure.ac
    463481            reinplace "/Sparkle.framework/d" \
    464482                ${worksrcpath}/extras/package/macosx/vlc.xcodeproj/project.pbxproj
    465483            reinplace "/SDKROOT/d" \
    if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} { 
    470488            reinplace "s:LD_LIBRARY_PATH:DYLD_LIBRARY_PATH:g" \
    471489                ${worksrcpath}/Makefile.am
    472490
    473             reinplace "/argv/s/environ/*_NSGetEnviron()/" \
    474                 ${worksrcpath}/modules/misc/inhibit/xdg.c \
    475                 ${worksrcpath}/modules/stream_filter/decomp.c
    476 
    477             reinplace "s/extern char \\*\\*environ;/#include <crt_externs.h>/" \
    478                 ${worksrcpath}/modules/misc/inhibit/xdg.c \
    479                 ${worksrcpath}/modules/stream_filter/decomp.c
    480 
    481491            if {![file exists ${worksrcpath}/contrib/BGHUDAppKit.framework]} {
    482492                ln -s ${frameworks_dir}/BGHUDAppKit.framework ${worksrcpath}/contrib/BGHUDAppKit.framework
    483493            }
    if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} { 
    486496            file mkdir "${worksrcpath}/contrib/lib"
    487497        }
    488498
     499        configure.args-replace  --disable-macosx-eyetv --enable-macosx-eyetv
     500
     501        if {${subport} ne "lib${name}"} {
     502            configure.args-replace  --disable-macosx-vlc-app --enable-macosx-vlc-app
     503        }
     504
    489505        post-destroot {
    490             eval file delete [glob ${destroot}${prefix}/lib/vlc/plugins/*/*.la]
     506            file delete {*}[glob ${destroot}${prefix}/lib/vlc/plugins/*/*.la]
    491507
    492508            if {[variant_isset qt4] || [variant_isset qt5] || [variant_isset quartz]} {
    493509                if {${subport} ne "lib${name}"} {
    if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} { 
    505521                    delete ${destroot}${applications_dir}/VLC.app/Contents/MacOS/share/lua
    506522
    507523                    # http://trac.macports.org/ticket/35131
    508                     ln -s ${prefix}/lib ${destroot}${applications_dir}/VLC.app/Contents/MacOS/lib
     524                    xinstall -m 755 -d ${destroot}${applications_dir}/VLC.app/Contents/MacOS/lib
     525                    foreach l [glob -nocomplain ${destroot}${prefix}/lib/*] {
     526                        ln -s ${prefix}/lib/[file tail ${l}] ${destroot}${applications_dir}/VLC.app/Contents/MacOS/lib
     527                    }
    509528                    ln -s ${prefix}/lib/vlc/plugins ${destroot}${applications_dir}/VLC.app/Contents/MacOS/plugins
    510529                    ln -s ${prefix}/lib/vlc/lua ${destroot}${applications_dir}/VLC.app/Contents/MacOS/share/lua
    511                     ln -s ${prefix}/share/locale ${destroot}${applications_dir}/VLC.app/Contents/MacOS/share/locale
     530                    foreach d [glob -nocomplain ${destroot}${prefix}/share/locale/*] {
     531                        set locale [file tail ${d}]
     532                        set ldir ${destroot}${applications_dir}/VLC.app/Contents/MacOS/share/locale/${locale}/LC_MESSAGES
     533                        xinstall -m 755 -d ${ldir}
     534                        foreach m [glob -nocomplain ${d}/LC_MESSAGES/*] {
     535                            ln -s ${prefix}/share/locale/${locale}/LC_MESSAGES/[file tail ${m}] ${ldir}/
     536                        }
     537                    }
    512538
    513539                    # the vlc executable needs to be started with a full path to the app bundle executable
    514540                    # or else the Mac OS X interface will hang beyond even a ^C or ^\ :
    if {(${subport} eq ${name}) || (${subport} eq "lib${name}")} { 
    529555            system "${prefix}/lib/vlc/vlc-cache-gen -f ${prefix}/lib/vlc"
    530556        }
    531557    }
    532 # outcomment when the port:fluid-soundfont* ports have been made available
    533 #     notes-append "MIDI support requires installing one or more SoundFont files,\
    534 #         in ${prefix}/share/sounds/sf2, for instance from one of the port:fluid-soundfont-* ports"
     558    notes-append "MIDI support requires installing one or more SoundFont files,\
     559        in ${prefix}/share/sounds/sf2, for instance from port:generaluser-soundfont."
    535560}
    536561
    537562##
    538563#################  support port ffmpeg-VLC  ##################
    539564##
    540565if {${subport} eq "ffmpeg-VLC"} {
    541     PortGroup           xcodeversion 1.0
    542 
    543     version             2.8.6
    544     revision            1
    545     license             LGPL-2.1+
    546     categories          multimedia
    547     maintainers         gmail.com:rjvbertin openmaintainer
    548 
    549     description         Custom FFMpeg 2.8.6 build for port:VLC and port:libVLC.
    550     long_description    Custom FFMpeg build for VLC and libVLC v2.2.x . It installs \
    551                         a private copy of FFMpeg v2.8.6 .
    552 
    553     platforms           darwin
    554     homepage            http://www.ffmpeg.org/
    555     master_sites        http://www.ffmpeg.org/releases/
    556 
    557     use_bzip2           yes
    558     distname            ffmpeg-${version}
    559 
    560     checksums           rmd160  5b61b6b0521d39ca31dcfb7fff1dfa26d9e7667a \
    561                         sha256  40611e329bc354592c6f8f1deb033c31b91f80e91f5707ca4f9afceca78d8e62
    562 
    563     depends_build       port:pkgconfig \
    564                         port:gmake
    565 
    566     # libvpx is static only so can be considered a build dependency (#47934)
    567 
    568     depends_build-append \
    569                         port:libvpx
    570 
    571     depends_lib         port:lame \
    572                         port:libiconv \
    573                         port:openjpeg15 \
    574                         port:xz \
    575                         port:zlib
    576 
    577     build.cmd           ${prefix}/bin/gmake
    578     build.env-append    V=1
    579 
    580     #
    581     # enable auto configure of asm optimizations
    582     # requires Xcode 3.1 or better on Leopard
    583     #
    584     minimum_xcodeversions {9 3.1}
    585 
    586     if {[lsearch [get_canonical_archs] i386] != -1} {
    587         # clang-3.1 hits https://trac.macports.org/ticket/30137 (<rdar://problem/11542429>)
    588         # clang-139 hits https://trac.macports.org/ticket/38141
    589         compiler.blacklist-append {clang < 422.1.7}
    590     }
    591 
    592     configure.cflags-append -DHAVE_LRINTF ${configure.cppflags}
    593     configure.args      --prefix=${FFMPEG_VLC_PREFIX} \
    594                         --progs-suffix=-VLC \
    595                         --build-suffix=-VLC \
    596                         --disable-doc \
    597                         --disable-encoder=vorbis \
    598                         --enable-libopenjpeg \
    599                         --disable-debug \
    600                         --disable-avdevice \
    601                         --disable-devices \
    602                         --disable-avfilter \
    603                         --disable-filters \
    604                         --disable-protocol=concat \
    605                         --disable-bsfs \
    606                         --disable-bzlib \
    607                         --enable-avresample \
    608                         --enable-libmp3lame \
    609                         --enable-libvpx \
    610                         --disable-libbluray \
    611                         --disable-sdl \
    612                         --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-libxcb-shape \
    613                         --enable-shared --disable-static --enable-pthreads \
    614                         --enable-rpath \
    615                         --disable-stripping \
    616                         --cc=${configure.cc}
    617 
    618     # this is the old gpl2 variant. VLC is GPL2'ed, so we can just as well build ffmpeg
    619     # with these components.
    620     configure.args-append \
    621                         --enable-gpl \
    622                         --enable-postproc
    623 
    624     configure.args-append \
    625                         --arch=${configure.build_arch}
    626     configure.env-append \
    627                         ASFLAGS='[get_canonical_archflags]'
    628     if {${build_arch} eq "x86_64"} {
    629         depends_build-append \
    630                         port:yasm
    631         configure.args-append \
    632                         --enable-yasm
     566    if {[catch {source "${portpath}/Portfile.ffmpeg.tcl"} err]} {
     567        puts stderr "Error reading Portfile.ffmpeg.tcl: $err"
     568        return 1;
    633569    }
    634 
    635     platform darwin {
    636         if {${os.major} < 9} {
    637             configure.args-append --disable-asm
    638         }
    639 
    640         # VDA (video hardware acceleration, mostly H264) is only supported on 10.6.3+ up to (excluding) 10.11.
    641         #if {(${os.major} > 10 || (${os.major} == 10 && ${os.minor} >= 3)) && (${os.major} < 15)}
    642         # Due to a bug in ffmpeg(?), we have to enable VDA on 10.11 as well, even though it shouldn't be supported.
    643         # More information: https://github.com/mpv-player/mpv/issues/2299
    644         if {${os.major} > 10 || (${os.major} == 10 && ${os.minor} >= 3)} {
    645             configure.args-delete --disable-vda
    646             configure.args-append --enable-vda
    647         }
    648 
    649         # VideotoolBox, a new hardware acceleration framework, is supported on 10.8+ and "here to stay".
    650         # It provides support for H264, H263, MPEG1, MPEG2 and MPEG4.
    651         if {${os.major} > 11} {
    652             configure.args-delete --disable-videotoolbox
    653             configure.args-append --enable-videotoolbox
    654         }
    655 
    656         # Apple GCC has problems with SIMD intrinsics and -Werror=no-missing-prototypes.
    657         if {${os.major} < 11} {
    658             patchfiles-append patch-configure-no-error-on-missing-prototypes.diff
    659         }
    660 
    661         # kCVPixelFormatType_OneComponent8 used in avfoundation indev is only available on 10.8+
    662         if {${os.major} < 12} {
    663             configure.args-append --disable-indev=avfoundation
    664         }
    665     }
    666 
    667     #
    668     # configure isn't autoconf and they do use a dep cache
    669     #
    670 
    671     platform darwin 8 {
    672         post-patch {
    673             reinplace "s:,-compatibility_version,$\(LIBMAJOR\)::" ${worksrcpath}/configure
    674         }
    675     }
    676 
    677     destroot.target     install-libs install-headers
    678 
    679     post-destroot {
    680         file delete -force ${destroot}${prefix}/share/examples
    681         # We need to make sure that the linker will use our libraries and not one
    682         # from a location like ${prefix}/lib . That's why we use --build-suffix, but
    683         # that still requires us to provide pkg-config files with the standard names:
    684         foreach pc [glob ${destroot}${FFMPEG_VLC_PREFIX}/lib/pkgconfig/*.pc] {
    685             set standardname [strsed ${pc} "s/-VLC.pc/.pc/"]
    686             ln -s [file tail ${pc}] ${standardname}
    687         }
    688         # oblige dependent code to include files from our own renamed header file directories, so it
    689         # cannot include mismatching headers by accident (e.g. those from ffmpeg 3.x).
    690         foreach dir {libavcodec libavformat libavresample libavutil libpostproc libswresample libswscale} {
    691             file rename ${destroot}${FFMPEG_VLC_PREFIX}/include/${dir} ${destroot}${FFMPEG_VLC_PREFIX}/include/${dir}-VLC
    692         }
    693         foreach dir {libavcodec libavformat libavresample libavutil libpostproc libswresample libswscale} {
    694             foreach header [glob -nocomplain ${destroot}${FFMPEG_VLC_PREFIX}/include/*/*.h] {
    695                 reinplace "s|${dir}/|${dir}-VLC/|g" ${header}
    696             }
    697         }
    698         # packageable: ${destroot}${FFMPEG_VLC_PREFIX}/{include,lib/lib*VLC.dylib,lib/pkgconfig}
    699     }
    700 
    701     livecheck.type      regex
    702     livecheck.url       ${master_sites}
    703     livecheck.regex     "ffmpeg-(\\d+(?:\\.\\d+)*)${extract.suffix}"
    704 
    705570}
    706571
    707572# kate: backspace-indents true; indent-pasted-text true; indent-width 4; keep-extra-spaces true; remove-trailing-spaces modified; replace-tabs true; replace-tabs-save true; syntax Tcl/Tk; tab-indents true; tab-width 4;
  • new file multimedia/VLC/files/patch-ffmpeg3-compat.diff

    diff --git a/multimedia/VLC/files/patch-ffmpeg3-compat.diff b/multimedia/VLC/files/patch-ffmpeg3-compat.diff
    new file mode 100644
    index 00000000..7dc54118
    - +  
     1Submitted By:            Armin K <krejzi au email do com>
     2Date:                    2016-05-06
     3Initial Package Version: 2.2.3
     4Upstream Status:         Committed
     5Origin:                  Upstream
     6Description:             Fixes building against ffmpeg3
     7                         Rediffed for version 2.2.3 by Bruce Dubbs
     8
     9diff -Naur  configure  configure
     10---  configure  2016-04-04 19:45:51.000000000 -0500
     11+++  configure  2016-05-06 22:39:24.859030920 -0500
     12@@ -36549,7 +36549,7 @@
     13 
     14     if test -n "$PKG_CONFIG" && \
     15     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libavutil < 55\""; } >&5
     16-  ($PKG_CONFIG --exists --print-errors "libavutil < 55") 2>&5
     17+  ($PKG_CONFIG --exists --print-errors "libavutil > 55") 2>&5
     18   ac_status=$?
     19   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     20   test $ac_status = 0; }; then
     21@@ -36843,7 +36843,7 @@
     22     ffmpeg)
     23       if test -n "$PKG_CONFIG" && \
     24     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libavcodec >= 57.10.100\""; } >&5
     25-  ($PKG_CONFIG --exists --print-errors "libavcodec >= 57.10.100") 2>&5
     26+  ($PKG_CONFIG --exists --print-errors "libavcodec >= 60.10.100") 2>&5
     27   ac_status=$?
     28   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     29   test $ac_status = 0; }; then
     30@@ -36927,7 +36927,7 @@
     31       ffmpeg)
     32         if test -n "$PKG_CONFIG" && \
     33     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libavcodec >= 57.10.100\""; } >&5
     34-  ($PKG_CONFIG --exists --print-errors "libavcodec >= 57.10.100") 2>&5
     35+  ($PKG_CONFIG --exists --print-errors "libavcodec >= 60.10.100") 2>&5
     36   ac_status=$?
     37   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     38   test $ac_status = 0; }; then
     39@@ -45119,7 +45119,7 @@
     40     ffmpeg) av_vdpau_ver="55.42.100"
     41       if test -n "$PKG_CONFIG" && \
     42     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libavcodec >= 57.10.100\""; } >&5
     43-  ($PKG_CONFIG --exists --print-errors "libavcodec >= 57.10.100") 2>&5
     44+  ($PKG_CONFIG --exists --print-errors "libavcodec >= 60.10.100") 2>&5
     45   ac_status=$?
     46   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
     47   test $ac_status = 0; }; then
     48diff -Naur  modules/codec/avcodec/audio.c  modules/codec/avcodec/audio.c
     49---  modules/codec/avcodec/audio.c      2015-12-08 10:18:56.000000000 -0600
     50+++  modules/codec/avcodec/audio.c      2016-05-06 22:39:24.859030920 -0500
     51@@ -36,12 +36,11 @@
     52 #include <vlc_codec.h>
     53 #include <vlc_avcodec.h>
     54 
     55+#include "avcodec.h"
     56+
     57 #include <libavcodec/avcodec.h>
     58 #include <libavutil/mem.h>
     59 
     60-#include <libavutil/audioconvert.h>
     61-
     62-#include "avcodec.h"
     63 
     64 /*****************************************************************************
     65  * decoder_sys_t : decoder descriptor
     66diff -Naur  modules/codec/avcodec/avcommon_compat.h  modules/codec/avcodec/avcommon_compat.h
     67---  modules/codec/avcodec/avcommon_compat.h    2015-03-01 08:07:35.000000000 -0600
     68+++  modules/codec/avcodec/avcommon_compat.h    2016-05-06 22:39:24.859030920 -0500
     69@@ -506,6 +506,15 @@
     70 
     71 #endif /* HAVE_LIBAVUTIL_AVUTIL_H */
     72 
     73+#if LIBAVUTIL_VERSION_MAJOR >= 55
     74+# define FF_API_AUDIOCONVERT 1
     75+#endif
     76+
     77+/* libavutil/pixfmt.h */
     78+#ifndef PixelFormat
     79+# define PixelFormat AVPixelFormat
     80+#endif
     81+
     82 #ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
     83 # include <libavformat/avformat.h>
     84 
     85diff -Naur  modules/codec/avcodec/encoder.c  modules/codec/avcodec/encoder.c
     86---  modules/codec/avcodec/encoder.c    2015-10-21 11:36:45.000000000 -0500
     87+++  modules/codec/avcodec/encoder.c    2016-05-06 22:39:24.860030887 -0500
     88@@ -41,7 +41,6 @@
     89 #include <vlc_cpu.h>
     90 
     91 #include <libavcodec/avcodec.h>
     92-#include <libavutil/audioconvert.h>
     93 
     94 #include "avcodec.h"
     95 #include "avcommon.h"
     96@@ -311,7 +310,7 @@
     97     else if( !GetFfmpegCodec( p_enc->fmt_out.i_codec, &i_cat, &i_codec_id,
     98                              &psz_namecodec ) )
     99     {
     100-        if( FindFfmpegChroma( p_enc->fmt_out.i_codec ) == PIX_FMT_NONE )
     101+        if( FindFfmpegChroma( p_enc->fmt_out.i_codec ) == AV_PIX_FMT_NONE )
     102             return VLC_EGENERIC; /* handed chroma output */
     103 
     104         i_cat      = VIDEO_ES;
     105@@ -1017,7 +1016,7 @@
     106         }
     107     }
     108 
     109-    p_sys->frame = avcodec_alloc_frame();
     110+    p_sys->frame = av_frame_alloc();
     111     if( !p_sys->frame )
     112     {
     113         goto error;
     114@@ -1088,7 +1087,8 @@
     115     AVFrame *frame = NULL;
     116     if( likely(p_pict) ) {
     117         frame = p_sys->frame;
     118-        avcodec_get_frame_defaults( frame );
     119+        av_frame_unref( frame );
     120+
     121         for( i_plane = 0; i_plane < p_pict->i_planes; i_plane++ )
     122         {
     123             p_sys->frame->data[i_plane] = p_pict->p[i_plane].p_pixels;
     124@@ -1329,7 +1329,7 @@
     125     //How much we need to copy from new packet
     126     const int leftover = leftover_samples * p_sys->p_context->channels * p_sys->i_sample_bytes;
     127 
     128-    avcodec_get_frame_defaults( p_sys->frame );
     129+    av_frame_unref( p_sys->frame );
     130     p_sys->frame->format     = p_sys->p_context->sample_fmt;
     131     p_sys->frame->nb_samples = leftover_samples + p_sys->i_samples_delay;
     132 
     133@@ -1451,7 +1451,8 @@
     134     while( ( p_aout_buf->i_nb_samples >= p_sys->i_frame_size ) ||
     135            ( p_sys->b_variable && p_aout_buf->i_nb_samples ) )
     136     {
     137-        avcodec_get_frame_defaults( p_sys->frame );
     138+        av_frame_unref( p_sys->frame );
     139+
     140         if( p_sys->b_variable )
     141             p_sys->frame->nb_samples = p_aout_buf->i_nb_samples;
     142         else
     143diff -Naur  modules/codec/avcodec/vaapi.c  modules/codec/avcodec/vaapi.c
     144---  modules/codec/avcodec/vaapi.c      2014-11-16 12:57:58.000000000 -0600
     145+++  modules/codec/avcodec/vaapi.c      2016-05-06 22:39:24.860030887 -0500
     146@@ -595,7 +595,7 @@
     147         return err;
     148 
     149     /* Only VLD supported */
     150-    p_va->pix_fmt = PIX_FMT_VAAPI_VLD;
     151+    p_va->pix_fmt = AV_PIX_FMT_VAAPI_VLD;
     152     p_va->setup = Setup;
     153     p_va->get = Get;
     154     p_va->release = Release;
     155diff -Naur  modules/codec/avcodec/video.c  modules/codec/avcodec/video.c
     156---  modules/codec/avcodec/video.c      2016-04-04 19:45:24.000000000 -0500
     157+++  modules/codec/avcodec/video.c      2016-05-06 22:39:24.860030887 -0500
     158@@ -234,7 +234,7 @@
     159     p_sys->p_codec = p_codec;
     160     p_sys->i_codec_id = i_codec_id;
     161     p_sys->psz_namecodec = psz_namecodec;
     162-    p_sys->p_ff_pic = avcodec_alloc_frame();
     163+    p_sys->p_ff_pic = av_frame_alloc();
     164     p_sys->b_delayed_open = true;
     165     p_sys->p_va = NULL;
     166     vlc_sem_init( &p_sys->sem_mt, 0 );
     167@@ -446,7 +446,7 @@
     168     if( ffmpeg_OpenCodec( p_dec ) < 0 )
     169     {
     170         msg_Err( p_dec, "cannot open codec (%s)", p_sys->psz_namecodec );
     171-        avcodec_free_frame( &p_sys->p_ff_pic );
     172+        av_frame_free( &p_sys->p_ff_pic );
     173         vlc_sem_destroy( &p_sys->sem_mt );
     174         free( p_sys );
     175         return VLC_EGENERIC;
     176@@ -826,7 +826,7 @@
     177     wait_mt( p_sys );
     178 
     179     if( p_sys->p_ff_pic )
     180-        avcodec_free_frame( &p_sys->p_ff_pic );
     181+        av_frame_free( &p_sys->p_ff_pic );
     182 
     183     if( p_sys->p_va )
     184         vlc_va_Delete( p_sys->p_va );
     185diff -Naur  configure.ac  configure.ac
     186--- configure.ac.orig   2017-07-14 17:31:03.000000000 +0200
     187+++ configure.ac        2017-07-14 17:19:32.000000000 +0200
     188@@ -2305,8 +2305,8 @@
     189 [  --enable-avcodec        libavcodec codec (default enabled)])
     190 AS_IF([test "${enable_avcodec}" != "no"], [
     191   PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 53.34.0 libavutil >= 51.22.0], [
     192-    PKG_CHECK_EXISTS([libavutil < 55],, [
     193-      AC_MSG_ERROR([libavutil versions 55 and later are not supported.])
     194+    PKG_CHECK_EXISTS([libavutil < 56],, [
     195+      AC_MSG_ERROR([libavutil versions 56 and later are not supported.])
     196     ])
     197     VLC_SAVE_FLAGS
     198     CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
     199@@ -2364,8 +2364,8 @@
     200 AS_IF([test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"], [
     201   case "${avfork}" in
     202     ffmpeg)
     203-      PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [
     204-        AC_MSG_ERROR([VA API requires FFmpeg libavcodec < 57.10 or libav.])
     205+      PKG_CHECK_EXISTS([libavcodec >= 60.10.100], [
     206+        AC_MSG_ERROR([VA API requires FFmpeg libavcodec < 60.10 or libav.])
     207       ])
     208       ;;
     209   esac
     210@@ -2398,8 +2398,8 @@
     211   AS_IF([test "x${have_avcodec}" = "xyes"], [
     212     case "${avfork}" in
     213       ffmpeg)
     214-        PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [
     215-          AC_MSG_ERROR([DXVA2 requires FFmpeg libavcodec < 57.10 or libav.])
     216+        PKG_CHECK_EXISTS([libavcodec >= 60.10.100], [
     217+          AC_MSG_ERROR([DXVA2 requires FFmpeg libavcodec < 60.10 or libav.])
     218         ])
     219         ;;
     220     esac
     221@@ -3162,8 +3162,8 @@
     222   case "${avfork}" in
     223     libav) av_vdpau_ver="55.26.0" ;;
     224     ffmpeg) av_vdpau_ver="55.42.100"
     225-      PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [
     226-        AC_MSG_ERROR([VDPAU requires FFmpeg libavcodec < 57.10 or libav.])
     227+      PKG_CHECK_EXISTS([libavcodec >= 60.10.100], [
     228+        AC_MSG_ERROR([VDPAU requires FFmpeg libavcodec < 60.10 or libav.])
     229       ])
     230       ;;
     231   esac
  • new file multimedia/VLC/files/patch-use-NSGetEnviron.diff

    diff --git a/multimedia/VLC/files/patch-use-NSGetEnviron.diff b/multimedia/VLC/files/patch-use-NSGetEnviron.diff
    new file mode 100644
    index 00000000..36d84f22
    - +  
     1--- modules/misc/inhibit/orig.xdg.c     2014-08-14 09:20:04.000000000 +0200
     2+++ modules/misc/inhibit/xdg.c  2017-08-18 14:11:43.000000000 +0200
     3@@ -48,7 +48,7 @@
     4     posix_spawnattr_t attr;
     5 };
     6 
     7-extern char **environ;
     8+#include <crt_externs.h>
     9 
     10 static void Timer (void *data)
     11 {
     12@@ -60,7 +60,7 @@
     13     pid_t pid;
     14 
     15     int err = posix_spawnp (&pid, "xdg-screensaver", NULL, &sys->attr,
     16-                            argv, environ);
     17+                            argv, *_NSGetEnviron());
     18     if (err == 0)
     19     {
     20         int status;
     21--- modules/stream_filter/orig.decomp.c 2015-04-13 21:54:35.000000000 +0200
     22+++ modules/stream_filter/decomp.c      2017-08-18 14:11:46.000000000 +0200
     23@@ -92,7 +92,7 @@
     24     int64_t      pts_delay;
     25 };
     26 
     27-extern char **environ;
     28+#include <crt_externs.h>
     29 
     30 static const size_t bufsize = 65536;
     31 #ifdef HAVE_VMSPLICE
     32@@ -361,7 +361,7 @@
     33                 if (!posix_spawn_file_actions_adddup2 (&actions, comp[0], 0)
     34                  && !posix_spawn_file_actions_adddup2 (&actions, uncomp[1], 1)
     35                  && !posix_spawnp (&p_sys->pid, path, &actions, NULL, argv,
     36-                                   environ))
     37+                                   *_NSGetEnviron()))
     38                 {
     39                     if (vlc_clone (&p_sys->thread, Thread, stream,
     40                                    VLC_THREAD_PRIORITY_INPUT) == 0)