Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions pythonforandroid/recipes/ffmpeg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,28 @@ def get_recipe_env(self, arch):
env['NDK'] = self.ctx.ndk_dir
return env

@staticmethod
def get_base_configure_flags():
"""Flags that must always be present before optional codecs.

Start from ``--disable-everything`` then enable Android hardware
codecs. Using assignment for the hardware flags used to drop the
disable-everything baseline (issue #3382).
"""
return [
'--disable-everything',
'--enable-jni',
'--enable-mediacodec',
]

def build_arch(self, arch):
with current_directory(self.get_build_dir(arch.arch)):
env = arch.get_env()

flags = ['--disable-everything']
flags = self.get_base_configure_flags()
cflags = []
ldflags = []

# enable hardware acceleration codecs
flags = [
'--enable-jni',
'--enable-mediacodec'
]

if 'openssl' in self.ctx.recipe_build_order:
flags += [
'--enable-version3',
Expand Down
17 changes: 17 additions & 0 deletions tests/recipes/test_ffmpeg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import unittest

from pythonforandroid.recipes.ffmpeg import FFMpegRecipe


class TestFFMpegRecipe(unittest.TestCase):
"""TestCase for recipe :mod:`~pythonforandroid.recipes.ffmpeg`."""

def test_base_configure_flags_keep_disable_everything(self):
"""
Hardware acceleration flags must append to ``--disable-everything``,
not replace it (issue #3382).
"""
flags = FFMpegRecipe.get_base_configure_flags()
self.assertEqual(flags[0], "--disable-everything")
self.assertIn("--enable-jni", flags)
self.assertIn("--enable-mediacodec", flags)