summaryrefslogtreecommitdiffstats
path: root/media/libsoundtouch/update.sh
blob: 3894ee69f0479a0b529d75e706c64342fcab4747 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# Usage: ./update.sh <SoundTouch_src_directory>
#
# Copies the needed files from a directory containing the original
# soundtouch sources that we need for HTML5 media playback rate change.

cp $1/COPYING.TXT LICENSE
cp $1/source/SoundTouch/AAFilter.cpp src
cp $1/source/SoundTouch/AAFilter.h src
cp $1/source/SoundTouch/cpu_detect.h src
cp $1/source/SoundTouch/cpu_detect_x86.cpp src
cp $1/source/SoundTouch/FIFOSampleBuffer.cpp src
cp $1/source/SoundTouch/FIRFilter.cpp src
cp $1/source/SoundTouch/FIRFilter.h src
cp $1/source/SoundTouch/InterpolateLinear.cpp src
cp $1/source/SoundTouch/InterpolateLinear.h src
cp $1/source/SoundTouch/InterpolateCubic.cpp src
cp $1/source/SoundTouch/InterpolateCubic.h src
cp $1/source/SoundTouch/InterpolateShannon.cpp src
cp $1/source/SoundTouch/InterpolateShannon.h src
cp $1/source/SoundTouch/mmx_optimized.cpp src
cp $1/source/SoundTouch/RateTransposer.cpp src
cp $1/source/SoundTouch/RateTransposer.h src
cp $1/source/SoundTouch/SoundTouch.cpp src
cp $1/source/SoundTouch/sse_optimized.cpp src
cp $1/source/SoundTouch/TDStretch.cpp src
cp $1/source/SoundTouch/TDStretch.h src
cp $1/include/SoundTouch.h src
cp $1/include/FIFOSampleBuffer.h src
cp $1/include/FIFOSamplePipe.h src
cp $1/include/SoundTouch.h src
cp $1/include/STTypes.h src

# Remove the Windows line ending characters from the files.
for i in src/*
do
  cat $i | tr -d '\015' > $i.lf
  mv $i.lf $i
done

# Patch the imported files.
patch -p1 < moz-libsoundtouch.patch

if [ -d $1/.git ]; then
  rev=$(cd $1 && git rev-parse --verify HEAD)
  date=$(cd $1 && git show -s --format=%ci HEAD)
  dirty=$(cd $1 && git diff-index --name-only HEAD)
  set +e
  pre_rev=$(grep -o '[[:xdigit:]]\{40\}' moz.yaml)
  commits=$(cd $1 && git log --pretty=format:'%h - %s' $pre_rev..$rev)
  set -e
fi

if [ -n "$rev" ]; then
  version=$rev
  if [ -n "$dirty" ]; then
    version=$version-dirty
    echo "WARNING: updating from a dirty git repository."
  fi
  sed -i.bak -e "s/^ *release:.*/  release: \"$version ($date)\"/" moz.yaml
  if [[ ! "$( grep "$version" moz.yaml )" ]]; then
    echo "Updating moz.yaml failed."
    exit 1
  fi
  rm moz.yaml.bak
  [[ -n "$commits" ]] && echo -e "Pick commits:\n$commits"
else
  echo "Remember to update moz.yaml with the version details."
fi