浏览代码

patches: remove patches merged upstream

Felix Paul Kühne 12 年之前
父节点
当前提交
950b94f79f

+ 0 - 573
patches/0009-new-OpenGL-ES2-video-output-module-for-iOS.patch

@@ -1,574 +0,0 @@
-From 57c4882b2ea519e1857a69c382ed892b904b7d03 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
-Date: Mon, 18 Feb 2013 20:18:01 -0800
-Subject: [PATCH 09/10] new OpenGL ES2 video output module for iOS
-
-partially derived from the Mac vout code
----
- configure.ac                    |  12 +
- extras/package/ios/build.sh     |   1 +
- modules/video_output/Modules.am |   1 +
- modules/video_output/ios2.m     | 504 ++++++++++++++++++++++++++++++++++++++++
- 4 files changed, 518 insertions(+)
- create mode 100644 modules/video_output/ios2.m
-
-diff --git a/configure.ac b/configure.ac
-index c9666e5..b36390e 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -3171,6 +3171,18 @@ then
- fi
- 
- dnl
-+dnl  iOS ES2 vout module
-+dnl
-+AC_ARG_ENABLE(ios-vout2,
-+  [  --enable-ios-vout2    iOS video output module (default disabled)])
-+if test "${enable_ios_vout2}" = "yes"
-+then
-+  VLC_ADD_PLUGIN([vout_ios2])
-+  VLC_ADD_LIBS([vout_ios2], [-Wl,-framework,OpenGLES,-framework,QuartzCore,-framework,UIKit])
-+fi
-+
-+
-+dnl
- dnl  Windows DirectX module
- dnl
- 
-diff --git a/extras/package/ios/build.sh b/extras/package/ios/build.sh
-index 3b26155..d666ec6 100755
---- a/extras/package/ios/build.sh
-+++ b/extras/package/ios/build.sh
-@@ -264,6 +264,7 @@ ${VLCROOT}/configure \
-     --disable-macosx-vlc-app \
-     --enable-audioqueue \
-     --enable-ios-vout \
-+    --enable-ios-vout2 \
-     --disable-shared \
-     --disable-macosx-quartztext \
-     --enable-avcodec \
-diff --git a/modules/video_output/Modules.am b/modules/video_output/Modules.am
-index aa05454..40be7e7 100644
---- a/modules/video_output/Modules.am
-+++ b/modules/video_output/Modules.am
-@@ -8,6 +8,7 @@ SOURCES_vmem = vmem.c
- SOURCES_yuv = yuv.c
- SOURCES_vout_macosx = macosx.m opengl.h opengl.c
- SOURCES_vout_ios = ios.m opengl.h opengl.c
-+SOURCES_vout_ios2 = ios2.m opengl.h opengl.c
- SOURCES_android_surface = androidsurface.c
- 
- if HAVE_DECKLINK
-diff --git a/modules/video_output/ios2.m b/modules/video_output/ios2.m
-new file mode 100644
-index 0000000..9238055
---- /dev/null
-+++ b/modules/video_output/ios2.m
-@@ -0,0 +1,504 @@
-+/*****************************************************************************
-+ * ios2.m: iOS OpenGL ES 2 provider
-+ *****************************************************************************
-+ * Copyright (C) 2001-2013 VLC authors and VideoLAN
-+ * $Id$
-+ *
-+ * Authors: Derk-Jan Hartman <hartman at videolan dot org>
-+ *          Eric Petit <titer@m0k.org>
-+ *          Benjamin Pracht <bigben at videolan dot org>
-+ *          Damien Fouilleul <damienf at videolan dot org>
-+ *          Pierre d'Herbemont <pdherbemont at videolan dot org>
-+ *          Felix Paul Kühne <fkuehne at videolan dot org>
-+ *          David Fuhrmann <david dot fuhrmann at googlemail dot com>
-+ *          Rémi Denis-Courmont
-+ *          Juho Vähä-Herttua <juhovh at iki dot fi>
-+ *          Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2.1 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
-+ *****************************************************************************/
-+
-+/*****************************************************************************
-+ * Preamble
-+ *****************************************************************************/
-+
-+#import <UIKit/UIKit.h>
-+#import <OpenGLES/EAGL.h>
-+#import <OpenGLES/ES2/gl.h>
-+#import <QuartzCore/QuartzCore.h>
-+#import <dlfcn.h>
-+
-+#ifdef HAVE_CONFIG_H
-+# include "config.h"
-+#endif
-+
-+#include <vlc_common.h>
-+#include <vlc_plugin.h>
-+#include <vlc_vout_display.h>
-+#include <vlc_opengl.h>
-+#include <vlc_dialog.h>
-+#include "opengl.h"
-+
-+/**
-+ * Forward declarations
-+ */
-+static int Open (vlc_object_t *);
-+static void Close (vlc_object_t *);
-+
-+static picture_pool_t* PicturePool(vout_display_t *vd, unsigned requested_count);
-+static void PictureRender(vout_display_t* vd, picture_t *pic, subpicture_t *subpicture);
-+static void PictureDisplay(vout_display_t* vd, picture_t *pic, subpicture_t *subpicture);
-+static int Control(vout_display_t* vd, int query, va_list ap);
-+
-+static void *OurGetProcAddress(vlc_gl_t *, const char *);
-+
-+static int OpenglESClean(vlc_gl_t* gl);
-+static void OpenglESSwap(vlc_gl_t* gl);
-+
-+/**
-+ * Module declaration
-+ */
-+vlc_module_begin ()
-+    set_shortname ("iOS vout")
-+    set_description (N_("iOS OpenGL video output"))
-+    set_category (CAT_VIDEO)
-+    set_subcategory (SUBCAT_VIDEO_VOUT)
-+    set_capability ("vout display", 300)
-+    set_callbacks (Open, Close)
-+
-+    add_shortcut ("vout_ios2")
-+vlc_module_end ()
-+
-+@interface VLCOpenGLES2VideoView : UIView
-+{
-+    vout_display_t *_voutDisplay;
-+    EAGLContext *_eaglContext;
-+    GLuint _renderBuffer;
-+    GLuint _frameBuffer;
-+
-+    BOOL _bufferNeedReset;
-+}
-+@property (readwrite) vout_display_t* voutDisplay;
-+@property (readonly) EAGLContext* eaglContext;
-+
-+- (void)createBuffers;
-+- (void)destroyBuffers;
-+- (void)resetBuffers;
-+
-+@end
-+
-+
-+struct vout_display_sys_t
-+{
-+    VLCOpenGLES2VideoView *glESView;
-+    UIView* viewContainer;
-+
-+    vlc_gl_t gl;
-+    vout_display_opengl_t *vgl;
-+
-+    picture_pool_t *picturePool;
-+    picture_t *current;
-+    bool has_first_frame;
-+
-+    vout_display_place_t place;
-+};
-+
-+
-+static void *OurGetProcAddress(vlc_gl_t *gl, const char *name)
-+{
-+    VLC_UNUSED(gl);
-+
-+    return dlsym(RTLD_DEFAULT, name);
-+}
-+
-+static int Open(vlc_object_t *this)
-+{
-+    vout_display_t *vd = (vout_display_t *)this;
-+    vout_display_sys_t *sys = calloc (1, sizeof(*sys));
-+    NSAutoreleasePool *autoreleasePool = nil;
-+
-+    if (!sys)
-+        return VLC_ENOMEM;
-+
-+    vd->sys = sys;
-+    sys->picturePool = NULL;
-+    sys->gl.sys = NULL;
-+
-+    autoreleasePool = [[NSAutoreleasePool alloc] init];
-+
-+    /* get the object we will draw into */
-+    UIView* viewContainer = var_CreateGetAddress (vd, "drawable-nsobject");
-+    if (!viewContainer || ![viewContainer isKindOfClass:[UIView class]])
-+        goto bailout;
-+
-+    vout_display_DeleteWindow (vd, NULL);
-+
-+    /* This will be released in Close(), on
-+     * main thread, after we are done using it. */
-+    sys->viewContainer = [viewContainer retain];
-+
-+    /* setup the actual OpenGL ES view */
-+    sys->glESView = [[VLCOpenGLES2VideoView alloc] initWithFrame:[viewContainer bounds]];
-+
-+    if (!sys->glESView)
-+        goto bailout;
-+
-+    [sys->glESView setVoutDisplay:vd];
-+
-+    [sys->viewContainer performSelectorOnMainThread:@selector(addSubview:) withObject:sys->glESView waitUntilDone:YES];
-+
-+    /* Initialize common OpenGL video display */
-+    sys->gl.lock = OpenglESClean;
-+    sys->gl.unlock = nil;
-+    sys->gl.swap = OpenglESSwap;
-+    sys->gl.getProcAddress = OurGetProcAddress;
-+    sys->gl.sys = sys;
-+    const vlc_fourcc_t *subpicture_chromas;
-+    video_format_t fmt = vd->fmt;
-+
-+    sys->vgl = vout_display_opengl_New (&vd->fmt, &subpicture_chromas, &sys->gl);
-+    if (!sys->vgl) {
-+        sys->gl.sys = NULL;
-+        goto bailout;
-+    }
-+
-+    /* */
-+    vout_display_info_t info = vd->info;
-+    info.has_pictures_invalid = false;
-+    info.has_event_thread = true;
-+    info.subpicture_chromas = subpicture_chromas;
-+
-+    /* Setup vout_display_t once everything is fine */
-+    vd->info = info;
-+
-+    vd->pool = PicturePool;
-+    vd->prepare = PictureRender;
-+    vd->display = PictureDisplay;
-+    vd->control = Control;
-+
-+    /* */
-+    [sys->glESView performSelectorOnMainThread:@selector(reshape) withObject:nil waitUntilDone:YES];
-+
-+    [autoreleasePool release];
-+    return VLC_SUCCESS;
-+
-+bailout:
-+    [autoreleasePool release];
-+    Close(this);
-+    return VLC_EGENERIC;
-+}
-+
-+void Close (vlc_object_t *this)
-+{
-+    vout_display_t *vd = (vout_display_t *)this;
-+    vout_display_sys_t *sys = vd->sys;
-+
-+    [sys->glESView setVoutDisplay:nil];
-+
-+    var_Destroy (vd, "drawable-nsobject");
-+    [sys->viewContainer performSelectorOnMainThread:@selector(release) withObject:nil waitUntilDone:NO];
-+    [sys->glESView performSelectorOnMainThread:@selector(removeFromSuperview) withObject:nil waitUntilDone:NO];
-+
-+    if (sys->gl.sys != NULL) {
-+        msg_Dbg(this, "deleting display");
-+        vout_display_opengl_Delete(sys->vgl);
-+    }
-+
-+    [sys->glESView release];
-+
-+    free(sys);
-+}
-+
-+/*****************************************************************************
-+ * vout display callbacks
-+ *****************************************************************************/
-+
-+static int Control(vout_display_t *vd, int query, va_list ap)
-+{
-+    vout_display_sys_t *sys = vd->sys;
-+
-+    switch (query)
-+    {
-+        case VOUT_DISPLAY_CHANGE_FULLSCREEN:
-+        case VOUT_DISPLAY_CHANGE_WINDOW_STATE:
-+        case VOUT_DISPLAY_HIDE_MOUSE:
-+            return VLC_SUCCESS;
-+        case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
-+        case VOUT_DISPLAY_CHANGE_ZOOM:
-+        case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
-+        case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
-+        case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
-+        {
-+            if (!vd->sys)
-+                return VLC_EGENERIC;
-+
-+            NSAutoreleasePool * autoreleasePool = [[NSAutoreleasePool alloc] init];
-+
-+            const vout_display_cfg_t *cfg;
-+            const video_format_t *source;
-+            bool is_forced = false;
-+
-+            if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT || query == VOUT_DISPLAY_CHANGE_SOURCE_CROP) {
-+                source = (const video_format_t *)va_arg(ap, const video_format_t *);
-+                cfg = vd->cfg;
-+            } else {
-+                source = &vd->source;
-+                cfg = (const vout_display_cfg_t*)va_arg(ap, const vout_display_cfg_t *);
-+                if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
-+                    is_forced = (bool)va_arg(ap, int);
-+            }
-+
-+            if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE && is_forced
-+                && (cfg->display.width != vd->cfg->display.width
-+                    || cfg->display.height != vd->cfg->display.height))
-+                return VLC_EGENERIC;
-+
-+            /* we always use our current frame here, because we have some size constraints
-+             in the ui vout provider */
-+            vout_display_cfg_t cfg_tmp = *cfg;
-+            CGRect bounds;
-+            bounds = [sys->glESView bounds];
-+
-+            /* on HiDPI displays, the point bounds don't equal the actual pixel based bounds */
-+            CGFloat scaleFactor = sys->glESView.contentScaleFactor;
-+            cfg_tmp.display.width = bounds.size.width * scaleFactor;
-+            cfg_tmp.display.height = bounds.size.height * scaleFactor;
-+
-+            vout_display_place_t place;
-+            vout_display_PlacePicture(&place, source, &cfg_tmp, false);
-+            @synchronized (sys->glESView) {
-+                sys->place = place;
-+            }
-+
-+            /* For resize, we call glViewport in reshape and not here.
-+             This has the positive side effect that we avoid erratic sizing as we animate every resize. */
-+            if (query != VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
-+                // x / y are top left corner, but we need the lower left one
-+                glViewport(place.x, cfg_tmp.display.height - (place.y + place.height), place.width, place.height);
-+
-+            [autoreleasePool release];
-+            return VLC_SUCCESS;
-+        }
-+
-+        case VOUT_DISPLAY_GET_OPENGL:
-+        {
-+            vlc_gl_t **gl = va_arg(ap, vlc_gl_t **);
-+            *gl = &sys->gl;
-+            return VLC_SUCCESS;
-+        }
-+
-+        case VOUT_DISPLAY_RESET_PICTURES:
-+            assert (0);
-+        default:
-+            msg_Err(vd, "Unknown request %i in iOS ES 2 vout display", query);
-+            return VLC_EGENERIC;
-+    }
-+}
-+
-+static void PictureDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *subpicture)
-+{
-+    sys->has_first_frame = true;
-+
-+    vout_display_sys_t *sys = vd->sys;
-+    vout_display_opengl_Display(sys->vgl, &vd->source);
-+
-+    picture_Release(pic);
-+
-+    if (subpicture)
-+        subpicture_Delete(subpicture);
-+}
-+
-+static void PictureRender(vout_display_t *vd, picture_t *pic, subpicture_t *subpicture)
-+{
-+
-+    vout_display_sys_t *sys = vd->sys;
-+
-+    vout_display_opengl_Prepare(sys->vgl, pic, subpicture);
-+}
-+
-+static picture_pool_t *PicturePool(vout_display_t *vd, unsigned requested_count)
-+{
-+    vout_display_sys_t *sys = vd->sys;
-+
-+    if (!sys->picturePool)
-+        sys->picturePool = vout_display_opengl_GetPool(sys->vgl, requested_count);
-+    assert(sys->picturePool);
-+    return sys->picturePool;
-+}
-+
-+/*****************************************************************************
-+ * vout opengl callbacks
-+ *****************************************************************************/
-+static int OpenglESClean(vlc_gl_t *gl)
-+{
-+    vout_display_sys_t *sys = (vout_display_sys_t *)gl->sys;
-+    [sys->glESView resetBuffers];
-+    return 0;
-+}
-+
-+static void OpenglESSwap(vlc_gl_t *gl)
-+{
-+    vout_display_sys_t *sys = (vout_display_sys_t *)gl->sys;
-+    [[sys->glESView eaglContext] presentRenderbuffer:GL_RENDERBUFFER];
-+}
-+
-+/*****************************************************************************
-+ * Our UIView object
-+ *****************************************************************************/
-+@implementation VLCOpenGLES2VideoView
-+@synthesize voutDisplay = _voutDisplay, eaglContext = _eaglContext;
-+
-++ (Class)layerClass
-+{
-+    return [CAEAGLLayer class];
-+}
-+
-+- (id)initWithFrame:(CGRect)frame
-+{
-+    self = [super initWithFrame:frame]; // perform selector on main thread?
-+
-+    if (!self)
-+        return nil;
-+
-+    CAEAGLLayer * layer = (CAEAGLLayer *)self.layer;
-+    layer.drawableProperties = [NSDictionary dictionaryWithObject:kEAGLColorFormatRGBA8 forKey: kEAGLDrawablePropertyColorFormat];
-+    layer.opaque = YES;
-+
-+    _eaglContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
-+    if (!_eaglContext)
-+        return nil;
-+    [EAGLContext setCurrentContext:_eaglContext];
-+
-+    [self performSelectorOnMainThread:@selector(createBuffers) withObject:nil waitUntilDone:YES];
-+    [self performSelectorOnMainThread:@selector(reshape) withObject:nil waitUntilDone:NO];
-+    [self setAutoresizingMask: UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
-+
-+    return self;
-+}
-+
-+- (void)dealloc
-+{
-+    [_eaglContext release];
-+    [super dealloc];
-+}
-+
-+/* we don't get the correct scale factor if we don't overwrite this method */
-+- (void)drawRect:(CGRect) rect
-+{
-+    [super drawRect:rect];
-+}
-+
-+- (void)createBuffers
-+{
-+    /* make sure the current context is us */
-+    [EAGLContext setCurrentContext:_eaglContext];
-+
-+    /* create render buffer */
-+    glGenRenderbuffers(1, &_renderBuffer);
-+    glBindRenderbuffer(GL_RENDERBUFFER, _renderBuffer);
-+
-+    /* create frame buffer */
-+    glGenFramebuffers(1, &_frameBuffer);
-+    glBindFramebuffer(GL_FRAMEBUFFER, _frameBuffer);
-+
-+    /* allocate storage for the pixels we are going to to draw to */
-+    [_eaglContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:(id<EAGLDrawable>)self.layer];
-+
-+    /* bind render buffer to frame buffer */
-+    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, _renderBuffer);
-+
-+    /* make sure that our shape is ok */
-+    [self performSelectorOnMainThread:@selector(reshape) withObject:nil waitUntilDone:NO];
-+}
-+
-+- (void)destroyBuffers
-+{
-+    /* re-set current context */
-+    [EAGLContext setCurrentContext:_eaglContext];
-+
-+    /* clear frame buffer */
-+    glDeleteFramebuffers(1, &_frameBuffer);
-+    _frameBuffer = 0;
-+
-+    /* clear render buffer */
-+    glDeleteRenderbuffers(1, &_renderBuffer);
-+    _renderBuffer = 0;
-+}
-+
-+- (void)resetBuffers
-+{
-+    if (_bufferNeedReset) {
-+        NSLog(@"actually resetting buffers");
-+        [self destroyBuffers];
-+        [self createBuffers];
-+        _bufferNeedReset = NO;
-+    }
-+}
-+
-+- (void)layoutSubviews
-+{
-+    NSLog(@"layoutSubviews");
-+    /* this method is called as soon as we are resized.
-+     * so set a variable to re-create our buffers on the next clean event */
-+    _bufferNeedReset = YES;
-+}
-+
-+/**
-+ * Method called by Cocoa when the view is resized.
-+ */
-+- (void)reshape
-+{
-+    assert([[NSThread currentThread] isMainThread]);
-+
-+    CGRect bounds;
-+    bounds = [self bounds];
-+
-+    vout_display_place_t place;
-+
-+    @synchronized(self) {
-+        if (_voutDisplay) {
-+            vout_display_cfg_t cfg_tmp = *(_voutDisplay->cfg);
-+            CGFloat scaleFactor = self.contentScaleFactor;
-+
-+            cfg_tmp.display.width  = bounds.size.width * scaleFactor;
-+            cfg_tmp.display.height = bounds.size.height * scaleFactor;
-+
-+            vout_display_PlacePicture(&place, &_voutDisplay->source, &cfg_tmp, false);
-+            _voutDisplay->sys->place = place;
-+            vout_display_SendEventDisplaySize(_voutDisplay, bounds.size.width * scaleFactor, bounds.size.height * scaleFactor, _voutDisplay->cfg->is_fullscreen);
-+        }
-+    }
-+
-+    // x / y are top left corner, but we need the lower left one
-+    glViewport(place.x, place.y, place.width, place.height);
-+}
-+
-+- (void)updateConstraints
-+{
-+    [self reshape];
-+    [super updateConstraints];
-+}
-+
-+- (BOOL)isOpaque
-+{
-+    return YES;
-+}
-+
-+- (BOOL)acceptsFirstResponder
-+{
-+    return YES;
-+}
-+
-+@end
-1.7.12.4 (Apple Git-37)
-

+ 0 - 26
patches/0011-vout_ios2-compilation-fix.patch

@@ -1,27 +0,0 @@
-From 87a7999f1fa4583627721751433d85b045fd539a Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
-Date: Wed, 27 Feb 2013 21:17:03 +0100
-Subject: [PATCH 11/11] vout_ios2: compilation fix
-
----
- modules/video_output/ios2.m | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/modules/video_output/ios2.m b/modules/video_output/ios2.m
-index 9238055..a18f8f2 100644
---- a/modules/video_output/ios2.m
-+++ b/modules/video_output/ios2.m
-@@ -309,9 +309,8 @@ static int Control(vout_display_t *vd, int query, va_list ap)
- 
- static void PictureDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *subpicture)
- {
--    sys->has_first_frame = true;
--
-     vout_display_sys_t *sys = vd->sys;
-+    sys->has_first_frame = true;
-     vout_display_opengl_Display(sys->vgl, &vd->source);
- 
-     picture_Release(pic);
-1.7.12.4 (Apple Git-37)
-

+ 0 - 485
patches/0012-New-AudioUnit-output-module-for-iOS-based-on-the-Mac.patch

@@ -1,486 +0,0 @@
-From 4aecb223442bfed23a73530ec2f9851b8f1ac783 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Felix=20Paul=20Ku=CC=88hne?= <fkuehne@videolan.org>
-Date: Tue, 5 Mar 2013 00:53:10 +0100
-Subject: [PATCH] New AudioUnit output module for iOS based on the Mac
- counterpart code
-
----
- configure.ac                         |  13 ++
- extras/package/ios/build.sh          |   1 +
- modules/audio_output/Modules.am      |   1 +
- modules/audio_output/audiounit_ios.c | 416 +++++++++++++++++++++++++++++++++++
- 4 files changed, 431 insertions(+)
- create mode 100644 modules/audio_output/audiounit_ios.c
-
-diff --git a/configure.ac b/configure.ac
-index 752b891..e4bcb92 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -3482,6 +3482,19 @@ then
- fi
- 
- dnl
-+dnl  iOS CoreAudio plugin
-+dnl
-+AC_ARG_ENABLE(ios-audio,
-+  [  --enable-ios-audio       Audio module for iOS (default disabled)])
-+if test "${enable_ios_audio}" = "yes"
-+then
-+  AC_CHECK_HEADERS(AudioUnit/AudioUnit.h,
-+    [ VLC_ADD_PLUGIN([audiounit_ios])
-+      VLC_ADD_LIBS([audiounit_ios],[-Wl,-framework,CoreAudio,-framework,AudioUnit,-framework,AudioToolbox,-framework,CoreServices])
-+    ], [ AC_MSG_ERROR([cannot find AudioUnit headers]) ])
-+fi
-+
-+dnl
- dnl  AudioQueue plugin
- dnl
- AC_ARG_ENABLE(audioqueue,
-diff --git a/extras/package/ios/build.sh b/extras/package/ios/build.sh
-index 0d4d7c7..77349a9 100755
---- a/extras/package/ios/build.sh
-+++ b/extras/package/ios/build.sh
-@@ -262,6 +262,7 @@ ${VLCROOT}/configure \
-     --disable-macosx-eyetv \
-     --disable-macosx-vlc-app \
-     --enable-audioqueue \
-+    --enable-ios-audio \
-     --enable-ios-vout \
-     --enable-ios-vout2 \
-     --disable-shared \
-diff --git a/modules/audio_output/Modules.am b/modules/audio_output/Modules.am
-index a8c3206..38e9794 100644
---- a/modules/audio_output/Modules.am
-+++ b/modules/audio_output/Modules.am
-@@ -1,5 +1,6 @@
- SOURCES_waveout = waveout.c windows_audio_common.h
- SOURCES_auhal = TPCircularBuffer.h TPCircularBuffer.c auhal.c
-+SOURCES_audiounit_ios = TPCircularBuffer.h TPCircularBuffer.c audiounit_ios.c
- SOURCES_audioqueue = audioqueue.c
- 
- libopensles_android_plugin_la_SOURCES = opensles_android.c
-diff --git a/modules/audio_output/audiounit_ios.c b/modules/audio_output/audiounit_ios.c
-new file mode 100644
-index 0000000..e0f9693
---- /dev/null
-+++ b/modules/audio_output/audiounit_ios.c
-@@ -0,0 +1,416 @@
-+/*****************************************************************************
-+ * audiounit_ios.c: AudioUnit output plugin for iOS
-+ *****************************************************************************
-+ * Copyright (C) 2012 - 2013 VLC authors and VideoLAN
-+ * $Id$
-+ *
-+ * Authors: Felix Paul Kühne <fkuehne at videolan dot org>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU Lesser General Public License as published by
-+ * the Free Software Foundation; either version 2.1 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
-+ *****************************************************************************/
-+
-+#pragma mark includes
-+
-+#ifdef HAVE_CONFIG_H
-+# import "config.h"
-+#endif
-+
-+#import <vlc_common.h>
-+#import <vlc_plugin.h>
-+#import <vlc_aout.h>
-+
-+#import <AudioUnit/AudioUnit.h>
-+#import <CoreAudio/CoreAudioTypes.h>
-+#import <AudioToolbox/AudioToolbox.h>
-+#import <mach/mach_time.h>
-+
-+#import "TPCircularBuffer.h"
-+
-+#pragma mark -
-+#pragma mark private declarations
-+
-+#define STREAM_FORMAT_MSG(pre, sfm) \
-+    pre "[%f][%4.4s][%u][%u][%u][%u][%u][%u]", \
-+    sfm.mSampleRate, (char *)&sfm.mFormatID, \
-+    (unsigned int)sfm.mFormatFlags, (unsigned int)sfm.mBytesPerPacket, \
-+    (unsigned int)sfm.mFramesPerPacket, (unsigned int)sfm.mBytesPerFrame, \
-+    (unsigned int)sfm.mChannelsPerFrame, (unsigned int)sfm.mBitsPerChannel
-+
-+#define kBufferLength 2048 * 8 * 8 * 4
-+
-+/*****************************************************************************
-+ * aout_sys_t: private audio output method descriptor
-+ *****************************************************************************
-+ * This structure is part of the audio output thread descriptor.
-+ * It describes the CoreAudio specific properties of an output thread.
-+ *****************************************************************************/
-+struct aout_sys_t
-+{
-+    uint8_t                     chans_to_reorder;   /* do we need channel reordering */
-+    uint8_t                     chan_table[AOUT_CHAN_MAX];
-+
-+    UInt32                      i_numberOfChannels;
-+    TPCircularBuffer            circular_buffer;    /* circular buffer to swap the audio data */
-+
-+    /* AUHAL specific */
-+    AudioComponent              au_component;       /* The AudioComponent we use */
-+    AudioUnit                   au_unit;            /* The AudioUnit we use */
-+
-+    int                         i_rate;             /* media sample rate */
-+    mtime_t                     i_played_length;    /* how much did we play already */
-+    mtime_t                     i_last_sample_time; /* last sample time played by the AudioUnit */
-+    mtime_t                     i_first_time_stamp;
-+    bool                        b_got_first_sample;
-+
-+    vlc_mutex_t                 lock;
-+};
-+
-+#pragma mark -
-+#pragma mark local prototypes & module descriptor
-+
-+static int      Open                    (vlc_object_t *);
-+static void     Close                   (vlc_object_t *);
-+static int      Start                   (audio_output_t *, audio_sample_format_t *);
-+static int      StartAnalog             (audio_output_t *, audio_sample_format_t *);
-+static void     Stop                    (audio_output_t *);
-+
-+static void     Play                    (audio_output_t *, block_t *);
-+static void     Pause                   (audio_output_t *, bool, mtime_t);
-+static void     Flush                   (audio_output_t *, bool);
-+static int      TimeGet                 (audio_output_t *, mtime_t *);
-+static OSStatus RenderCallback    (vlc_object_t *, AudioUnitRenderActionFlags *, const AudioTimeStamp *,
-+                                         UInt32 , UInt32, AudioBufferList *);
-+vlc_module_begin ()
-+    set_shortname("audiounit_ios")
-+    set_description(N_("AudioUnit output for iOS"))
-+    set_capability("audio output", 101)
-+    set_category(CAT_AUDIO)
-+    set_subcategory(SUBCAT_AUDIO_AOUT)
-+    set_callbacks(Open, Close)
-+vlc_module_end ()
-+
-+#pragma mark -
-+#pragma mark initialization
-+
-+static int Open(vlc_object_t *obj)
-+{
-+    audio_output_t *aout = (audio_output_t *)obj;
-+    aout_sys_t *sys = malloc(sizeof (*sys));
-+
-+    if (unlikely(sys == NULL))
-+        return VLC_ENOMEM;
-+
-+    vlc_mutex_init(&sys->lock);
-+
-+    aout->sys = sys;
-+    aout->start = Start;
-+    aout->stop = Stop;
-+
-+    return VLC_SUCCESS;
-+}
-+
-+static void Close(vlc_object_t *obj)
-+{
-+    audio_output_t *aout = (audio_output_t *)obj;
-+    aout_sys_t *sys = aout->sys;
-+
-+    vlc_mutex_destroy(&sys->lock);
-+
-+    free(sys);
-+}
-+
-+static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
-+{
-+    struct aout_sys_t *p_sys = NULL;
-+
-+    p_sys = p_aout->sys;
-+    p_sys->au_component = NULL;
-+    p_sys->au_unit = NULL;
-+
-+    aout_FormatPrint(p_aout, "VLC is looking for:", fmt);
-+
-+    if (StartAnalog(p_aout, fmt)) {
-+        msg_Dbg(p_aout, "analog AudioUnit output successfully opened");
-+        p_aout->play = Play;
-+        p_aout->flush = Flush;
-+        p_aout->time_get = TimeGet;
-+        p_aout->pause = Pause;
-+        return VLC_SUCCESS;
-+    }
-+
-+    /* If we reach this, this aout has failed */
-+    msg_Err(p_aout, "opening AudioUnit output failed");
-+    return VLC_EGENERIC;
-+}
-+
-+/*
-+ * StartAnalog: open and setup a HAL AudioUnit to do PCM audio output
-+ */
-+static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
-+{
-+    struct aout_sys_t           *p_sys = p_aout->sys;
-+    UInt32                      i_param_size = 0;
-+    AudioComponentDescription   desc;
-+    AURenderCallbackStruct      callback;
-+    p_aout->sys->chans_to_reorder = 0;
-+    OSStatus status;
-+
-+    /* Lets go find our Component */
-+    desc.componentType = kAudioUnitType_Output;
-+    desc.componentSubType = kAudioUnitSubType_RemoteIO;
-+    desc.componentManufacturer = kAudioUnitManufacturer_Apple;
-+    desc.componentFlags = 0;
-+    desc.componentFlagsMask = 0;
-+
-+    p_sys->au_component = AudioComponentFindNext(NULL, &desc);
-+    if (p_sys->au_component == NULL) {
-+        msg_Warn(p_aout, "we cannot find our audio component");
-+        return false;
-+    }
-+
-+    status = AudioComponentInstanceNew(p_sys->au_component, &p_sys->au_unit);
-+    if (status != noErr) {
-+        msg_Warn(p_aout, "we cannot open our audio component (%li)", status);
-+        return false;
-+    }
-+
-+    UInt32 flag = 1;
-+    status = AudioUnitSetProperty(p_sys->au_unit,
-+                                  kAudioOutputUnitProperty_EnableIO,
-+                                  kAudioUnitScope_Output,
-+                                  0,
-+                                  &flag,
-+                                  sizeof(flag));
-+    if (status != noErr)
-+        msg_Warn(p_aout, "failed to set IO mode (%li)", status);
-+
-+    /* Get the current format */
-+    AudioStreamBasicDescription streamDescription;
-+    streamDescription.mSampleRate = fmt->i_rate;
-+    fmt->i_format = VLC_CODEC_FL32;
-+    streamDescription.mFormatID = kAudioFormatLinearPCM;
-+    streamDescription.mFormatFlags = kAudioFormatFlagsNativeFloatPacked; // FL32
-+    streamDescription.mChannelsPerFrame = 2;
-+    streamDescription.mFramesPerPacket = 1;
-+    streamDescription.mBitsPerChannel = 32;
-+    streamDescription.mBytesPerFrame = streamDescription.mBitsPerChannel * streamDescription.mChannelsPerFrame / 8;
-+    streamDescription.mBytesPerPacket = streamDescription.mBytesPerFrame * streamDescription.mFramesPerPacket;
-+    i_param_size = sizeof(streamDescription);
-+    p_sys->i_rate = fmt->i_rate;
-+
-+    /* Set the desired format */
-+    i_param_size = sizeof(AudioStreamBasicDescription);
-+    status = AudioUnitSetProperty(p_sys->au_unit,
-+                                  kAudioUnitProperty_StreamFormat,
-+                                  kAudioUnitScope_Input,
-+                                  0,
-+                                  &streamDescription,
-+                                  i_param_size);
-+    if (status != noErr) {
-+        msg_Err(p_aout, "failed to set stream format (%li)", status);
-+        return false;
-+    }
-+    msg_Dbg(p_aout, STREAM_FORMAT_MSG("we set the AU format: " , streamDescription));
-+
-+    /* Retrieve actual format */
-+    status = AudioUnitGetProperty(p_sys->au_unit,
-+                                  kAudioUnitProperty_StreamFormat,
-+                                  kAudioUnitScope_Input,
-+                                  0,
-+                                  &streamDescription,
-+                                  &i_param_size);
-+    if (status != noErr)
-+        msg_Warn(p_aout, "failed to verify stream format (%li)", status);
-+    msg_Dbg(p_aout, STREAM_FORMAT_MSG("the actual set AU format is " , streamDescription));
-+
-+    /* Do the last VLC aout setups */
-+    aout_FormatPrepare(fmt);
-+
-+    /* set the IOproc callback */
-+    callback.inputProc = (AURenderCallback) RenderCallback;
-+    callback.inputProcRefCon = p_aout;
-+
-+    status = AudioUnitSetProperty(p_sys->au_unit,
-+                            kAudioUnitProperty_SetRenderCallback,
-+                            kAudioUnitScope_Input,
-+                            0, &callback, sizeof(callback));
-+    if (status != noErr) {
-+        msg_Err(p_aout, "render callback setup failed (%li)", status);
-+        return false;
-+    }
-+
-+    /* AU initiliaze */
-+    status = AudioUnitInitialize(p_sys->au_unit);
-+    if (status != noErr) {
-+        msg_Err(p_aout, "failed to init AudioUnit (%li)", status);
-+        return false;
-+    }
-+
-+    /* setup circular buffer */
-+    TPCircularBufferInit(&p_sys->circular_buffer, kBufferLength);
-+
-+    p_sys->b_got_first_sample = false;
-+    p_sys->i_played_length = 0;
-+    p_sys->i_last_sample_time = 0;
-+    p_sys->i_first_time_stamp = 0;
-+
-+    return true;
-+}
-+
-+static void Stop(audio_output_t *p_aout)
-+{
-+    struct aout_sys_t   *p_sys = p_aout->sys;
-+    OSStatus status;
-+
-+    if (p_sys->au_unit) {
-+        status = AudioOutputUnitStop(p_sys->au_unit);
-+        if (status != noErr)
-+            msg_Warn(p_aout, "failed to stop AudioUnit (%li)", status);
-+
-+        status = AudioComponentInstanceDispose(p_sys->au_unit);
-+        if (status != noErr)
-+            msg_Warn(p_aout, "failed to dispose Audio Component instance (%li)", status);
-+    }
-+
-+    p_sys->i_played_length = 0;
-+    p_sys->i_last_sample_time = 0;
-+    p_sys->i_first_time_stamp = 0;
-+
-+    /* clean-up circular buffer */
-+    TPCircularBufferCleanup(&p_sys->circular_buffer);
-+}
-+
-+#pragma mark -
-+#pragma mark actual playback
-+
-+static void Play (audio_output_t * p_aout, block_t * p_block)
-+{
-+    struct aout_sys_t *p_sys = p_aout->sys;
-+
-+    if (p_block->i_nb_samples > 0) {
-+        if (!p_sys->b_got_first_sample) {
-+            /* Start the AU */
-+            OSStatus status = AudioOutputUnitStart(p_sys->au_unit);
-+            msg_Dbg(p_aout, "audio output unit started: %li", status);
-+            p_sys->b_got_first_sample = true;
-+        }
-+
-+        /* Do the channel reordering */
-+        if (p_sys->chans_to_reorder) {
-+           aout_ChannelReorder(p_block->p_buffer,
-+                               p_block->i_buffer,
-+                               p_sys->chans_to_reorder,
-+                               p_sys->chan_table,
-+                               VLC_CODEC_FL32);
-+        }
-+
-+        /* keep track of the played data */
-+        p_aout->sys->i_played_length += p_block->i_length;
-+
-+        /* move data to buffer */
-+        TPCircularBufferProduceBytes(&p_sys->circular_buffer, p_block->p_buffer, p_block->i_buffer);
-+    }
-+
-+    block_Release(p_block);
-+}
-+
-+static void Pause (audio_output_t *p_aout, bool pause, mtime_t date)
-+{
-+    struct aout_sys_t * p_sys = p_aout->sys;
-+    VLC_UNUSED(date);
-+
-+    if (pause)
-+        AudioOutputUnitStop(p_sys->au_unit);
-+    else
-+        AudioOutputUnitStart(p_sys->au_unit);
-+}
-+
-+static void Flush(audio_output_t *p_aout, bool wait)
-+{
-+    struct aout_sys_t * p_sys = p_aout->sys;
-+    VLC_UNUSED(wait);
-+
-+    p_sys->b_got_first_sample = false;
-+
-+    /* flush circular buffer */
-+    AudioOutputUnitStop(p_aout->sys->au_unit);
-+    TPCircularBufferClear(&p_aout->sys->circular_buffer);
-+
-+    p_sys->i_played_length = 0;
-+    p_sys->i_last_sample_time = 0;
-+    p_sys->i_first_time_stamp = 0;
-+}
-+
-+static int TimeGet(audio_output_t *p_aout, mtime_t *delay)
-+{
-+    struct aout_sys_t * p_sys = p_aout->sys;
-+
-+    vlc_mutex_lock(&p_sys->lock);
-+    mtime_t i_pos = (p_sys->i_last_sample_time - p_sys->i_first_time_stamp) * CLOCK_FREQ / p_sys->i_rate;
-+    vlc_mutex_unlock(&p_sys->lock);
-+
-+    if (i_pos > 0) {
-+        *delay = p_aout->sys->i_played_length - i_pos;
-+        return 0;
-+    }
-+    else
-+        return -1;
-+}
-+
-+/*****************************************************************************
-+ * RenderCallback: This function is called everytime the AudioUnit wants
-+ * us to provide some more audio data.
-+ * Don't print anything during normal playback, calling blocking function from
-+ * this callback is not allowed.
-+ *****************************************************************************/
-+static OSStatus RenderCallback(vlc_object_t *p_obj,
-+                               AudioUnitRenderActionFlags *ioActionFlags,
-+                               const AudioTimeStamp *inTimeStamp,
-+                               UInt32 inBusNumber,
-+                               UInt32 inNumberFrames,
-+                               AudioBufferList *ioData) {
-+    VLC_UNUSED(ioActionFlags);
-+    VLC_UNUSED(inTimeStamp);
-+    VLC_UNUSED(inBusNumber);
-+
-+    audio_output_t * p_aout = (audio_output_t *)p_obj;
-+    struct aout_sys_t * p_sys = p_aout->sys;
-+
-+    int bytesToCopy = ioData->mBuffers[0].mDataByteSize;
-+    Float32 *targetBuffer = (Float32*)ioData->mBuffers[0].mData;
-+
-+    /* Pull audio from buffer */
-+    int32_t availableBytes = 0;
-+    Float32 *buffer = TPCircularBufferTail(&p_sys->circular_buffer, &availableBytes);
-+
-+    /* check if we have enough data */
-+    if (!availableBytes) {
-+        /* return an empty buffer so silence is played until we have data */
-+        for (UInt32 j = 0; j < inNumberFrames; j++)
-+            targetBuffer[j] = 0.;
-+    } else {
-+        memcpy(targetBuffer, buffer, __MIN(bytesToCopy, availableBytes));
-+        TPCircularBufferConsume(&p_sys->circular_buffer, __MIN(bytesToCopy, availableBytes));
-+        VLC_UNUSED(inNumberFrames);
-+        vlc_mutex_lock(&p_sys->lock);
-+        p_sys->i_last_sample_time = inTimeStamp->mSampleTime;
-+        vlc_mutex_unlock(&p_sys->lock);
-+        if (p_sys->i_first_time_stamp == 0)
-+            p_sys->i_first_time_stamp = inTimeStamp->mSampleTime;
-+    }
-+
-+    return noErr;
-+}
-+
-1.7.12.4 (Apple Git-37)
-

+ 0 - 60
patches/0013-audiounit-run-an-AudioSession-when-outputting-media-.patch

@@ -1,61 +0,0 @@
-From 4d1ad6b0b0c5d3511ee5b2e7a7e1986cfc1e4a6d Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Felix=20Paul=20Ku=CC=88hne?= <fkuehne@videolan.org>
-Date: Sat, 9 Mar 2013 18:48:05 +0100
-Subject: [PATCH] audiounit: run an AudioSession when outputting media
- content, so the user is able to listen to the audio when
- the silent switch is on
-
----
- modules/audio_output/audiounit_ios.c | 20 ++++++++++++++++++--
- 1 file changed, 18 insertions(+), 2 deletions(-)
-
-diff --git a/modules/audio_output/audiounit_ios.c b/modules/audio_output/audiounit_ios.c
-index e0f9693..4763cb7 100644
---- a/modules/audio_output/audiounit_ios.c
-+++ b/modules/audio_output/audiounit_ios.c
-@@ -258,6 +258,17 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
-         return false;
-     }
- 
-+    /* start audio session so playback continues if mute switch is on */
-+    AudioSessionInitialize (NULL,
-+                            kCFRunLoopCommonModes,
-+                            NULL,
-+                            NULL);
-+
-+	/* Set audio session to mediaplayback */
-+	UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
-+	AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory),&sessionCategory);
-+	AudioSessionSetActive(true);
-+
-     /* setup circular buffer */
-     TPCircularBufferInit(&p_sys->circular_buffer, kBufferLength);
- 
-@@ -274,6 +285,8 @@ static void Stop(audio_output_t *p_aout)
-     struct aout_sys_t   *p_sys = p_aout->sys;
-     OSStatus status;
- 
-+    AudioSessionSetActive(false);
-+
-     if (p_sys->au_unit) {
-         status = AudioOutputUnitStop(p_sys->au_unit);
-         if (status != noErr)
-@@ -331,10 +344,13 @@ static void Pause (audio_output_t *p_aout, bool pause, mtime_t date)
-     struct aout_sys_t * p_sys = p_aout->sys;
-     VLC_UNUSED(date);
- 
--    if (pause)
-+    if (pause) {
-         AudioOutputUnitStop(p_sys->au_unit);
--    else
-+        AudioSessionSetActive(false);
-+    } else {
-         AudioOutputUnitStart(p_sys->au_unit);
-+        AudioSessionSetActive(true);
-+    }
- }
- 
- static void Flush(audio_output_t *p_aout, bool wait)
-1.7.12.4 (Apple Git-37)
-

+ 0 - 133
patches/0015-AudioUnit-adapt-7fec79d9.patch

@@ -1,134 +0,0 @@
-From db184a04f5130d6d6fbd8ad801c72b0a9eb39318 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
-Date: Thu, 28 Mar 2013 12:43:29 +0100
-Subject: [PATCH 2/2] AudioUnit: adapt 7fec79d9
-
----
- modules/audio_output/audiounit_ios.c | 52 +++++++++++++-----------------------
- 1 file changed, 18 insertions(+), 34 deletions(-)
-
-diff --git a/modules/audio_output/audiounit_ios.c b/modules/audio_output/audiounit_ios.c
-index 4763cb7..6574ea9 100644
---- a/modules/audio_output/audiounit_ios.c
-+++ b/modules/audio_output/audiounit_ios.c
-@@ -48,7 +48,7 @@
-     (unsigned int)sfm.mFramesPerPacket, (unsigned int)sfm.mBytesPerFrame, \
-     (unsigned int)sfm.mChannelsPerFrame, (unsigned int)sfm.mBitsPerChannel
- 
--#define kBufferLength 2048 * 8 * 8 * 4
-+#define AUDIO_BUFFER_SIZE_IN_SECONDS (AOUT_MAX_ADVANCE_TIME / CLOCK_FREQ)
- 
- /*****************************************************************************
-  * aout_sys_t: private audio output method descriptor
-@@ -69,9 +69,7 @@ struct aout_sys_t
-     AudioUnit                   au_unit;            /* The AudioUnit we use */
- 
-     int                         i_rate;             /* media sample rate */
--    mtime_t                     i_played_length;    /* how much did we play already */
--    mtime_t                     i_last_sample_time; /* last sample time played by the AudioUnit */
--    mtime_t                     i_first_time_stamp;
-+    int                         i_bytes_per_sample;
-     bool                        b_got_first_sample;
- 
-     vlc_mutex_t                 lock;
-@@ -138,6 +136,7 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
-     p_sys = p_aout->sys;
-     p_sys->au_component = NULL;
-     p_sys->au_unit = NULL;
-+    p_sys->i_bytes_per_sample = 0;
- 
-     aout_FormatPrint(p_aout, "VLC is looking for:", fmt);
- 
-@@ -270,12 +269,9 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
- 	AudioSessionSetActive(true);
- 
-     /* setup circular buffer */
--    TPCircularBufferInit(&p_sys->circular_buffer, kBufferLength);
-+    TPCircularBufferInit(&p_sys->circular_buffer, AUDIO_BUFFER_SIZE_IN_SECONDS * fmt->i_rate * fmt->i_bytes_per_frame);
- 
-     p_sys->b_got_first_sample = false;
--    p_sys->i_played_length = 0;
--    p_sys->i_last_sample_time = 0;
--    p_sys->i_first_time_stamp = 0;
- 
-     return true;
- }
-@@ -296,10 +292,7 @@ static void Stop(audio_output_t *p_aout)
-         if (status != noErr)
-             msg_Warn(p_aout, "failed to dispose Audio Component instance (%li)", status);
-     }
--
--    p_sys->i_played_length = 0;
--    p_sys->i_last_sample_time = 0;
--    p_sys->i_first_time_stamp = 0;
-+    p_sys->i_bytes_per_sample = 0;
- 
-     /* clean-up circular buffer */
-     TPCircularBufferCleanup(&p_sys->circular_buffer);
-@@ -329,11 +322,12 @@ static void Play (audio_output_t * p_aout, block_t * p_block)
-                                VLC_CODEC_FL32);
-         }
- 
--        /* keep track of the played data */
--        p_aout->sys->i_played_length += p_block->i_length;
--
-         /* move data to buffer */
--        TPCircularBufferProduceBytes(&p_sys->circular_buffer, p_block->p_buffer, p_block->i_buffer);
-+        if (unlikely(TPCircularBufferProduceBytes(&p_sys->circular_buffer, p_block->p_buffer, p_block->i_buffer)))
-+            msg_Warn(p_aout, "Audio buffer was dropped");
-+
-+        if (!p_sys->i_bytes_per_sample)
-+            p_sys->i_bytes_per_sample = p_block->i_buffer / p_block->i_nb_samples;
-     }
- 
-     block_Release(p_block);
-@@ -363,26 +357,21 @@ static void Flush(audio_output_t *p_aout, bool wait)
-     /* flush circular buffer */
-     AudioOutputUnitStop(p_aout->sys->au_unit);
-     TPCircularBufferClear(&p_aout->sys->circular_buffer);
--
--    p_sys->i_played_length = 0;
--    p_sys->i_last_sample_time = 0;
--    p_sys->i_first_time_stamp = 0;
- }
- 
- static int TimeGet(audio_output_t *p_aout, mtime_t *delay)
- {
-     struct aout_sys_t * p_sys = p_aout->sys;
- 
--    vlc_mutex_lock(&p_sys->lock);
--    mtime_t i_pos = (p_sys->i_last_sample_time - p_sys->i_first_time_stamp) * CLOCK_FREQ / p_sys->i_rate;
--    vlc_mutex_unlock(&p_sys->lock);
--
--    if (i_pos > 0) {
--        *delay = p_aout->sys->i_played_length - i_pos;
--        return 0;
--    }
--    else
-+    if (!p_sys->i_bytes_per_sample)
-         return -1;
-+
-+    int32_t availableBytes;
-+    TPCircularBufferTail(&p_sys->circular_buffer, &availableBytes);
-+
-+    *delay = (availableBytes / p_sys->i_bytes_per_sample) * CLOCK_FREQ / p_sys->i_rate;
-+
-+    return 0;
- }
- 
- /*****************************************************************************
-@@ -420,11 +409,6 @@ static OSStatus RenderCallback(vlc_object_t *p_obj,
-         memcpy(targetBuffer, buffer, __MIN(bytesToCopy, availableBytes));
-         TPCircularBufferConsume(&p_sys->circular_buffer, __MIN(bytesToCopy, availableBytes));
-         VLC_UNUSED(inNumberFrames);
--        vlc_mutex_lock(&p_sys->lock);
--        p_sys->i_last_sample_time = inTimeStamp->mSampleTime;
--        vlc_mutex_unlock(&p_sys->lock);
--        if (p_sys->i_first_time_stamp == 0)
--            p_sys->i_first_time_stamp = inTimeStamp->mSampleTime;
-     }
- 
-     return noErr;
-1.7.12.4 (Apple Git-37)
-

+ 0 - 36
patches/0016-audiounit_ios-fix-multi-channel-audio.patch

@@ -1,37 +0,0 @@
-From d53127fcec0f13e4a77ae45e433666f10b25c1f6 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
-Date: Mon, 1 Apr 2013 16:49:48 +0200
-Subject: [PATCH 1/4] audiounit_ios: fix multi-channel audio
-
----
- modules/audio_output/audiounit_ios.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/modules/audio_output/audiounit_ios.c b/modules/audio_output/audiounit_ios.c
-index 6574ea9..e4d28cc 100644
---- a/modules/audio_output/audiounit_ios.c
-+++ b/modules/audio_output/audiounit_ios.c
-@@ -199,9 +199,10 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
-     AudioStreamBasicDescription streamDescription;
-     streamDescription.mSampleRate = fmt->i_rate;
-     fmt->i_format = VLC_CODEC_FL32;
-+    fmt->i_physical_channels = AOUT_CHANS_STEREO;
-     streamDescription.mFormatID = kAudioFormatLinearPCM;
-     streamDescription.mFormatFlags = kAudioFormatFlagsNativeFloatPacked; // FL32
--    streamDescription.mChannelsPerFrame = 2;
-+    streamDescription.mChannelsPerFrame = aout_FormatNbChannels(fmt);
-     streamDescription.mFramesPerPacket = 1;
-     streamDescription.mBitsPerChannel = 32;
-     streamDescription.mBytesPerFrame = streamDescription.mBitsPerChannel * streamDescription.mChannelsPerFrame / 8;
-@@ -323,7 +324,7 @@ static void Play (audio_output_t * p_aout, block_t * p_block)
-         }
- 
-         /* move data to buffer */
--        if (unlikely(TPCircularBufferProduceBytes(&p_sys->circular_buffer, p_block->p_buffer, p_block->i_buffer)))
-+        if (unlikely(!TPCircularBufferProduceBytes(&p_sys->circular_buffer, p_block->p_buffer, p_block->i_buffer)))
-             msg_Warn(p_aout, "Audio buffer was dropped");
- 
-         if (!p_sys->i_bytes_per_sample)
-1.7.12.4 (Apple Git-37)
-

+ 0 - 48
patches/0017-audiounit_ios-remove-a-write-only-variable-and-relat.patch

@@ -1,49 +0,0 @@
-From ea8f1aaf72fb28e9f979a42b96d761796532e0dd Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
-Date: Mon, 1 Apr 2013 16:51:10 +0200
-Subject: [PATCH 2/4] audiounit_ios: remove a write-only variable and related
- code
-
----
- modules/audio_output/audiounit_ios.c | 11 -----------
- 1 file changed, 11 deletions(-)
-
-diff --git a/modules/audio_output/audiounit_ios.c b/modules/audio_output/audiounit_ios.c
-index e4d28cc..24e1266 100644
---- a/modules/audio_output/audiounit_ios.c
-+++ b/modules/audio_output/audiounit_ios.c
-@@ -58,7 +58,6 @@
-  *****************************************************************************/
- struct aout_sys_t
- {
--    uint8_t                     chans_to_reorder;   /* do we need channel reordering */
-     uint8_t                     chan_table[AOUT_CHAN_MAX];
- 
-     UInt32                      i_numberOfChannels;
-@@ -163,7 +162,6 @@ static int StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt)
-     UInt32                      i_param_size = 0;
-     AudioComponentDescription   desc;
-     AURenderCallbackStruct      callback;
--    p_aout->sys->chans_to_reorder = 0;
-     OSStatus status;
- 
-     /* Lets go find our Component */
-@@ -314,15 +312,6 @@ static void Play (audio_output_t * p_aout, block_t * p_block)
-             p_sys->b_got_first_sample = true;
-         }
- 
--        /* Do the channel reordering */
--        if (p_sys->chans_to_reorder) {
--           aout_ChannelReorder(p_block->p_buffer,
--                               p_block->i_buffer,
--                               p_sys->chans_to_reorder,
--                               p_sys->chan_table,
--                               VLC_CODEC_FL32);
--        }
--
-         /* move data to buffer */
-         if (unlikely(!TPCircularBufferProduceBytes(&p_sys->circular_buffer, p_block->p_buffer, p_block->i_buffer)))
-             msg_Warn(p_aout, "Audio buffer was dropped");
-1.7.12.4 (Apple Git-37)
-

+ 0 - 28
patches/0018-audiounit_ios-try-to-handle-data-drops-more-efficien.patch

@@ -1,29 +0,0 @@
-From 13592a7641bdeecaec39af1043e5bd806f082d08 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
-Date: Mon, 1 Apr 2013 16:54:57 +0200
-Subject: [PATCH 3/4] audiounit_ios: try to handle data drops more efficiently
-
-Needs mooar testing
----
- modules/audio_output/audiounit_ios.c | 5 ++---
- 1 file changed, 2 insertions(+), 3 deletions(-)
-
-diff --git a/modules/audio_output/audiounit_ios.c b/modules/audio_output/audiounit_ios.c
-index 24e1266..a4af9d2 100644
---- a/modules/audio_output/audiounit_ios.c
-+++ b/modules/audio_output/audiounit_ios.c
-@@ -392,9 +392,8 @@ static OSStatus RenderCallback(vlc_object_t *p_obj,
- 
-     /* check if we have enough data */
-     if (!availableBytes) {
--        /* return an empty buffer so silence is played until we have data */
--        for (UInt32 j = 0; j < inNumberFrames; j++)
--            targetBuffer[j] = 0.;
-+        /* bail out and restart unit the next time we receive some data */
-+        Flush(p_aout, false);
-     } else {
-         memcpy(targetBuffer, buffer, __MIN(bytesToCopy, availableBytes));
-         TPCircularBufferConsume(&p_sys->circular_buffer, __MIN(bytesToCopy, availableBytes));
-1.7.12.4 (Apple Git-37)
-

+ 0 - 52
patches/0019-audiounit_ios-more-cleanup.patch

@@ -1,53 +0,0 @@
-From fccd961db6c7e33e3993be2d7d682344a9796c64 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
-Date: Mon, 1 Apr 2013 17:06:01 +0200
-Subject: [PATCH 4/4] audiounit_ios: more cleanup
-
----
- modules/audio_output/audiounit_ios.c | 9 ---------
- 1 file changed, 9 deletions(-)
-
-diff --git a/modules/audio_output/audiounit_ios.c b/modules/audio_output/audiounit_ios.c
-index a4af9d2..1faaf58 100644
---- a/modules/audio_output/audiounit_ios.c
-+++ b/modules/audio_output/audiounit_ios.c
-@@ -58,9 +58,6 @@
-  *****************************************************************************/
- struct aout_sys_t
- {
--    uint8_t                     chan_table[AOUT_CHAN_MAX];
--
--    UInt32                      i_numberOfChannels;
-     TPCircularBuffer            circular_buffer;    /* circular buffer to swap the audio data */
- 
-     /* AUHAL specific */
-@@ -70,8 +67,6 @@ struct aout_sys_t
-     int                         i_rate;             /* media sample rate */
-     int                         i_bytes_per_sample;
-     bool                        b_got_first_sample;
--
--    vlc_mutex_t                 lock;
- };
- 
- #pragma mark -
-@@ -109,8 +104,6 @@ static int Open(vlc_object_t *obj)
-     if (unlikely(sys == NULL))
-         return VLC_ENOMEM;
- 
--    vlc_mutex_init(&sys->lock);
--
-     aout->sys = sys;
-     aout->start = Start;
-     aout->stop = Stop;
-@@ -123,8 +116,6 @@ static void Close(vlc_object_t *obj)
-     audio_output_t *aout = (audio_output_t *)obj;
-     aout_sys_t *sys = aout->sys;
- 
--    vlc_mutex_destroy(&sys->lock);
--
-     free(sys);
- }
- 
-1.7.12.4 (Apple Git-37)
-