Skip to content

Commit

Permalink
Adding fixes to support ios camera
Browse files Browse the repository at this point in the history
  • Loading branch information
GoBig87 authored and tito committed Feb 21, 2019
1 parent c92e27a commit 543ebd8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion kivy/core/camera/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def on_load(self):
# Load the appropriate providers
providers = ()

if platform == 'macosx':
if platform in ['macosx', 'ios']:
providers += (('avfoundation', 'camera_avfoundation',
'CameraAVFoundation'), )
elif platform == 'android':
Expand Down
2 changes: 1 addition & 1 deletion kivy/core/camera/camera_avfoundation.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class CameraAVFoundation(CameraBase):
self._resolution = (width, height)

if self._texture is None or self._texture.size != self._resolution:
self._texture = Texture.create(self._resolution)
self._texture = Texture.create(self._resolution, colorfmt='bgra')
self._texture.flip_vertical()
self.dispatch('on_load')

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def pkgconfig(*packages, **kw):
c_options['use_x11'] = False
c_options['use_wayland'] = False
c_options['use_gstreamer'] = None
c_options['use_avfoundation'] = platform == 'darwin'
c_options['use_avfoundation'] = platform in ['darwin', 'ios']
c_options['use_osx_frameworks'] = platform == 'darwin'
c_options['debug_gl'] = False

Expand Down Expand Up @@ -863,7 +863,7 @@ def determine_sdl2():
if c_options['use_avfoundation']:
import platform as _platform
mac_ver = [int(x) for x in _platform.mac_ver()[0].split('.')[:2]]
if mac_ver >= [10, 7]:
if mac_ver >= [10, 7] or platform == 'ios':
osx_flags = {
'extra_link_args': ['-framework', 'AVFoundation'],
'extra_compile_args': ['-ObjC++'],
Expand Down

0 comments on commit 543ebd8

Please sign in to comment.