Skip to content

Commit

Permalink
Replace SoundSourceFFmpeg with new implementation for FFmpeg 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
uklotzde committed Jul 3, 2019
1 parent 2d7392a commit 5cf2f26
Show file tree
Hide file tree
Showing 10 changed files with 1,166 additions and 2,566 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ install:
# NOTE(rryan): 2016-11-15 we are experiencing Travis timeouts for the OSX
# build. Turning off optimizations to see if that speeds up compile times.
# TODO(rryan): localecompare doesn't work on Travis with qt5 for some reason.
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export EXTRA_FLAGS=" ffmpeg4=1 optimize=none asan=0 localecompare=0" ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export EXTRA_FLAGS=" ffmpeg=1 localecompare=1" ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export EXTRA_FLAGS=" ffmpeg=1 optimize=none asan=0 localecompare=0" ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export EXTRA_FLAGS=" localecompare=1" ; fi

####
# Common Build
Expand Down
3 changes: 1 addition & 2 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ available_features = [features.Mad,
features.Verbose,
features.Optimize,
features.FAAD,
features.FFmpeg4,
features.FFmpeg,
features.WavPack,
features.ModPlug,
features.TestSuite,
Expand All @@ -62,7 +62,6 @@ available_features = [features.Mad,
# "Features" of dubious quality
features.PerfTools,
features.AsmLib,
features.FFMPEG
]

build = mixxx.MixxxBuild(target, machine, build_type,
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ for:
- sudo apt-get -y install gdb libavformat-dev libchromaprint-dev libfaad-dev libflac-dev libid3tag0-dev libmad0-dev libmodplug-dev libmp3lame-dev libmp4v2-dev libopus-dev libopusfile-dev libportmidi-dev libprotobuf-dev libqt5opengl5-dev libqt5sql5-sqlite libqt5svg5-dev librubberband-dev libshout3-dev libsndfile1-dev libsqlite3-dev libtag1-dev libupower-glib-dev libusb-1.0-0-dev libwavpack-dev portaudio19-dev protobuf-compiler qt5-default qtscript5-dev libqt5x11extras5-dev scons qt5keychain-dev liblilv-dev libsoundtouch-dev

build_script:
# ffmpeg4=1 is not supported by Ubuntu 18.04 (FFmpeg 3.4.x)
- scons -j4 test=1 mad=1 faad=1 ffmpeg=1 opus=1 modplug=1 wv=1 hss1394=0 virtualize=0 debug_assertions_fatal=1 verbose=0 localecompare=1
# ffmpeg=1 requires FFmpeg 4.0, but Ubuntu 18.04 still provides only FFmpeg 3.4.x
- scons -j4 test=1 mad=1 faad=1 opus=1 modplug=1 wv=1 hss1394=0 virtualize=0 debug_assertions_fatal=1 verbose=0 localecompare=1

test_script:
- xvfb-run -- ./mixxx-test --gtest_output=xml:test_results.xml
Expand Down
101 changes: 5 additions & 96 deletions build/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,9 +747,9 @@ def sources(self, build):
'src/encoder/encoderopus.cpp']


class FFMPEG(Feature):
class FFmpeg(Feature):
def description(self):
return "FFmpeg/Avconv support"
return "FFmpeg 4.x support"

def enabled(self, build):
build.flags['ffmpeg'] = util.get_flags(build.env, 'ffmpeg', 0)
Expand All @@ -758,98 +758,7 @@ def enabled(self, build):
return False

def add_options(self, build, vars):
vars.Add('ffmpeg', 'Set to 1 to enable FFmpeg/Avconv support \
(supported FFmpeg 0.11-2.x and Avconv 0.8.x-11.x)', 0)

def configure(self, build, conf):
if not self.enabled(build):
return

# Supported version are FFmpeg 0.11-2.x and Avconv 0.8.x-11.x
# FFmpeg is multimedia library that can be found http://ffmpeg.org/
# Avconv is fork of FFmpeg that is used mainly in Debian and Ubuntu
# that can be found http://libav.org
if build.platform_is_linux or build.platform_is_osx \
or build.platform_is_bsd:
# Check for libavcodec, libavformat
# I just randomly picked version numbers lower than mine for this
if not conf.CheckForPKG('libavcodec', '53.35.0'):
raise Exception('Missing libavcodec or it\'s too old! It can '
'be separated from main package so check your '
'operating system packages.')
if not conf.CheckForPKG('libavformat', '53.21.0'):
raise Exception('Missing libavformat or it\'s too old! '
'It can be separated from main package so '
'check your operating system packages.')

# Needed to build new FFmpeg
build.env.Append(CCFLAGS='-D__STDC_CONSTANT_MACROS')
build.env.Append(CCFLAGS='-D__STDC_LIMIT_MACROS')
build.env.Append(CCFLAGS='-D__STDC_FORMAT_MACROS')

# Grabs the libs and cflags for FFmpeg
build.env.ParseConfig('pkg-config libavcodec --silence-errors \
--cflags --libs')
build.env.ParseConfig('pkg-config libavformat --silence-errors \
--cflags --libs')
build.env.ParseConfig('pkg-config libavutil --silence-errors \
--cflags --libs')

build.env.Append(CPPDEFINES='__FFMPEGFILE__')
self.status = "Enabled"

else:
# aptitude install libavcodec-dev libavformat-dev liba52-0.7.4-dev
# libdts-dev
# Append some stuff to CFLAGS in Windows also
build.env.Append(CCFLAGS='-D__STDC_CONSTANT_MACROS')
build.env.Append(CCFLAGS='-D__STDC_LIMIT_MACROS')
build.env.Append(CCFLAGS='-D__STDC_FORMAT_MACROS')

build.env.Append(LIBS='avcodec')
build.env.Append(LIBS='avformat')
build.env.Append(LIBS='avutil')
build.env.Append(LIBS='z')
build.env.Append(LIBS='swresample')
# build.env.Append(LIBS = 'a52')
# build.env.Append(LIBS = 'dts')
build.env.Append(LIBS='gsm')
# build.env.Append(LIBS = 'dc1394_control')
# build.env.Append(LIBS = 'dl')
build.env.Append(LIBS='vorbisenc')
# build.env.Append(LIBS = 'raw1394')
build.env.Append(LIBS='vorbis')
build.env.Append(LIBS='m')
build.env.Append(LIBS='ogg')
build.env.Append(CPPDEFINES='__FFMPEGFILE__')

# Add new path for FFmpeg header files.
# Non-crosscompiled builds need this too, don't they?
if build.crosscompile and build.platform_is_windows \
and build.toolchain_is_gnu:
build.env.Append(CPPPATH=os.path.join(build.crosscompile_root,
'include', 'ffmpeg'))

def sources(self, build):
return ['src/sources/soundsourceffmpeg.cpp',
'src/encoder/encoderffmpegresample.cpp',
'src/encoder/encoderffmpegcore.cpp',
'src/encoder/encoderffmpegmp3.cpp',
'src/encoder/encoderffmpegvorbis.cpp']


class FFmpeg4(Feature):
def description(self):
return "FFmpeg 4.x support"

def enabled(self, build):
build.flags['ffmpeg4'] = util.get_flags(build.env, 'ffmpeg4', 0)
if int(build.flags['ffmpeg4']):
return True
return False

def add_options(self, build, vars):
vars.Add('ffmpeg4', 'Set to 1 to enable FFmpeg 4.x support', 0)
vars.Add('ffmpeg', 'Set to 1 to enable FFmpeg 4.x support', 0)

def configure(self, build, conf):
if not self.enabled(build):
Expand Down Expand Up @@ -887,15 +796,15 @@ def configure(self, build, conf):
build.env.ParseConfig('pkg-config libavutil --silence-errors \
--cflags --libs')

build.env.Append(CPPDEFINES='__FFMPEG4__')
build.env.Append(CPPDEFINES='__FFMPEG__')
self.status = "Enabled"

else:
raise Exception('Building with FFmpeg 4.x is not supported'
'for your platform')

def sources(self, build):
return ['src/sources/soundsourceffmpeg4.cpp']
return ['src/sources/soundsourceffmpeg.cpp']


class Optimize(Feature):
Expand Down
Loading

0 comments on commit 5cf2f26

Please sign in to comment.