~zanneth/StreamPlayer

35fe6e62c8b006754a71fa3e7906b7f12994fa5b — Charles Magahern 7 years ago
Initial commit

Player works, but doesn't perform well when there aren't enough buffers
available to write to.
A  => StreamPlayer.xcodeproj/project.pbxproj +320 -0
@@ 1,320 @@
// !$*UTF8*$!
{
	archiveVersion = 1;
	classes = {
	};
	objectVersion = 46;
	objects = {

/* Begin PBXBuildFile section */
		0CAC1CA01D2B146F000D949A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CAC1C9F1D2B146F000D949A /* AppDelegate.m */; };
		0CAC1CA31D2B146F000D949A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CAC1CA21D2B146F000D949A /* main.m */; };
		0CAC1CA51D2B146F000D949A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0CAC1CA41D2B146F000D949A /* Assets.xcassets */; };
		0CAC1CA81D2B146F000D949A /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0CAC1CA61D2B146F000D949A /* MainMenu.xib */; };
		0CAC1CB41D2B15C9000D949A /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CAC1CB31D2B15C9000D949A /* MainViewController.m */; };
		0CAC95CD1D2B1E740087E280 /* ZANStreamPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CAC95CC1D2B1E740087E280 /* ZANStreamPlayer.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
		0CAC1C9B1D2B146F000D949A /* StreamPlayer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = StreamPlayer.app; sourceTree = BUILT_PRODUCTS_DIR; };
		0CAC1C9E1D2B146F000D949A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
		0CAC1C9F1D2B146F000D949A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
		0CAC1CA21D2B146F000D949A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
		0CAC1CA41D2B146F000D949A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
		0CAC1CA71D2B146F000D949A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
		0CAC1CA91D2B146F000D949A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
		0CAC1CB21D2B15C9000D949A /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = "<group>"; };
		0CAC1CB31D2B15C9000D949A /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = "<group>"; };
		0CAC95CB1D2B1E740087E280 /* ZANStreamPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZANStreamPlayer.h; sourceTree = "<group>"; };
		0CAC95CC1D2B1E740087E280 /* ZANStreamPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZANStreamPlayer.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
		0CAC1C981D2B146F000D949A /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
		0CAC1C921D2B146F000D949A = {
			isa = PBXGroup;
			children = (
				0CAC1C9D1D2B146F000D949A /* StreamPlayer */,
				0CAC1C9C1D2B146F000D949A /* Products */,
			);
			sourceTree = "<group>";
		};
		0CAC1C9C1D2B146F000D949A /* Products */ = {
			isa = PBXGroup;
			children = (
				0CAC1C9B1D2B146F000D949A /* StreamPlayer.app */,
			);
			name = Products;
			sourceTree = "<group>";
		};
		0CAC1C9D1D2B146F000D949A /* StreamPlayer */ = {
			isa = PBXGroup;
			children = (
				0CAC1CAF1D2B149A000D949A /* Source */,
				0CAC1CB01D2B14BD000D949A /* Resources */,
				0CAC1CB11D2B14C3000D949A /* Supporting Files */,
			);
			path = StreamPlayer;
			sourceTree = "<group>";
		};
		0CAC1CAF1D2B149A000D949A /* Source */ = {
			isa = PBXGroup;
			children = (
				0CAC1C9E1D2B146F000D949A /* AppDelegate.h */,
				0CAC1C9F1D2B146F000D949A /* AppDelegate.m */,
				0CAC1CB21D2B15C9000D949A /* MainViewController.h */,
				0CAC1CB31D2B15C9000D949A /* MainViewController.m */,
				0CAC95CB1D2B1E740087E280 /* ZANStreamPlayer.h */,
				0CAC95CC1D2B1E740087E280 /* ZANStreamPlayer.m */,
				0CAC1CA21D2B146F000D949A /* main.m */,
			);
			path = Source;
			sourceTree = "<group>";
		};
		0CAC1CB01D2B14BD000D949A /* Resources */ = {
			isa = PBXGroup;
			children = (
				0CAC1CA41D2B146F000D949A /* Assets.xcassets */,
				0CAC1CA61D2B146F000D949A /* MainMenu.xib */,
			);
			path = Resources;
			sourceTree = "<group>";
		};
		0CAC1CB11D2B14C3000D949A /* Supporting Files */ = {
			isa = PBXGroup;
			children = (
				0CAC1CA91D2B146F000D949A /* Info.plist */,
			);
			name = "Supporting Files";
			path = SupportingFiles;
			sourceTree = "<group>";
		};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
		0CAC1C9A1D2B146F000D949A /* StreamPlayer */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = 0CAC1CAC1D2B146F000D949A /* Build configuration list for PBXNativeTarget "StreamPlayer" */;
			buildPhases = (
				0CAC1C971D2B146F000D949A /* Sources */,
				0CAC1C981D2B146F000D949A /* Frameworks */,
				0CAC1C991D2B146F000D949A /* Resources */,
			);
			buildRules = (
			);
			dependencies = (
			);
			name = StreamPlayer;
			productName = StreamPlayer;
			productReference = 0CAC1C9B1D2B146F000D949A /* StreamPlayer.app */;
			productType = "com.apple.product-type.application";
		};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
		0CAC1C931D2B146F000D949A /* Project object */ = {
			isa = PBXProject;
			attributes = {
				LastUpgradeCheck = 0730;
				ORGANIZATIONNAME = zanneth;
				TargetAttributes = {
					0CAC1C9A1D2B146F000D949A = {
						CreatedOnToolsVersion = 7.3.1;
					};
				};
			};
			buildConfigurationList = 0CAC1C961D2B146F000D949A /* Build configuration list for PBXProject "StreamPlayer" */;
			compatibilityVersion = "Xcode 3.2";
			developmentRegion = English;
			hasScannedForEncodings = 0;
			knownRegions = (
				en,
				Base,
			);
			mainGroup = 0CAC1C921D2B146F000D949A;
			productRefGroup = 0CAC1C9C1D2B146F000D949A /* Products */;
			projectDirPath = "";
			projectRoot = "";
			targets = (
				0CAC1C9A1D2B146F000D949A /* StreamPlayer */,
			);
		};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
		0CAC1C991D2B146F000D949A /* Resources */ = {
			isa = PBXResourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				0CAC1CA51D2B146F000D949A /* Assets.xcassets in Resources */,
				0CAC1CA81D2B146F000D949A /* MainMenu.xib in Resources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
		0CAC1C971D2B146F000D949A /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				0CAC1CA31D2B146F000D949A /* main.m in Sources */,
				0CAC1CB41D2B15C9000D949A /* MainViewController.m in Sources */,
				0CAC95CD1D2B1E740087E280 /* ZANStreamPlayer.m in Sources */,
				0CAC1CA01D2B146F000D949A /* AppDelegate.m in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
		0CAC1CA61D2B146F000D949A /* MainMenu.xib */ = {
			isa = PBXVariantGroup;
			children = (
				0CAC1CA71D2B146F000D949A /* Base */,
			);
			name = MainMenu.xib;
			sourceTree = "<group>";
		};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
		0CAC1CAA1D2B146F000D949A /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_ANALYZER_NONNULL = YES;
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
				CLANG_CXX_LIBRARY = "libc++";
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				CODE_SIGN_IDENTITY = "-";
				COPY_PHASE_STRIP = NO;
				DEBUG_INFORMATION_FORMAT = dwarf;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				ENABLE_TESTABILITY = YES;
				GCC_C_LANGUAGE_STANDARD = gnu99;
				GCC_DYNAMIC_NO_PIC = NO;
				GCC_NO_COMMON_BLOCKS = YES;
				GCC_OPTIMIZATION_LEVEL = 0;
				GCC_PREPROCESSOR_DEFINITIONS = (
					"DEBUG=1",
					"$(inherited)",
				);
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				MACOSX_DEPLOYMENT_TARGET = 10.11;
				MTL_ENABLE_DEBUG_INFO = YES;
				ONLY_ACTIVE_ARCH = YES;
				SDKROOT = macosx;
			};
			name = Debug;
		};
		0CAC1CAB1D2B146F000D949A /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_ANALYZER_NONNULL = YES;
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
				CLANG_CXX_LIBRARY = "libc++";
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				CODE_SIGN_IDENTITY = "-";
				COPY_PHASE_STRIP = NO;
				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
				ENABLE_NS_ASSERTIONS = NO;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				GCC_C_LANGUAGE_STANDARD = gnu99;
				GCC_NO_COMMON_BLOCKS = YES;
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				MACOSX_DEPLOYMENT_TARGET = 10.11;
				MTL_ENABLE_DEBUG_INFO = NO;
				SDKROOT = macosx;
			};
			name = Release;
		};
		0CAC1CAD1D2B146F000D949A /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
				COMBINE_HIDPI_IMAGES = YES;
				INFOPLIST_FILE = StreamPlayer/SupportingFiles/Info.plist;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
				PRODUCT_BUNDLE_IDENTIFIER = com.zanneth.StreamPlayer;
				PRODUCT_NAME = "$(TARGET_NAME)";
			};
			name = Debug;
		};
		0CAC1CAE1D2B146F000D949A /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
				COMBINE_HIDPI_IMAGES = YES;
				INFOPLIST_FILE = StreamPlayer/SupportingFiles/Info.plist;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
				PRODUCT_BUNDLE_IDENTIFIER = com.zanneth.StreamPlayer;
				PRODUCT_NAME = "$(TARGET_NAME)";
			};
			name = Release;
		};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
		0CAC1C961D2B146F000D949A /* Build configuration list for PBXProject "StreamPlayer" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				0CAC1CAA1D2B146F000D949A /* Debug */,
				0CAC1CAB1D2B146F000D949A /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		0CAC1CAC1D2B146F000D949A /* Build configuration list for PBXNativeTarget "StreamPlayer" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				0CAC1CAD1D2B146F000D949A /* Debug */,
				0CAC1CAE1D2B146F000D949A /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
/* End XCConfigurationList section */
	};
	rootObject = 0CAC1C931D2B146F000D949A /* Project object */;
}

A  => StreamPlayer/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json +58 -0
@@ 1,58 @@
{
  "images" : [
    {
      "idiom" : "mac",
      "size" : "16x16",
      "scale" : "1x"
    },
    {
      "idiom" : "mac",
      "size" : "16x16",
      "scale" : "2x"
    },
    {
      "idiom" : "mac",
      "size" : "32x32",
      "scale" : "1x"
    },
    {
      "idiom" : "mac",
      "size" : "32x32",
      "scale" : "2x"
    },
    {
      "idiom" : "mac",
      "size" : "128x128",
      "scale" : "1x"
    },
    {
      "idiom" : "mac",
      "size" : "128x128",
      "scale" : "2x"
    },
    {
      "idiom" : "mac",
      "size" : "256x256",
      "scale" : "1x"
    },
    {
      "idiom" : "mac",
      "size" : "256x256",
      "scale" : "2x"
    },
    {
      "idiom" : "mac",
      "size" : "512x512",
      "scale" : "1x"
    },
    {
      "idiom" : "mac",
      "size" : "512x512",
      "scale" : "2x"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}
\ No newline at end of file

A  => StreamPlayer/Resources/Base.lproj/MainMenu.xib +711 -0
@@ 1,711 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
    <dependencies>
        <deployment identifier="macosx"/>
        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
    </dependencies>
    <objects>
        <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
            <connections>
                <outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
            </connections>
        </customObject>
        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
        <customObject id="Voe-Tx-rLC" customClass="AppDelegate">
            <connections>
                <outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
            </connections>
        </customObject>
        <customObject id="YLy-65-1bz" customClass="NSFontManager"/>
        <menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
            <items>
                <menuItem title="StreamPlayer" id="1Xt-HY-uBw">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <menu key="submenu" title="StreamPlayer" systemMenu="apple" id="uQy-DD-JDr">
                        <items>
                            <menuItem title="About StreamPlayer" id="5kV-Vb-QxS">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
                                </connections>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
                            <menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
                            <menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
                            <menuItem title="Services" id="NMo-om-nkz">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
                            <menuItem title="Hide StreamPlayer" keyEquivalent="h" id="Olw-nP-bQN">
                                <connections>
                                    <action selector="hide:" target="-1" id="PnN-Uc-m68"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
                                <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
                                <connections>
                                    <action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Show All" id="Kd2-mp-pUS">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
                                </connections>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
                            <menuItem title="Quit StreamPlayer" keyEquivalent="q" id="4sb-4s-VLi">
                                <connections>
                                    <action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
                                </connections>
                            </menuItem>
                        </items>
                    </menu>
                </menuItem>
                <menuItem title="File" id="dMs-cI-mzQ">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <menu key="submenu" title="File" id="bib-Uj-vzu">
                        <items>
                            <menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
                                <connections>
                                    <action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
                                <connections>
                                    <action selector="openDocument:" target="-1" id="bVn-NM-KNZ"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Open Recent" id="tXI-mr-wws">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
                                    <items>
                                        <menuItem title="Clear Menu" id="vNY-rz-j42">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="clearRecentDocuments:" target="-1" id="Daa-9d-B3U"/>
                                            </connections>
                                        </menuItem>
                                    </items>
                                </menu>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
                            <menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
                                <connections>
                                    <action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
                                <connections>
                                    <action selector="saveDocument:" target="-1" id="teZ-XB-qJY"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
                                <connections>
                                    <action selector="saveDocumentAs:" target="-1" id="mDf-zr-I0C"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Revert to Saved" id="KaW-ft-85H">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="revertDocumentToSaved:" target="-1" id="iJ3-Pv-kwq"/>
                                </connections>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
                            <menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
                                <modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
                                <connections>
                                    <action selector="runPageLayout:" target="-1" id="Din-rz-gC5"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
                                <connections>
                                    <action selector="print:" target="-1" id="qaZ-4w-aoO"/>
                                </connections>
                            </menuItem>
                        </items>
                    </menu>
                </menuItem>
                <menuItem title="Edit" id="5QF-Oa-p0T">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <menu key="submenu" title="Edit" id="W48-6f-4Dl">
                        <items>
                            <menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
                                <connections>
                                    <action selector="undo:" target="-1" id="M6e-cu-g7V"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
                                <connections>
                                    <action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
                                </connections>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
                            <menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
                                <connections>
                                    <action selector="cut:" target="-1" id="YJe-68-I9s"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
                                <connections>
                                    <action selector="copy:" target="-1" id="G1f-GL-Joy"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
                                <connections>
                                    <action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
                                <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
                                <connections>
                                    <action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Delete" id="pa3-QI-u2k">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
                                <connections>
                                    <action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
                                </connections>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
                            <menuItem title="Find" id="4EN-yA-p0u">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <menu key="submenu" title="Find" id="1b7-l0-nxx">
                                    <items>
                                        <menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
                                            <connections>
                                                <action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
                                            <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
                                            <connections>
                                                <action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
                                            <connections>
                                                <action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
                                            <connections>
                                                <action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
                                            <connections>
                                                <action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
                                            <connections>
                                                <action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
                                            </connections>
                                        </menuItem>
                                    </items>
                                </menu>
                            </menuItem>
                            <menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
                                    <items>
                                        <menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
                                            <connections>
                                                <action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
                                            <connections>
                                                <action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
                                        <menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
                                            </connections>
                                        </menuItem>
                                    </items>
                                </menu>
                            </menuItem>
                            <menuItem title="Substitutions" id="9ic-FL-obx">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
                                    <items>
                                        <menuItem title="Show Substitutions" id="z6F-FW-3nz">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
                                        <menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Smart Quotes" id="hQb-2v-fYv">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Smart Dashes" id="rgM-f4-ycn">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Smart Links" id="cwL-P1-jid">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Data Detectors" id="tRr-pd-1PS">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Text Replacement" id="HFQ-gK-NFA">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
                                            </connections>
                                        </menuItem>
                                    </items>
                                </menu>
                            </menuItem>
                            <menuItem title="Transformations" id="2oI-Rn-ZJC">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <menu key="submenu" title="Transformations" id="c8a-y6-VQd">
                                    <items>
                                        <menuItem title="Make Upper Case" id="vmV-6d-7jI">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Make Lower Case" id="d9M-CD-aMd">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Capitalize" id="UEZ-Bs-lqG">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
                                            </connections>
                                        </menuItem>
                                    </items>
                                </menu>
                            </menuItem>
                            <menuItem title="Speech" id="xrE-MZ-jX0">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <menu key="submenu" title="Speech" id="3rS-ZA-NoH">
                                    <items>
                                        <menuItem title="Start Speaking" id="Ynk-f8-cLZ">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Stop Speaking" id="Oyz-dy-DGm">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
                                            </connections>
                                        </menuItem>
                                    </items>
                                </menu>
                            </menuItem>
                        </items>
                    </menu>
                </menuItem>
                <menuItem title="Format" id="jxT-CU-nIS">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <menu key="submenu" title="Format" id="GEO-Iw-cKr">
                        <items>
                            <menuItem title="Font" id="Gi5-1S-RQB">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
                                    <items>
                                        <menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
                                            <connections>
                                                <action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
                                            <connections>
                                                <action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
                                            <connections>
                                                <action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
                                            <connections>
                                                <action selector="underline:" target="-1" id="FYS-2b-JAY"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
                                        <menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
                                            <connections>
                                                <action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
                                            <connections>
                                                <action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
                                        <menuItem title="Kern" id="jBQ-r6-VK2">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <menu key="submenu" title="Kern" id="tlD-Oa-oAM">
                                                <items>
                                                    <menuItem title="Use Default" id="GUa-eO-cwY">
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
                                                        </connections>
                                                    </menuItem>
                                                    <menuItem title="Use None" id="cDB-IK-hbR">
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
                                                        </connections>
                                                    </menuItem>
                                                    <menuItem title="Tighten" id="46P-cB-AYj">
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
                                                        </connections>
                                                    </menuItem>
                                                    <menuItem title="Loosen" id="ogc-rX-tC1">
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
                                                        </connections>
                                                    </menuItem>
                                                </items>
                                            </menu>
                                        </menuItem>
                                        <menuItem title="Ligatures" id="o6e-r0-MWq">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
                                                <items>
                                                    <menuItem title="Use Default" id="agt-UL-0e3">
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
                                                        </connections>
                                                    </menuItem>
                                                    <menuItem title="Use None" id="J7y-lM-qPV">
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
                                                        </connections>
                                                    </menuItem>
                                                    <menuItem title="Use All" id="xQD-1f-W4t">
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
                                                        </connections>
                                                    </menuItem>
                                                </items>
                                            </menu>
                                        </menuItem>
                                        <menuItem title="Baseline" id="OaQ-X3-Vso">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <menu key="submenu" title="Baseline" id="ijk-EB-dga">
                                                <items>
                                                    <menuItem title="Use Default" id="3Om-Ey-2VK">
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
                                                        </connections>
                                                    </menuItem>
                                                    <menuItem title="Superscript" id="Rqc-34-cIF">
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
                                                        </connections>
                                                    </menuItem>
                                                    <menuItem title="Subscript" id="I0S-gh-46l">
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
                                                        </connections>
                                                    </menuItem>
                                                    <menuItem title="Raise" id="2h7-ER-AoG">
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
                                                        </connections>
                                                    </menuItem>
                                                    <menuItem title="Lower" id="1tx-W0-xDw">
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
                                                        </connections>
                                                    </menuItem>
                                                </items>
                                            </menu>
                                        </menuItem>
                                        <menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
                                        <menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
                                            <connections>
                                                <action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
                                        <menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
                                            <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
                                            <connections>
                                                <action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
                                            <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
                                            <connections>
                                                <action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
                                            </connections>
                                        </menuItem>
                                    </items>
                                </menu>
                            </menuItem>
                            <menuItem title="Text" id="Fal-I4-PZk">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <menu key="submenu" title="Text" id="d9c-me-L2H">
                                    <items>
                                        <menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
                                            <connections>
                                                <action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
                                            <connections>
                                                <action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Justify" id="J5U-5w-g23">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
                                            <connections>
                                                <action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
                                        <menuItem title="Writing Direction" id="H1b-Si-o9J">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
                                                <items>
                                                    <menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                    </menuItem>
                                                    <menuItem id="YGs-j5-SAR">
                                                        <string key="title">	Default</string>
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
                                                        </connections>
                                                    </menuItem>
                                                    <menuItem id="Lbh-J2-qVU">
                                                        <string key="title">	Left to Right</string>
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
                                                        </connections>
                                                    </menuItem>
                                                    <menuItem id="jFq-tB-4Kx">
                                                        <string key="title">	Right to Left</string>
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
                                                        </connections>
                                                    </menuItem>
                                                    <menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
                                                    <menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                    </menuItem>
                                                    <menuItem id="Nop-cj-93Q">
                                                        <string key="title">	Default</string>
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
                                                        </connections>
                                                    </menuItem>
                                                    <menuItem id="BgM-ve-c93">
                                                        <string key="title">	Left to Right</string>
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
                                                        </connections>
                                                    </menuItem>
                                                    <menuItem id="RB4-Sm-HuC">
                                                        <string key="title">	Right to Left</string>
                                                        <modifierMask key="keyEquivalentModifierMask"/>
                                                        <connections>
                                                            <action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
                                                        </connections>
                                                    </menuItem>
                                                </items>
                                            </menu>
                                        </menuItem>
                                        <menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
                                        <menuItem title="Show Ruler" id="vLm-3I-IUL">
                                            <modifierMask key="keyEquivalentModifierMask"/>
                                            <connections>
                                                <action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
                                            <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
                                            <connections>
                                                <action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
                                            </connections>
                                        </menuItem>
                                        <menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
                                            <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
                                            <connections>
                                                <action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
                                            </connections>
                                        </menuItem>
                                    </items>
                                </menu>
                            </menuItem>
                        </items>
                    </menu>
                </menuItem>
                <menuItem title="View" id="H8h-7b-M4v">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <menu key="submenu" title="View" id="HyV-fh-RgO">
                        <items>
                            <menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
                                <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
                                <connections>
                                    <action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
                                </connections>
                            </menuItem>
                        </items>
                    </menu>
                </menuItem>
                <menuItem title="Window" id="aUF-d1-5bR">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
                        <items>
                            <menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
                                <connections>
                                    <action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
                                </connections>
                            </menuItem>
                            <menuItem title="Zoom" id="R4o-n2-Eq4">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
                                </connections>
                            </menuItem>
                            <menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
                            <menuItem title="Bring All to Front" id="LE2-aR-0XJ">
                                <modifierMask key="keyEquivalentModifierMask"/>
                                <connections>
                                    <action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
                                </connections>
                            </menuItem>
                        </items>
                    </menu>
                </menuItem>
                <menuItem title="Help" id="wpr-3q-Mcd">
                    <modifierMask key="keyEquivalentModifierMask"/>
                    <menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
                        <items>
                            <menuItem title="StreamPlayer Help" keyEquivalent="?" id="FKE-Sm-Kum">
                                <connections>
                                    <action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
                                </connections>
                            </menuItem>
                        </items>
                    </menu>
                </menuItem>
            </items>
        </menu>
        <window title="StreamPlayer" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
            <rect key="contentRect" x="335" y="390" width="400" height="91"/>
            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1577"/>
            <view key="contentView" id="EiT-Mj-1SZ">
                <rect key="frame" x="0.0" y="0.0" width="400" height="91"/>
                <autoresizingMask key="autoresizingMask"/>
                <subviews>
                    <textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="HGq-eh-5yw">
                        <rect key="frame" x="20" y="49" width="360" height="22"/>
                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" placeholderString="URL" drawsBackground="YES" usesSingleLineMode="YES" id="soQ-fX-bKb">
                            <font key="font" metaFont="system"/>
                            <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                        </textFieldCell>
                    </textField>
                    <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FWg-TU-hvG">
                        <rect key="frame" x="14" y="13" width="81" height="32"/>
                        <buttonCell key="cell" type="push" title="Play" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Hib-dl-YzZ">
                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                            <font key="font" metaFont="system"/>
                        </buttonCell>
                        <connections>
                            <action selector="_buttonPressed:" target="z9U-54-IbD" id="dNd-3e-5gS"/>
                        </connections>
                    </button>
                </subviews>
            </view>
            <point key="canvasLocation" x="514" y="584.5"/>
        </window>
        <viewController id="z9U-54-IbD" customClass="MainViewController">
            <connections>
                <outlet property="_actionButton" destination="FWg-TU-hvG" id="Gbb-r5-Rg3"/>
                <outlet property="_urlTextField" destination="HGq-eh-5yw" id="Aah-Rk-1lW"/>
                <outlet property="actionButton" destination="FWg-TU-hvG" id="QlM-Xf-hUk"/>
                <outlet property="urlTextField" destination="HGq-eh-5yw" id="g28-JQ-Cjh"/>
                <outlet property="view" destination="EiT-Mj-1SZ" id="m1G-rq-Fs4"/>
            </connections>
        </viewController>
    </objects>
</document>

A  => StreamPlayer/Source/AppDelegate.h +15 -0
@@ 1,15 @@
//
//  AppDelegate.h
//  StreamPlayer
//
//  Created by Charles Magahern on 7/4/16.
//  Copyright © 2016 zanneth. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface AppDelegate : NSObject <NSApplicationDelegate>


@end


A  => StreamPlayer/Source/AppDelegate.m +29 -0
@@ 1,29 @@
//
//  AppDelegate.m
//  StreamPlayer
//
//  Created by Charles Magahern on 7/4/16.
//  Copyright © 2016 zanneth. All rights reserved.
//

#import "AppDelegate.h"

@interface AppDelegate ()

@property (weak) IBOutlet NSWindow *window;

@end

@implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    // Insert code here to initialize your application
}

- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
{
    return YES;
}

@end

A  => StreamPlayer/Source/MainViewController.h +13 -0
@@ 1,13 @@
//
//  MainViewController.h
//  StreamPlayer
//
//  Created by Charles Magahern on 7/4/16.
//  Copyright © 2016 zanneth. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface MainViewController : NSViewController

@end

A  => StreamPlayer/Source/MainViewController.m +59 -0
@@ 1,59 @@
//
//  MainViewController.m
//  StreamPlayer
//
//  Created by Charles Magahern on 7/4/16.
//  Copyright © 2016 zanneth. All rights reserved.
//

#import "MainViewController.h"
#import "ZANStreamPlayer.h"

static NSString * const MVCSavedURLStringDefaultsKey = @"SavedURLString";

@interface MainViewController ()

@property (weak) IBOutlet NSTextField *urlTextField;
@property (weak) IBOutlet NSButton *actionButton;

@end

@implementation MainViewController
{
    ZANStreamPlayer *_player;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString *savedURLString = [defaults stringForKey:MVCSavedURLStringDefaultsKey];
    if (savedURLString) {
        self.urlTextField.stringValue = savedURLString;
    }
}

#pragma mark - Actions

- (IBAction)_buttonPressed:(id)sender
{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:self.urlTextField.stringValue forKey:MVCSavedURLStringDefaultsKey];
    [defaults synchronize];
    
    if (!_player) {
        NSURL *url = [[NSURL alloc] initWithString:self.urlTextField.stringValue];
        _player = [[ZANStreamPlayer alloc] initWithURL:url];
    }
    
    if (_player.playing) {
        [_player pause];
        _actionButton.title = @"Play";
    } else {
        [_player play];
        _actionButton.title = @"Pause";
    }
}

@end

A  => StreamPlayer/Source/ZANStreamPlayer.h +25 -0
@@ 1,25 @@
//
//  ZANStreamPlayer.h
//  StreamPlayer
//
//  Created by Charles Magahern on 7/4/16.
//  Copyright © 2016 zanneth. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface ZANStreamPlayer : NSObject

@property (nonatomic, readonly) NSURL *url;
@property (nonatomic, readonly, getter=isPlaying) BOOL playing;

- (instancetype)initWithURL:(NSURL *)url;

- (void)play;
- (void)pause;

@end

NS_ASSUME_NONNULL_END

A  => StreamPlayer/Source/ZANStreamPlayer.m +501 -0
@@ 1,501 @@
//
//  ZANStreamPlayer.m
//  StreamPlayer
//
//  Created by Charles Magahern on 7/4/16.
//  Copyright © 2016 zanneth. All rights reserved.
//

#import "ZANStreamPlayer.h"
#import <AudioToolbox/AudioToolbox.h>

#if !__has_feature(objc_arc)
#error ARC is required for this file
#endif

#define DEFAULT_BUFFER_SIZE         2048
#define AUDIO_QUEUE_BUFFERS_COUNT   16
#define MAX_PACKET_DESCRIPTIONS     512

static void _ZANPropertyListenerCallback(void *clientData,
                                         AudioFileStreamID fileStream,
                                         AudioFileStreamPropertyID propertyID,
                                         UInt32 *flags);

static void _ZANPacketsAvailableCallback(void *clientData,
                                         UInt32 bytesLength,
                                         UInt32 packetsCount,
                                         const void *data,
                                         AudioStreamPacketDescription *packetDescriptions);

static void _ZANAudioQueueOutputCallback(void *clientData,
                                         AudioQueueRef audioQueue,
                                         AudioQueueBufferRef buffer);

@interface ZANStreamPlayer () <NSURLSessionDataDelegate>
@end

@implementation ZANStreamPlayer
{
    NSURLSession                *_urlSession;
    NSURLSessionDataTask        *_dataTask;
    AudioFileStreamID            _audioFileStream;
    AudioQueueRef                _audioQueue;
    AudioQueueBufferRef          _audioQueueBuffers[AUDIO_QUEUE_BUFFERS_COUNT];
    AudioStreamPacketDescription _packetDescriptions[MAX_PACKET_DESCRIPTIONS];
    
    NSOperationQueue            *_inputQueue;
    NSUInteger                   _buffersEnqueued;
    
    NSUInteger                   _dataOffset;
    NSUInteger                   _packetBufferSize;
    NSUInteger                   _bytesFilled;
    NSUInteger                   _packetsFilled;
    NSUInteger                   _audioFileLength;
    NSUInteger                   _currentBufferIndex;
    AudioStreamBasicDescription  _audioStreamDescription;
}

- (instancetype)initWithURL:(NSURL *)url
{
    self = [super init];
    if (self) {
        _url = [url copy];
        
        _inputQueue = [[NSOperationQueue alloc] init];
        _inputQueue.maxConcurrentOperationCount = 1;
        
        NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];
        _urlSession = [NSURLSession sessionWithConfiguration:sessionConfig delegate:self delegateQueue:_inputQueue];
    }
    return self;
}

- (void)dealloc
{
    [self _closeReadStream];
    [self _closeAudioStream];
    [self _destroyAudioOutputQueue];
}

#pragma mark - API

- (void)play
{
    if (!_playing) {
        [self _openReadStream];
    }
}

- (void)pause
{
    if (_playing) {
        [self _closeReadStream];
    }
}

#pragma mark - NSURLSessionDataDelegate

- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error
{
    if (error) {
        [self _logError:@"URL session data task failed to complete. %@", error];
        [self _handleError:error];
    }
}

- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data
{
    NSError *error = nil;
    
    do {
        // make sure audio stream is open first
        if (!_audioFileStream) {
            [self _openAudioStreamWithError:&error];
        }
        if (error) {
            [self _logError:@"Failed to open audio stream: %@", error];
            break;
        }
        
        // write the data to the audio stream
        OSStatus status = AudioFileStreamParseBytes(_audioFileStream, (UInt32)data.length, data.bytes, 0);
        if (status != noErr) {
            [self _logError:@"Failed to write data to audio stream (OSStatus = %d)", status];
            error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
            break;
        }
    } while (0);
    
    if (error) {
        [self _handleError:error];
        [self _closeReadStream];
    }
}

#pragma mark - Internal

- (BOOL)_openReadStream
{
    [self _logMessage:@"Opening read stream with URL %@", _url];
    
    if (_dataTask) {
        [_dataTask cancel];
    }
    
    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:_url];
    _dataTask = [_urlSession dataTaskWithRequest:request];
    [_dataTask resume];
    
    _playing = YES;
    return YES;
}

- (BOOL)_closeReadStream
{
    [self _logMessage:@"Closing read stream"];
    
    [_dataTask cancel];
    _dataTask = nil;
    _playing = NO;
    
    return YES;
}

- (BOOL)_openAudioStreamWithError:(NSError **)outError
{
    OSStatus status = noErr;
    [self _logMessage:@"Opening audio stream"];
    
    do {
        // close existing stream if necessary
        if (_audioFileStream) {
            status = AudioFileStreamClose(_audioFileStream);
        }
        if (status != noErr) {
            [self _logError:@"Could not close existing audio file stream (OSStatus = %d)", status];
            break;
        }
        
        // open new file stream
        status = AudioFileStreamOpen((__bridge void *)self, _ZANPropertyListenerCallback, _ZANPacketsAvailableCallback, 0, &_audioFileStream);
        if (status != noErr) {
            [self _logError:@"Failed to open audio file stream (OSStatus = %d)", status];
            break;
        }
    } while (0);
    
    if (status == noErr) {
        [self _logMessage:@"Successfully opened audio stream"];
    }
    
    if (outError) {
        *outError = [self _errorFromOSStatus:status];
    }
    
    return (status == noErr);
}

- (BOOL)_closeAudioStream
{
    OSStatus status = noErr;
    
    if (_audioFileStream) {
        [self _logMessage:@"Closing audio stream ID %p", _audioFileStream];
        
        status = AudioFileStreamClose(_audioFileStream);
        if (status != noErr) {
            [self _logError:@"Failed to close audio stream %p", _audioFileStream];
        }
    }
    
    return (status == noErr);
}

- (BOOL)_createAudioOutputQueueWithError:(NSError **)outError
{
    OSStatus status = noErr;
    [self _logMessage:@"Creating audio output queue with stream description %p", _audioStreamDescription];
    
    do {
        // create the audio queue
        status = AudioQueueNewOutput(&_audioStreamDescription, _ZANAudioQueueOutputCallback, (__bridge void *)self, NULL, NULL, 0, &_audioQueue);
        if (status != noErr) {
            [self _logError:@"Failed to create new audio queue output (OSStatus = %d)", status];
            break;
        }
        
        // get the packet size, if available
        UInt32 packetBufferSize = 0;
        UInt32 propertySize = sizeof(UInt32);
        status = AudioFileStreamGetProperty(_audioFileStream, kAudioFileStreamProperty_PacketSizeUpperBound, &propertySize, &packetBufferSize);
        if (status != noErr || packetBufferSize == 0) {
            // fallback to maximum packet size property
            status = AudioFileStreamGetProperty(_audioFileStream, kAudioFileStreamProperty_MaximumPacketSize, &propertySize, &packetBufferSize);
            
            if (status != noErr || packetBufferSize == 0) {
                // fallback to default size
                packetBufferSize = DEFAULT_BUFFER_SIZE;
            }
        }
        _packetBufferSize = packetBufferSize;
        
        // allocate audio queue buffers
        for (unsigned i = 0; i < AUDIO_QUEUE_BUFFERS_COUNT; ++i) {
            status = AudioQueueAllocateBuffer(_audioQueue, (UInt32)_packetBufferSize, &_audioQueueBuffers[i]);
            if (status != noErr) {
                [self _logError:@"Failed to allocate audio queue buffer (OSStatus = %d)", status];
                break;
            }
        }
    } while (0);
    
    if (outError) {
        *outError = [self _errorFromOSStatus:status];
    }
    
    return (status == noErr);
}

- (void)_destroyAudioOutputQueue
{
    if (_audioQueue) {
        for (unsigned i = 0; i < AUDIO_QUEUE_BUFFERS_COUNT; ++i) {
            if (_audioQueueBuffers[i] != NULL) {
                AudioQueueFreeBuffer(_audioQueue, _audioQueueBuffers[i]);
                _audioQueueBuffers[i] = NULL;
            }
        }
        
        AudioQueueDispose(_audioQueue, true);
        _audioQueue = NULL;
    }
}

- (void)_enqueueAudioBuffer
{
    OSStatus status = noErr;
    
    do {
        // fill in bytes used
        AudioQueueBufferRef buffer = _audioQueueBuffers[_currentBufferIndex];
        buffer->mAudioDataByteSize = (UInt32)_bytesFilled;
        
        // enqueue buffer
        status = AudioQueueEnqueueBuffer(_audioQueue, buffer, (UInt32)_packetsFilled, _packetDescriptions);
        if (status != noErr) {
            [self _logError:@"Failed to enqueue audio buffer (OSStatus = %d)", status];
            break;
        }
        
        // start the audio queue processing hardware if necessary
        status = AudioQueueStart(_audioQueue, NULL);
        if (status != noErr) {
            [self _logError:@"Failed to start audio queue hardware (OSStatus = %d)", status];
            break;
        }
        
        // go to next buffer
        _currentBufferIndex = (_currentBufferIndex + 1) % AUDIO_QUEUE_BUFFERS_COUNT;
        _bytesFilled = 0;
        _packetsFilled = 0;
        ++_buffersEnqueued;
    } while (0);
}

- (void)_handlePropertyChangeForFileStream:(AudioFileStreamID)stream
                            withPropertyID:(AudioFileStreamPropertyID)propertyID
                                     flags:(UInt32 *)flags
{
    OSStatus status = noErr;
    
    switch (propertyID) {
        case kAudioFileStreamProperty_DataOffset: {
            SInt64 offset = 0;
            UInt32 propertySize = sizeof(SInt64);
            status = AudioFileStreamGetProperty(stream, kAudioFileStreamProperty_DataOffset, &propertySize, &offset);
            if (status == noErr) {
                _dataOffset = (NSUInteger)offset;
            }
        } break;
        
        case kAudioFileStreamProperty_AudioDataByteCount: {
            UInt64 byteCount = 0;
            UInt32 propertySize = sizeof(UInt64);
            status = AudioFileStreamGetProperty(stream, kAudioFileStreamProperty_AudioDataByteCount, &propertySize, &byteCount);
            if (status == noErr) {
                _audioFileLength = (NSUInteger)byteCount;
            }
        } break;
        
        case kAudioFileStreamProperty_DataFormat: {
            AudioStreamBasicDescription format = {0};
            UInt32 propertySize = sizeof(AudioStreamBasicDescription);
            status = AudioFileStreamGetProperty(stream, kAudioFileStreamProperty_DataFormat, &propertySize, &format);
            if (status == noErr) {
                _audioStreamDescription = format;
            }
        } break;
        
        case kAudioFileStreamProperty_FormatList: {
            AudioFormatListItem *formatList = NULL;
            
            do {
                // get the size of the format list
                UInt32 formatListSize = 0;
                status = AudioFileStreamGetPropertyInfo(stream, kAudioFileStreamProperty_FormatList, &formatListSize, NULL);
                if (status != noErr) {
                    [self _logError:@"Failed to get format list size (OSStatus = %d)", status];
                    break;
                }
                
                // get the new list of formats
                formatList = (AudioFormatListItem *)malloc(formatListSize);
                status = AudioFileStreamGetProperty(stream, kAudioFileStreamProperty_FormatList, &formatListSize, formatList);
                if (status != noErr) {
                    [self _logError:@"Failed to get format list data (OSStatus = %d)", status];
                    break;
                }
                
                // find the AAC format that we're interested in parsing
                unsigned formatListCount = formatListSize / sizeof(AudioFormatListItem);
                for (unsigned i = 0; i < formatListCount; ++i) {
                    AudioFormatListItem formatItem = formatList[i];
                    AudioStreamBasicDescription format = formatItem.mASBD;
                    if (format.mFormatID == kAudioFormatMPEG4AAC_HE || format.mFormatID == kAudioFormatMPEG4AAC_HE_V2) {
                        _audioStreamDescription = format;
                        break;
                    }
                }
            } while (0);
            
            if (formatList) {
                free(formatList);
            }
        } break;
    }
    
    if (status != noErr) {
        [self _handleError:[NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil]];
    }
}

- (void)_handleAudioPacketsAvailableWithData:(NSData *)audioData
                                packetsCount:(NSUInteger)packetsCount
                          packetDescriptions:(AudioStreamPacketDescription *)packetDescriptions
{
    NSError *error = nil;
    
    do {
        // make sure we have an audio queue initialized first
        if (!_audioQueue) {
            [self _createAudioOutputQueueWithError:&error];
        }
        if (error) {
            [self _logError:@"Failed to create output queue. %@", error];
            break;
        }
        
        // parse packets
        for (unsigned i = 0; i < packetsCount; ++i) {
            SInt64 packetOffset = packetDescriptions[i].mStartOffset;
            SInt64 packetSize = packetDescriptions[i].mDataByteSize;
            size_t spaceRemaining = _packetBufferSize - _bytesFilled;
            
            if (spaceRemaining < packetSize) {
                [self _enqueueAudioBuffer];
            }
            
            // copy audio data into buffer
            AudioQueueBufferRef buffer = _audioQueueBuffers[_currentBufferIndex];
            memcpy(buffer->mAudioData + _bytesFilled, audioData.bytes + packetOffset, packetSize);
            
            // store packet description
            AudioStreamPacketDescription packetDescription = packetDescriptions[i];
            packetDescription.mStartOffset = _bytesFilled;
            _packetDescriptions[_packetsFilled] = packetDescription;
            
            _bytesFilled += packetSize;
            _packetsFilled += 1;
            
            NSUInteger packetsRemaining = MAX_PACKET_DESCRIPTIONS - _packetsFilled;
            if (packetsRemaining == 0) {
                [self _enqueueAudioBuffer];
            }
        }
    } while (0);
    
    if (error) {
        [self _logError:@"Error encountered while handling audio packets. %@", error];
        [self _handleError:error];
    }
}

- (void)_handleBufferCompleteFromQueue:(AudioQueueRef)queue buffer:(AudioQueueBufferRef)buffer
{
    --_buffersEnqueued;
}

- (NSError *)_errorFromOSStatus:(OSStatus)status
{
    NSError *error = nil;
    if (status != noErr) {
        error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
    }
    return error;
}

- (void)_handleError:(NSError *)error
{
    [self _logError:@"%@", error];
}

- (void)_logMessage:(NSString *)format, ...
{
    va_list args;
    va_start(args, format);
    NSString *message = [[NSString alloc] initWithFormat:format arguments:args];
    va_end(args);
    
    NSLog(@"%@: %@", NSStringFromClass([self class]), message);
}

- (void)_logError:(NSString *)format, ...
{
    va_list args;
    va_start(args, format);
    NSString *message = [[NSString alloc] initWithFormat:format arguments:args];
    va_end(args);
    
    NSLog(@"%@ ERROR: %@", NSStringFromClass([self class]), message);
}

#pragma mark - AudioFileStream Callbacks

void _ZANPropertyListenerCallback(void *clientData,
                                  AudioFileStreamID fileStream,
                                  AudioFileStreamPropertyID propertyID,
                                  UInt32 *flags)
{
    ZANStreamPlayer *player = (__bridge ZANStreamPlayer *)clientData;
    [player _handlePropertyChangeForFileStream:fileStream withPropertyID:propertyID flags:flags];
}

void _ZANPacketsAvailableCallback(void *clientData,
                                  UInt32 bytesLength,
                                  UInt32 packetsCount,
                                  const void *data,
                                  AudioStreamPacketDescription *packetDescriptions)
{
    ZANStreamPlayer *player = (__bridge ZANStreamPlayer *)clientData;
    NSData *audioData = [NSData dataWithBytesNoCopy:(void *)data length:bytesLength freeWhenDone:NO];
    [player _handleAudioPacketsAvailableWithData:audioData packetsCount:packetsCount packetDescriptions:packetDescriptions];
}

void _ZANAudioQueueOutputCallback(void *clientData, AudioQueueRef audioQueue, AudioQueueBufferRef buffer)
{
    ZANStreamPlayer *player = (__bridge ZANStreamPlayer *)clientData;
    [player _handleBufferCompleteFromQueue:audioQueue buffer:buffer];
}

@end

A  => StreamPlayer/Source/main.m +14 -0
@@ 1,14 @@
//
//  main.m
//  StreamPlayer
//
//  Created by Charles Magahern on 7/4/16.
//  Copyright © 2016 zanneth. All rights reserved.
//

#import <Cocoa/Cocoa.h>

int main(int argc, const char **argv)
{
    return NSApplicationMain(argc, argv);
}

A  => StreamPlayer/SupportingFiles/Info.plist +39 -0
@@ 1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>en</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIconFile</key>
	<string></string>
	<key>CFBundleIdentifier</key>
	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>NSAppTransportSecurity</key>
	<dict>
		<key>NSAllowsArbitraryLoads</key>
		<true/>
	</dict>
	<key>CFBundleVersion</key>
	<string>1</string>
	<key>LSMinimumSystemVersion</key>
	<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
	<key>NSHumanReadableCopyright</key>
	<string>Copyright © 2016 zanneth. All rights reserved.</string>
	<key>NSMainNibFile</key>
	<string>MainMenu</string>
	<key>NSPrincipalClass</key>
	<string>NSApplication</string>
</dict>
</plist>