Skip to content
Merged
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
10 changes: 5 additions & 5 deletions src/AVFoundation/AVPlayerItemVideoOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ public partial class AVPlayerItemVideoOutput {
enum InitMode {
PixelAttributes,
OutputSettings
}
}

AVPlayerItemVideoOutput (NSDictionary data, AVPlayerItemVideoOutput.InitMode mode) : this (IntPtr.Zero)
AVPlayerItemVideoOutput (NSDictionary data, AVPlayerItemVideoOutput.InitMode mode) : base (NSObjectFlag.Empty)
{
switch (mode) {
case InitMode.PixelAttributes:
Handle = _FromPixelBufferAttributes (data);
InitializeHandle (_FromPixelBufferAttributes (data), "initWithPixelBufferAttributes:");
break;
case InitMode.OutputSettings:
Handle = _FromOutputSettings (data);
InitializeHandle (_FromOutputSettings (data), "initWithOutputSettings:");
break;
default:
throw new ArgumentException (nameof (mode));
}
}

[DesignatedInitializer]
[Advice ("Please use the constructor that uses one of the available StrongDictionaries. This constructor expects Pixelbugger attributes.")]
[Advice ("Please use the constructor that uses one of the available StrongDictionaries. This constructor expects PixelBuffer attributes.")]
protected AVPlayerItemVideoOutput (NSDictionary pixelBufferAttributes) : this (pixelBufferAttributes, InitMode.PixelAttributes) {}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/avfoundation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9945,11 +9945,11 @@ interface AVPlayerItemVideoOutput {
[Export ("delegateQueue"), NullAllowed]
DispatchQueue DelegateQueue { get; }

[Internal, Static]
[Internal]
[Export ("initWithPixelBufferAttributes:")]
IntPtr _FromPixelBufferAttributes ([NullAllowed] NSDictionary pixelBufferAttributes);

[Internal, Static]
[Internal]
[Export ("initWithOutputSettings:")]
IntPtr _FromOutputSettings ([NullAllowed] NSDictionary outputSettings);

Expand Down
44 changes: 44 additions & 0 deletions tests/monotouch-test/AVFoundation/PlayerItemVideoOutputTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Unit tests for AVPlayerItemVideoOutput
//
// Authors:
// Sebastien Pouliot <sebastien@xamarin.com>
//
// Copyright 2016 Xamarin Inc. All rights reserved.
//

#if !__WATCHOS__

using System;
#if XAMCORE_2_0
using AVFoundation;
using CoreVideo;
using Foundation;
using UIKit;
#else
using MonoTouch.AVFoundation;
using MonoTouch.CoreVideo;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
#endif
using NUnit.Framework;

namespace MonoTouchFixtures.AVFoundation {

[TestFixture]
[Preserve (AllMembers = true)]
public class PlayerItemVideoOutputTest {

[Test]
public void Ctor_CVPixelBufferAttributes ()
{
var attributes = new CVPixelBufferAttributes () {
PixelFormatType = CVPixelFormatType.CV32BGRA
};
using (var output = new AVPlayerItemVideoOutput (attributes))
Assert.That (output.Handle, Is.Not.EqualTo (IntPtr.Zero), "valid");
}
}
}

#endif // !__WATCHOS__
1 change: 1 addition & 0 deletions tests/monotouch-test/monotouch-test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@
<Compile Include="AVFoundation\CaptureDeviceTest.cs" />
<Compile Include="PassKit\LabeledValueTest.cs" />
<Compile Include="System.Net.Http\MessageHandlers.cs" />
<Compile Include="AVFoundation\PlayerItemVideoOutputTest.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup>
Expand Down