Sync source edition with VCC Plus 3.7.0 build 63
This commit is contained in:
1 parent
c652a5276d
commit
b2ecec4d87
86 files changed
+10519
-472
No files matched your search
@@ -114,7 +114,7 @@ NSDictionary *hostCall(NSDictionary *grant, bool loopback, NSString *tool, NSDic
|
||||
Descriptor peer(socket(address->sa_family, SOCK_STREAM, 0));
|
||||
const bool playtestCall = [@[@"start_playtest", @"playtest_input", @"playtest_debug", @"capture_playtest",
|
||||
@"restart_playtest", @"stop_playtest", @"get_debug_snapshot", @"capture_playtest_graphics",
|
||||
@"exchange_playtest_media"] containsObject:tool];
|
||||
@"exchange_playtest_media", @"start_playtest_video", @"stop_playtest_video"] containsObject:tool];
|
||||
const auto deadline = Clock::now() + std::chrono::seconds(playtestCall ? 55 : 5);
|
||||
if (peer.fd < 0 || fcntl(peer.fd, F_SETFL, O_NONBLOCK) < 0) return @{@"error":@"host_unavailable"};
|
||||
if (connect(peer.fd, address, address->sa_len) != 0) {
|
||||
@@ -381,6 +381,23 @@ NSDictionary *handle(id message, NSDictionary *grant, bool loopback, NSArray *to
|
||||
}
|
||||
NSMutableDictionary *data = [reply[@"result"] mutableCopy];
|
||||
NSMutableArray *content = [NSMutableArray array];
|
||||
if ([name isEqual:@"read_playtest_video"]) {
|
||||
NSString *encoded = data[@"video_chunk_base64"], *hash = data[@"sha256"];
|
||||
if (!string(encoded) || encoded.length > 87384 || !string(hash) || hash.length != 64 ||
|
||||
[hash rangeOfCharacterFromSet:[[NSCharacterSet characterSetWithCharactersInString:@"0123456789abcdef"] invertedSet]].location != NSNotFound ||
|
||||
![data[@"mime_type"] isEqual:@"video/mp4"] || ![data[@"clip_id"] isEqual:args[@"clip_id"]] ||
|
||||
!integer(data[@"offset"]) || !integer(data[@"next_offset"]) || !integer(data[@"byte_count"]) ||
|
||||
![data[@"eof"] isKindOfClass:NSNumber.class] || CFGetTypeID((__bridge CFTypeRef)data[@"eof"]) != CFBooleanGetTypeID())
|
||||
return toolError(rid, @"invalid_playtest_video");
|
||||
NSData *chunk = [[NSData alloc] initWithBase64EncodedString:encoded options:0];
|
||||
const long long offset = [data[@"offset"] longLongValue], next = [data[@"next_offset"] longLongValue], total = [data[@"byte_count"] longLongValue];
|
||||
const long long requestedOffset = args[@"offset"] ? [args[@"offset"] longLongValue] : 0;
|
||||
const NSUInteger limit = args[@"limit"] ? [args[@"limit"] unsignedIntegerValue] : 65536;
|
||||
if (!chunk || chunk.length > limit || chunk.length > 65536 || offset != requestedOffset || offset < 0 ||
|
||||
total < 1 || total > 67108864 || offset > total || next != offset + (long long)chunk.length || next > total ||
|
||||
[data[@"eof"] boolValue] != (next == total) || (!chunk.length && next < total))
|
||||
return toolError(rid, @"invalid_playtest_video");
|
||||
}
|
||||
if ([name isEqual:@"capture_playtest_audio"]) {
|
||||
NSString *encoded = data[@"audio_wav_base64"];
|
||||
if (!string(encoded) || !object(data[@"audio"])) return toolError(rid, @"invalid_playtest_audio");
|
||||
@@ -492,6 +509,10 @@ int main(int argc, char **argv) {
|
||||
if ([grant[@"kind"] isEqual:@"cmoc"] && toolset >= 7 &&
|
||||
[grant[@"playtest"] isEqual:@YES] && [grant[@"playtestAudio"] isEqual:@YES])
|
||||
tools = [tools arrayByAddingObjectsFromArray:MCPPlaytestAudioTools()];
|
||||
if ([grant[@"kind"] isEqual:@"cmoc"] && toolset >= 12 &&
|
||||
[grant[@"playtest"] isEqual:@YES] && CFGetTypeID((__bridge CFTypeRef)grant[@"playtest"]) == CFBooleanGetTypeID() &&
|
||||
[grant[@"playtestVideo"] isEqual:@YES] && CFGetTypeID((__bridge CFTypeRef)grant[@"playtestVideo"]) == CFBooleanGetTypeID())
|
||||
tools = [tools arrayByAddingObjectsFromArray:MCPPlaytestVideoTools()];
|
||||
if ([grant[@"kind"] isEqual:@"cmoc"] && toolset >= 10 && [grant[@"playtest"] isEqual:@YES] &&
|
||||
CFGetTypeID((__bridge CFTypeRef)grant[@"playtest"]) == CFBooleanGetTypeID() &&
|
||||
[grant[@"playtestCallContext"] isEqual:@YES] &&
|
||||
|
||||
Reference in new issue
Block a user