Skip to content

Commit

Permalink
Merge pull request nto#7 from gbrooker/master
Browse files Browse the repository at this point in the history
Version 0.9.2. Add support for iOS 5 AirPlay protocol, and Xcode 4
  • Loading branch information
nto committed Mar 6, 2012
2 parents a4cc091 + c86c6e4 commit 260f801
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 17 deletions.
2 changes: 1 addition & 1 deletion AirView-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<key>CFBundleURLTypes</key>
<array/>
<key>CFBundleVersion</key>
<string>0.9.1</string>
<string>0.9.2</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSMainNibFile</key>
Expand Down
2 changes: 1 addition & 1 deletion AirView-main.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
int retVal = UIApplicationMain(argc, argv, nil, @"AirViewAppDelegate");
[pool release];
return retVal;
}
11 changes: 7 additions & 4 deletions AirView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@
/* Begin PBXProject section */
2830270212BD3AFD00247F8C /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0430;
};
buildConfigurationList = 2830270512BD3AFD00247F8C /* Build configuration list for PBXProject "AirView" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
Expand Down Expand Up @@ -470,7 +473,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PREBINDING = NO;
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "7E41CF06-2727-44F8-BBA0-D7B4D11E39A6";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -488,6 +490,7 @@
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "AirView-Prefix.pch";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = "AirView-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.2;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -508,7 +511,6 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
PREBINDING = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand All @@ -525,7 +527,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PREBINDING = NO;
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "D3DC2D31-675A-4D8C-8E19-50DB7B1164D3";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -544,6 +545,7 @@
GCC_DYNAMIC_NO_PIC = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "AirView-Prefix.pch";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = "AirView-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.2;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -562,6 +564,7 @@
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "AirView-Prefix.pch";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = "AirView-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.2;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -581,7 +584,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PREBINDING = NO;
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "D3DC2D31-675A-4D8C-8E19-50DB7B1164D3";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -599,6 +601,7 @@
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "AirView-Prefix.pch";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = "AirView-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.2;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
8 changes: 7 additions & 1 deletion Classes/AirPlayController.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ - (id)initWithWindow:(UIWindow *)uiWindow

playerView = [[MPMoviePlayerViewController alloc] initWithContentURL:nil];
player = playerView.moviePlayer;
}
if([player respondsToSelector:@selector(setAllowsAirPlay:)]) {
player.allowsAirPlay = NO;
}
}

return self;
}
Expand Down Expand Up @@ -76,6 +79,9 @@ - (void)play:(NSURL *)location atRelativePosition:(float)position
if (playerView == nil) {
playerView = [[MPMoviePlayerViewController alloc] initWithContentURL:location];
player = playerView.moviePlayer;
if([player respondsToSelector:@selector(setAllowsAirPlay:)]) {
player.allowsAirPlay = NO;
}
} else {
[player setContentURL:location];
}
Expand Down
76 changes: 66 additions & 10 deletions Classes/AirPlayHTTPConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,19 @@ - (BOOL)supportsMethod:(NSString *)method atPath:(NSString *)path
[path isEqualToString:@"/play"] ||
[path isEqualToString:@"/stop"] ||
[path hasPrefix:@"/scrub?position="] ||
[path hasPrefix:@"/rate?value="])
[path hasPrefix:@"/rate?value="]||
[path hasPrefix:@"/getProperty?playbackAccessLog"]||
[path hasPrefix:@"/getProperty?playbackErrorLog"])
return YES;
}

// Add support for PUT

if ([method isEqualToString:@"PUT"])
{
if ([path isEqualToString:@"/photo"])
if ([path isEqualToString:@"/photo"]||
[path hasPrefix:@"/setProperty?forwardEndTime"]||
[path hasPrefix:@"/setProperty?reverseEndTime"])
return YES;
}

Expand Down Expand Up @@ -161,14 +165,56 @@ - (void)processDataChunk:(NSData *)postDataChunk
return [res autorelease];
}


if ([method isEqualToString:@"PUT"] && [path isEqualToString:@"/photo"])
{
HTTPLogVerbose(@"%@[%p]: PUT (%qu) %@", THIS_FILE, self, requestContentLength, path);

return [[[HTTPDataResponse alloc] initWithData:nil] autorelease];
}

if ([method isEqualToString:@"PUT"])
{
if ([path isEqualToString:@"/photo"])
{
HTTPLogVerbose(@"%@[%p]: PUT (%qu) %@", THIS_FILE, self, requestContentLength, path);

return [[[HTTPDataResponse alloc] initWithData:nil] autorelease];
}
else if ([path isEqualToString:@"/setProperty?forwardEndTime"])
{
// In iOS 5 this command is accompanied by a dictionary
//{
// value = {
// epoch = 0;
// flags = 0;
// timescale = 0;
// value = 0;
//};}

NSString *error;
NSDictionary *dict = (NSDictionary *)[NSPropertyListSerialization
propertyListFromData:[request body]
mutabilityOption:NSPropertyListImmutable
format:NULL
errorDescription:&error ];
HTTPLogVerbose(@"%@[%p]: PUT (%qu) %@\n%@\n%@\n", THIS_FILE, self, requestContentLength, path, [dict description], error);
return [[[HTTPDataResponse alloc] initWithData:nil] autorelease];
}
else if ([path isEqualToString:@"/setProperty?reverseEndTime"])
{
// In iOS 5 this command is accompanied by a dictionary
//{
// value = {
// epoch = 0;
// flags = 0;
// timescale = 0;
// value = 0;
//};}

NSString *error;
NSDictionary *dict = (NSDictionary *)[NSPropertyListSerialization
propertyListFromData:[request body]
mutabilityOption:NSPropertyListImmutable
format:NULL
errorDescription:&error ];
HTTPLogVerbose(@"%@[%p]: PUT (%qu) %@\n%@\n%@\n", THIS_FILE, self, requestContentLength, path, [dict description], error);
return [[[HTTPDataResponse alloc] initWithData:nil] autorelease];
}

}

if (![method isEqualToString:@"POST"])
return [super httpResponseForMethod:method URI:path];
Expand All @@ -193,6 +239,16 @@ - (void)processDataChunk:(NSData *)postDataChunk

return [[[HTTPDataResponse alloc] initWithData:nil] autorelease];
}
else if ([path isEqualToString:@"/getProperty?playbackAccessLog"])
{
HTTPLogVerbose(@"%@[%p]: POST (%qu) %@", THIS_FILE, self, requestContentLength, path);
return [[[HTTPDataResponse alloc] initWithData:nil] autorelease];
}
else if ([path isEqualToString:@"/getProperty?playbackErrorLog"])
{
HTTPLogVerbose(@"%@[%p]: POST (%qu) %@", THIS_FILE, self, requestContentLength, path);
return [[[HTTPDataResponse alloc] initWithData:nil] autorelease];
}
else if ([path isEqualToString:@"/stop"])
{
[airplay stop];
Expand Down

0 comments on commit 260f801

Please sign in to comment.