a684f95
#!/bin/bash
a684f95
# Copyright 2013 Tomas Popela <tpopela@redhat.com>
a684f95
# Copyright 2016-2017 Kevin Kofler <Kevin@tigcc.ticalc.org>
a684f95
# Permission is hereby granted, free of charge, to any person obtaining
a684f95
# a copy of this software and associated documentation files (the
a684f95
# "Software"), to deal in the Software without restriction, including
a684f95
# without limitation the rights to use, copy, modify, merge, publish,
a684f95
# distribute, sublicense, and/or sell copies of the Software, and to
a684f95
# permit persons to whom the Software is furnished to do so, subject to
a684f95
# the following conditions:
a684f95
#
a684f95
# The above copyright notice and this permission notice shall be included
a684f95
# in all copies or substantial portions of the Software.
a684f95
#
a684f95
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
a684f95
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
a684f95
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
a684f95
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
a684f95
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
a684f95
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
a684f95
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
a684f95
a684f95
where=`pwd`
a684f95
a684f95
generated_files=`./get_free_ffmpeg_source_files.py $1 0`
a684f95
generated_files_headers="${generated_files//.c/.h}"
a684f95
generated_files_headers="${generated_files_headers//.S/.h}"
a684f95
generated_files_headers="${generated_files_headers//.asm/.h}"
a684f95
a684f95
cd $1/third_party/ffmpeg
a684f95
a684f95
header_files="  libavcodec/x86/inline_asm.h \
a684f95
                libavcodec/x86/hpeldsp.h \
a684f95
                libavcodec/x86/mathops.h \
a684f95
                libavcodec/x86/vpx_arith.h \
a684f95
                libavcodec/aarch64/vp8dsp.h \
a684f95
                libavcodec/arm/vp8dsp.h \
a684f95
                libavcodec/arm/vpx_arith.h \
a684f95
                libavcodec/aac.h \
a684f95
                libavcodec/aacps.h \
a684f95
                libavcodec/aacpsdsp.h \
a684f95
                libavcodec/aacsbrdata.h \
a684f95
                libavcodec/aac_ac3_parser.h \
a684f95
                libavcodec/aac_defines.h \
a684f95
                libavcodec/ac3.h \
a684f95
                libavcodec/ac3defs.h \
a684f95
                libavcodec/ac3tab.h \
a684f95
                libavcodec/adts_header.h \
a684f95
                libavcodec/avcodec.h \
a684f95
                libavcodec/blockdsp.h \
a684f95
                libavcodec/bytestream.h \
a684f95
                libavcodec/cbrt_data.h \
a684f95
                libavcodec/cbrt_tablegen.h \
a684f95
                libavcodec/codec.h \
a684f95
                libavcodec/codec_id.h \
a684f95
                libavcodec/codec_internal.h \
a684f95
                libavcodec/codec_par.h \
a684f95
                libavcodec/dct.h \
a684f95
                libavcodec/dct32.h \
a684f95
                libavcodec/defs.h \
a684f95
                libavcodec/dv.h \
a684f95
                libavcodec/error_resilience.h \
a684f95
                libavcodec/fdctdsp.h \
a684f95
                libavcodec/fft.h \
a684f95
                libavcodec/fft-internal.h \
a684f95
                libavcodec/fft_table.h \
a684f95
                libavcodec/flac.h \
a684f95
                libavcodec/flacdsp.h \
a684f95
                libavcodec/flac_parse.h \
a684f95
                libavcodec/frame_thread_encoder.h \
a684f95
                libavcodec/get_bits.h \
a684f95
                libavcodec/h263dsp.h \
a684f95
                libavcodec/h264chroma.h \
a684f95
                libavcodec/hevc.h \
a684f95
                libavcodec/hpeldsp.h \
a684f95
                libavcodec/hwaccels.h \
a684f95
                libavcodec/hwconfig.h \
a684f95
                libavcodec/idctdsp.h \
a684f95
                libavcodec/internal.h \
a684f95
                libavcodec/kbdwin.h \
a684f95
                libavcodec/mathops.h \
a684f95
                libavcodec/mdct15.c \
a684f95
                libavcodec/mdct15.h \
a684f95
                libavcodec/me_cmp.h \
a684f95
                libavcodec/mlp_parse.h \
a684f95
                libavcodec/motion_est.h \
a684f95
                libavcodec/mpeg12.h \
a684f95
                libavcodec/mpeg12data.h \
a684f95
                libavcodec/mpeg12vlc.h \
a684f95
                libavcodec/mpegaudio.h \
a684f95
                libavcodec/mpegaudiodecheader.h \
a684f95
                libavcodec/mpegaudiodec_common_tablegen.h \
a684f95
                libavcodec/mpegaudiodsp.h \
a684f95
                libavcodec/mpegaudio_tablegen.h \
a684f95
                libavcodec/mpegpicture.h \
a684f95
                libavcodec/mpegutils.h \
a684f95
                libavcodec/mpegvideo.h \
a684f95
                libavcodec/mpegvideodata.h \
a684f95
                libavcodec/mpegvideoencdsp.h \
a684f95
                libavcodec/options_table.h \
a684f95
                libavcodec/opus.h \
a684f95
                libavcodec/opusdsp.h \
a684f95
                libavcodec/opus_celt.h \
a684f95
                libavcodec/opus_pvq.h \
a684f95
                libavcodec/opus_rc.h \
a684f95
                libavcodec/packet.h \
a684f95
                libavcodec/packet_internal.h \
a684f95
                libavcodec/pcm_tablegen.h \
a684f95
                libavcodec/pixblockdsp.h \
a684f95
                libavcodec/pixels.h \
a684f95
                libavcodec/png.h \
a684f95
                libavcodec/pngdsp.h \
a684f95
                libavcodec/put_bits.h \
a684f95
                libavcodec/qpeldsp.h \
a684f95
                libavcodec/ratecontrol.h \
a684f95
                libavcodec/rectangle.h \
a684f95
                libavcodec/rl.h \
a684f95
                libavcodec/rnd_avg.h \
a684f95
                libavcodec/sbr.h \
a684f95
                libavcodec/sbrdsp.h \
a684f95
                libavcodec/sinewin.h \
a684f95
                libavcodec/sinewin_tablegen.h \
a684f95
                libavcodec/startcode.h \
a684f95
                libavcodec/thread.h \
a684f95
                libavcodec/threadframe.h \
a684f95
                libavcodec/unary.h \
a684f95
                libavcodec/version.h \
a684f95
                libavcodec/version_major.h \
a684f95
                libavcodec/videodsp.h \
a684f95
                libavcodec/vlc.h \
a684f95
                libavcodec/vorbisdsp.h \
a684f95
                libavcodec/vp3data.h \
a684f95
                libavcodec/vp4data.h \
a684f95
                libavcodec/vp3dsp.h \
a684f95
                libavcodec/vp56.h \
a684f95
                libavcodec/vp56dsp.h \
a684f95
                libavcodec/vp8data.h \
a684f95
                libavcodec/vp8dsp.h \
a684f95
                libavcodec/vp89_rac.h \
a684f95
                libavformat/apetag.h \
a684f95
                libavformat/avformat.h \
a684f95
                libavformat/dv.h \
a684f95
                libavformat/img2.h \
a684f95
                libavformat/internal.h \
a684f95
                libavformat/mov_chan.h \
a684f95
                libavformat/pcm.h \
a684f95
                libavformat/rdt.h \
a684f95
                libavformat/rtp.h \
a684f95
                libavformat/rtpdec.h \
a684f95
                libavformat/spdif.h \
a684f95
                libavformat/srtp.h \
a684f95
                libavformat/options_table.h \
a684f95
                libavformat/version.h \
a684f95
                libavformat/version_major.h \
a684f95
                libavformat/w64.h \
a684f95
                libavutil/aarch64/cpu.h \
a684f95
                libavutil/x86/asm.h \
a684f95
                libavutil/x86/bswap.h \
a684f95
                libavutil/x86/cpu.h \
a684f95
                libavutil/x86/emms.h
a684f95
                libavutil/x86/intreadwrite.h \
a684f95
                libavutil/x86/intmath.h
a684f95
                libavutil/x86/timer.h \
a684f95
                libavutil/attributes.h \
a684f95
                libavutil/attributes_internal.h \
a684f95
                libavutil/audio_fifo.h \
a684f95
                libavutil/avassert.h \
a684f95
                libavutil/avutil.h \
a684f95
                libavutil/bswap.h \
a684f95
                libavutil/common.h \
a684f95
                libavutil/colorspace.h \
a684f95
                libavutil/cpu.h \
a684f95
                libavutil/cpu_internal.h \
a684f95
                libavutil/dynarray.h \
a684f95
                libavutil/ffmath.h \
a684f95
                libavutil/fixed_dsp.h \
a684f95
                libavutil/float_dsp.h \
a684f95
                libavutil/imgutils.h \
a684f95
                libavutil/imgutils_internal.h \
a684f95
                libavutil/internal.h \
a684f95
                libavutil/intfloat.h \
a684f95
                libavutil/intreadwrite.h \
a684f95
                libavutil/libm.h \
a684f95
                libavutil/lls.h \
a684f95
                libavutil/macros.h \
a684f95
                libavutil/pixfmt.h \
a684f95
                libavutil/qsort.h \
a684f95
                libavutil/replaygain.h \
a684f95
                libavutil/softfloat.h \
a684f95
                libavutil/softfloat_tables.h \
a684f95
                libavutil/thread.h \
a684f95
                libavutil/timer.h \
a684f95
                libavutil/timestamp.h \
a684f95
                libavutil/tx_priv.h \
a684f95
                libavutil/version.h \
a684f95
                libswresample/swresample.h \
a684f95
                libswresample/version.h \
a684f95
                libswresample/version_major.h \
a684f95
                compat/va_copy.h \
a684f95
                compat/atomics/gcc/stdatomic.h "
a684f95
a684f95
manual_files="  libavcodec/aarch64/fft_neon.S \
a684f95
                libavcodec/aarch64/h264pred_neon.S \
a684f95
                libavcodec/aarch64/hpeldsp_neon.S \
a684f95
                libavcodec/aarch64/mdct_neon.S \
a684f95
                libavcodec/aarch64/neon.S \
a684f95
                libavcodec/aarch64/vorbisdsp_neon.S \
a684f95
                libavcodec/aarch64/vorbisdsp_init.c \
a684f95
                libavcodec/aarch64/vp8dsp_neon.S \
a684f95
                libavcodec/x86/hpeldsp.asm \
a684f95
                libavcodec/x86/hpeldsp_rnd_template.c \
a684f95
                libavcodec/x86/mdct15.asm \
a684f95
                libavcodec/x86/mdct15_init.c \
a684f95
                libavcodec/x86/rnd_template.c \
a684f95
                libavcodec/x86/videodsp.asm \
a684f95
                libavcodec/x86/videodsp_init.c \
a684f95
                libavcodec/x86/vorbisdsp_init.c \
a684f95
                libavcodec/x86/vp3dsp.asm \
a684f95
                libavcodec/x86/vp8dsp.asm \
a684f95
                libavcodec/autorename_libavcodec_mdct15.c \
a684f95
                libavcodec/bit_depth_template.c \
a684f95
                libavcodec/fft_template.c \
a684f95
                libavcodec/flacdec.c \
a684f95
                libavcodec/flacdsp.c \
a684f95
                libavcodec/flacdsp_template.c \
a684f95
                libavcodec/flacdsp_lpc_template.c \
a684f95
                libavcodec/h264pred_template.c \
a684f95
                libavcodec/hpel_template.c \
a684f95
                libavcodec/hpeldsp.c \
a684f95
                libavcodec/mdct15.c \
a684f95
                libavcodec/mdct_template.c \
a684f95
                libavcodec/options.c \
a684f95
                libavcodec/pcm.c \
a684f95
                libavcodec/pel_template.c \
a684f95
                libavcodec/utils.c \
a684f95
                libavcodec/videodsp.c \
a684f95
                libavcodec/videodsp_template.c \
a684f95
                libavcodec/vorbisdsp.c \
a684f95
                libavcodec/vp3dsp.c \
a684f95
                libavcodec/vp8dsp.c \
a684f95
                libavformat/flacdec.c \
a684f95
                libavformat/options.c \
a684f95
                libavformat/pcm.c \
a684f95
                libavformat/utils.c \
a684f95
                libavformat/version.c \
a684f95
                libavutil/aarch64/asm.S \
a684f95
                libavutil/aarch64/bswap.h \
a684f95
                libavutil/aarch64/cpu.c \
a684f95
                libavutil/aarch64/float_dsp_init.c \
a684f95
                libavutil/aarch64/float_dsp_neon.S \
a684f95
                libavutil/aarch64/timer.h \
a684f95
                libavutil/cpu.c \
a684f95
                libavutil/fixed_dsp.c \
a684f95
                libavutil/float_dsp.c \
a684f95
                libavutil/imgutils.c \
a684f95
                libavutil/tx_float.c \
a684f95
                libavutil/tx_template.c \
a684f95
                libavutil/utils.c \
a684f95
                libavutil/version.c \
a684f95
                libavutil/x86/cpu.c \
a684f95
                libavutil/x86/float_dsp_init.c \
a684f95
                libavutil/x86/tx_float_init.c \
a684f95
                libavutil/x86/x86inc.asm \
a684f95
                libavutil/x86/x86util.asm "
a684f95
a684f95
mp3_files="     libavcodec/aarch64/aacpsdsp_init_aarch64.c \
a684f95
                libavcodec/aarch64/aacpsdsp_neon.S \
a684f95
                libavcodec/aarch64/autorename_libavcodec_aarch64_aacpsdsp_neon.S \
a684f95
                libavcodec/aarch64/autorename_libavcodec_aarch64_sbrdsp_neon.S \
a684f95
                libavcodec/aarch64/mpegaudiodsp_init.c \
a684f95
                libavcodec/aarch64/mpegaudiodsp_neon.S \
a684f95
                libavcodec/aarch64/sbrdsp_init_aarch64.c \
a684f95
                libavcodec/aarch64/sbrdsp_neon.S \
a684f95
                libavcodec/aac_ac3_parser.c \
a684f95
                libavcodec/aac_parser.c \
a684f95
                libavcodec/aacps_float.c \
a684f95
                libavcodec/aacpsdsp_float.c \
a684f95
                libavcodec/aacsbr.c \
a684f95
                libavcodec/aactab.c \
a684f95
                libavcodec/ac3tab.c \
a684f95
                libavcodec/autorename_libavcodec_mpegaudiodsp.c \
a684f95
                libavcodec/autorename_libavcodec_sbrdsp.c \
a684f95
                libavcodec/cbrt_data.c \
a684f95
                libavcodec/dct.c \
a684f95
                libavcodec/dct32_fixed.c \
a684f95
                libavcodec/dct32_float.c \
a684f95
                libavcodec/dct32_template.c \
a684f95
                libavcodec/kbdwin.c \
a684f95
                libavcodec/mpegaudio.c \
a684f95
                libavcodec/mpegaudio_parser.c \
a684f95
                libavcodec/mpegaudiodec_fixed.c \
a684f95
                libavcodec/mpegaudiodec_template.c \
a684f95
                libavcodec/mpegaudiodecheader.c \
a684f95
                libavcodec/mpegaudiodsp.c \
a684f95
                libavcodec/mpegaudiodsp_data.c \
a684f95
                libavcodec/mpegaudiodsp_fixed.c \
a684f95
                libavcodec/mpegaudiodsp_float.c \
a684f95
                libavcodec/mpegaudiodsp_template.c \
a684f95
                libavcodec/sbrdsp.c \
a684f95
                libavcodec/sbrdsp_template.c \
a684f95
                libavcodec/sinewin.c \
a684f95
                libavcodec/x86/dct_init.c \
a684f95
                libavcodec/x86/dct32.asm \
a684f95
                libavcodec/x86/imdct36.asm \
a684f95
                libavcodec/x86/mpegaudiodsp.c \
a684f95
                libavcodec/x86/sbrdsp_init.c \
a684f95
                libavcodec/x86/sbrdsp.asm \
a684f95
                libavformat/aacdec.c \
a684f95
                libavformat/apetag.c \
a684f95
                libavformat/img2.c \
a684f95
                libavformat/mov.c \
a684f95
                libavformat/mov_chan.c \
a684f95
                libavformat/mp3dec.c "
a684f95
a684f95
other_files="   BUILD.gn \
a684f95
                Changelog \
a684f95
                COPYING.GPLv2 \
a684f95
                COPYING.GPLv3 \
a684f95
                COPYING.LGPLv2.1 \
a684f95
                COPYING.LGPLv3 \
a684f95
                CREDITS \
a684f95
                CREDITS.chromium \
a684f95
                ffmpeg_generated.gni \
a684f95
                ffmpeg_options.gni \
a684f95
                INSTALL.md \
a684f95
                LICENSE.md \
a684f95
                MAINTAINERS \
a684f95
                OWNERS \
a684f95
                README.chromium \
a684f95
                README.md \
a684f95
                RELEASE "
a684f95
a684f95
files=$generated_files$manual_files$other_files$generated_files_headers$header_files
a684f95
a684f95
for f in $files
a684f95
do
a684f95
    dir_name=`dirname $f`/
a684f95
    if [[ $dir_name == ./ ]]; then
a684f95
        dir_name=
a684f95
    else
a684f95
        mkdir -p ../tmp_ffmpeg/$dir_name
a684f95
    fi
a684f95
a684f95
    cp -p $f ../tmp_ffmpeg/$dir_name 2>/dev/null
a684f95
done
a684f95
a684f95
# whole directory
a684f95
mkdir -p ../tmp_ffmpeg/chromium
a684f95
cp -pr chromium/config ../tmp_ffmpeg/chromium/
a684f95
a684f95
cd ..
a684f95
rm -rf ffmpeg
a684f95
mv tmp_ffmpeg ffmpeg
a684f95
a684f95
cd $where