Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Universal SoundSource for FFmpeg 4.x #1356

Merged
merged 48 commits into from
Sep 14, 2019
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
eed9f2a
Add new SoundSource for FFmpeg 3.1 (and beyond)
uklotzde Sep 24, 2017
c511ed2
Exclude deprecated init function
uklotzde May 2, 2018
37f3a0a
Fix deprecation warnings
uklotzde Sep 19, 2018
fe20da5
Fix conversion between decoded stream time and frame index
uklotzde Oct 1, 2018
85e424a
Fix pointer initialization before reading decoded sample data
uklotzde Oct 1, 2018
a7e58f5
Adjust priority of FFmpeg SoundSource
uklotzde Oct 1, 2018
f672b0f
Merge branch 'master' of git@github.com:mixxxdj/mixxx.git into ffmpeg31
uklotzde Feb 8, 2019
f21fe32
Fix decoding for FFmpeg 4.x
uklotzde Feb 8, 2019
adb6c49
Increase required FFmpeg version from 3.1 to 4.0
uklotzde Feb 8, 2019
808be94
Enable SoundSourceFFmpeg4 in AppVeyor CI build
uklotzde Feb 8, 2019
913ff3e
Prevent reallocation of sample buffer while decoding
uklotzde Feb 8, 2019
265bafd
Suppress warning while decoding the first unreadable samples
uklotzde Feb 8, 2019
af7f520
Delete unused code and consolidate stream time calculation
uklotzde Feb 9, 2019
e683d4e
Enable Opus decoding
uklotzde Feb 9, 2019
644b0e8
Handle a possible error when decoding
uklotzde Feb 9, 2019
2322ab8
Unconditionally buffer unread decoded sample data
uklotzde Feb 9, 2019
5562c6c
Disable FFmpeg 4.x for Ubuntu 18.04
uklotzde Mar 9, 2019
1a1a8a6
Reformat code
uklotzde Mar 9, 2019
a22ab0b
Fix decoding offset by taking start_time >= 0 into account
uklotzde Mar 26, 2019
914c259
Enable the SoundSourceFFmpeg4 for macOS builds
uklotzde Mar 27, 2019
b59a615
Adjust feature name
uklotzde Apr 9, 2019
e994df9
Fix error messages about missing build dependencies
uklotzde Apr 10, 2019
bbafbac
Auto-format source code
uklotzde May 8, 2019
8cc3e6a
Promote FFmpeg4 feature from "experimental" to "regular"
uklotzde May 8, 2019
f1a84ff
Add #define for enabling/disabling tracing
uklotzde May 26, 2019
32dd69a
Fix mapping of stream start/end time to frame range
uklotzde May 26, 2019
f157022
Add a WMA test file
uklotzde May 30, 2019
8bbacbe
Fix debug assertion for some M4A files with start_time > 0
uklotzde May 30, 2019
935563e
Delete obsolete #include directive
uklotzde Jun 30, 2019
2d7392a
Merge branch 'master' of git@github.com:mixxxdj/mixxx.git into ffmpeg31
uklotzde Jun 30, 2019
5cf2f26
Replace SoundSourceFFmpeg with new implementation for FFmpeg 4.x
uklotzde Jul 3, 2019
8d68426
Merge branch 'master' of git@github.com:mixxxdj/mixxx.git into ffmpeg31
uklotzde Jul 7, 2019
3e9c614
Rename SoundSource provider
uklotzde Jul 8, 2019
7711cd2
Merge branch 'master' of git@github.com:mixxxdj/mixxx.git into ffmpeg31
uklotzde Jul 22, 2019
38ece01
Merge branch 'master' of git@github.com:mixxxdj/mixxx.git into ffmpeg31
uklotzde Aug 17, 2019
6a96f4a
Change priority from LOWER to LOWEST
uklotzde Sep 1, 2019
fa863d7
Extract buffering/seeking functions to improve readability
uklotzde Sep 8, 2019
52bd35a
Fix debug assertion for some MP3 VBR files
uklotzde Sep 8, 2019
da6ba4f
Fix formatting of comments
uklotzde Sep 8, 2019
7bd641e
Add note about MP3 preroll frames on seeking
uklotzde Sep 8, 2019
33a3aaf
Extract code for consuming the next packet into function
uklotzde Sep 8, 2019
3981c1c
Extract code for initializing resampling into function
uklotzde Sep 8, 2019
0011c88
Add comments about how each decoded frame is processed
uklotzde Sep 8, 2019
04ef6af
Add comment about desired channel count and layout
uklotzde Sep 8, 2019
79938ba
Add constant and comment about pre-allocated codec sample buffer
uklotzde Sep 8, 2019
d151852
Add comment about sample-accurate seeking in the stream
uklotzde Sep 8, 2019
d8c78d7
Add comment about unrecoverable seek errors
uklotzde Sep 8, 2019
5a85b9a
Extract resampling of decoded frame into function
uklotzde Sep 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ available_features = [features.Mad,
features.Verbose,
features.Optimize,
features.FAAD,
features.FFmpeg,
features.WavPack,
features.ModPlug,
features.TestSuite,
Expand All @@ -61,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
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +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:
- 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
69 changes: 19 additions & 50 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,28 +758,27 @@ 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)
vars.Add('ffmpeg', 'Set to 1 to enable FFmpeg 4.x support', 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'
if not conf.CheckForPKG('libavcodec', '58'):
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'
if not conf.CheckForPKG('libavformat', '58'):
raise Exception('Missing libavformat or it\'s too old! '
'It can be separated from main package so '
'check your operating system packages.')
if not conf.CheckForPKG('libswresample', '3.1'):
raise Exception('Missing libswresample or it\'s too old! '
'It can be separated from main package so '
'check your operating system packages.')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a space before each string break above else it will write "socheck"


# Needed to build new FFmpeg
Expand All @@ -788,54 +787,24 @@ def configure(self, build, conf):
build.env.Append(CCFLAGS='-D__STDC_FORMAT_MACROS')

# Grabs the libs and cflags for FFmpeg
build.env.ParseConfig('pkg-config libswresample --silence-errors \
--cflags --libs')
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__')
build.env.Append(CPPDEFINES='__FFMPEG__')
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'))
raise Exception('Building with FFmpeg 4.x is not supported'
'for your platform')

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']
return ['src/sources/soundsourceffmpeg.cpp']


class Optimize(Feature):
Expand Down