Skip to content
This repository was archived by the owner on Oct 31, 2022. It is now read-only.

Commit 5c2ccef

Browse files
committed
Limit the number of frames queued in Adobe products on MacOS to avoid an After Effects error
Fixes #18
1 parent e0c5cb8 commit 5c2ccef

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

Hap Codec.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
E25D566517E0E4E7008DD459 /* libsnappy.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = E215F3EC16FE1C3A0048B13B /* libsnappy.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
4848
E25D566617E0E4E7008DD459 /* libsquish.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = BDE9DE0A16169D82008DC368 /* libsquish.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
4949
E28C1FAB143B598500F2CD73 /* Utility.c in Sources */ = {isa = PBXBuildFile; fileRef = E28C1FAA143B598500F2CD73 /* Utility.c */; };
50+
E2B74BA01A5C566F000BE3CD /* Utility.m in Sources */ = {isa = PBXBuildFile; fileRef = E2B74B9F1A5C566F000BE3CD /* Utility.m */; };
51+
E2B74BA21A5C58AC000BE3CD /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2B74BA11A5C58AC000BE3CD /* Foundation.framework */; };
5052
E2C99CAA13789AC60077AC75 /* Tasks.c in Sources */ = {isa = PBXBuildFile; fileRef = E2C99CA813789AC60077AC75 /* Tasks.c */; };
5153
E2CCA54A18DBC577001FD4C0 /* ParallelLoops.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E2CCA54818DBC577001FD4C0 /* ParallelLoops.cpp */; };
5254
E2ECC4CC16FE86830016167B /* YCoCgDXT.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E2ECC4CB16FE86830016167B /* YCoCgDXT.cpp */; };
@@ -154,6 +156,8 @@
154156
E2210D3A15CAF913009DD434 /* ImageMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = ImageMath.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
155157
E22D0FEB169E13C6001C21D9 /* HapAlphaComponent.r */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.rez; path = HapAlphaComponent.r; sourceTree = "<group>"; };
156158
E28C1FAA143B598500F2CD73 /* Utility.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Utility.c; sourceTree = "<group>"; };
159+
E2B74B9F1A5C566F000BE3CD /* Utility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Utility.m; sourceTree = "<group>"; };
160+
E2B74BA11A5C58AC000BE3CD /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
157161
E2C99CA813789AC60077AC75 /* Tasks.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Tasks.c; sourceTree = "<group>"; };
158162
E2C99CA913789AC60077AC75 /* Tasks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tasks.h; sourceTree = "<group>"; };
159163
E2CCA54818DBC577001FD4C0 /* ParallelLoops.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParallelLoops.cpp; sourceTree = "<group>"; };
@@ -176,6 +180,7 @@
176180
isa = PBXFrameworksBuildPhase;
177181
buildActionMask = 2147483647;
178182
files = (
183+
E2B74BA21A5C58AC000BE3CD /* Foundation.framework in Frameworks */,
179184
E25D566317E0E4D5008DD459 /* libsnappy.dylib in Frameworks */,
180185
E25D566417E0E4DA008DD459 /* libsquish.dylib in Frameworks */,
181186
BDF48B1D14377E0E00E7EAB8 /* OpenGL.framework in Frameworks */,
@@ -204,6 +209,7 @@
204209
089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = {
205210
isa = PBXGroup;
206211
children = (
212+
E2B74BA11A5C58AC000BE3CD /* Foundation.framework */,
207213
BDF48B1C14377E0E00E7EAB8 /* OpenGL.framework */,
208214
BDFA8A331368E60100F959A4 /* Accelerate.framework */,
209215
FBFA8DEA0829E7CF00560632 /* CoreServices.framework */,
@@ -254,6 +260,7 @@
254260
E2C99CA813789AC60077AC75 /* Tasks.c */,
255261
E2F8FE91143B5A8F00683004 /* Utility.h */,
256262
E28C1FAA143B598500F2CD73 /* Utility.c */,
263+
E2B74B9F1A5C566F000BE3CD /* Utility.m */,
257264
32BAE0B30371A71500C91783 /* Hap_Codec_Prefix.pch */,
258265
BD51229816495811005F135B /* ExportedSymbols.exp */,
259266
);
@@ -470,6 +477,7 @@
470477
BDF48B1A14377D0500E7EAB8 /* HapCodecGL.c in Sources */,
471478
E28C1FAB143B598500F2CD73 /* Utility.c in Sources */,
472479
E2210D2B15CAE914009DD434 /* YCoCg.c in Sources */,
480+
E2B74BA01A5C566F000BE3CD /* Utility.m in Sources */,
473481
E2210D3B15CAF913009DD434 /* ImageMath.c in Sources */,
474482
BDDAEA8416160F7500FEC70D /* hap.c in Sources */,
475483
E2CCA54A18DBC577001FD4C0 /* ParallelLoops.cpp in Sources */,

source/Utility.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ SInt16 resourceIDForComponentType(OSType componentType, OSType resourceType)
102102
return 0;
103103
}
104104

105+
#if defined(_WIN32)
105106
int hapCodecMaxTasks()
106107
{
107108
/*
108109
Some Adobe products throw an error if they queue more than 10 buffers
109110
*/
110-
#if defined(_WIN32)
111111
TCHAR executablePath[MAX_PATH + 1];
112112
if (GetModuleFileName(0, executablePath, MAX_PATH + 1) != 0)
113113
{
@@ -116,9 +116,10 @@ int hapCodecMaxTasks()
116116
return 10;
117117
}
118118
}
119-
#endif
120119
return 20;
121120
}
121+
// Mac version is in Utility.m
122+
#endif
122123

123124
#if defined(_WIN32) && defined(DEBUG)
124125
void debug_print_s(void *glob, const char *func, const char *s)

source/Utility.m

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//
2+
// Utility.m
3+
// Hap Codec
4+
//
5+
// Created by Tom Butterworth on 06/01/2015.
6+
//
7+
//
8+
9+
#if defined(__APPLE__)
10+
#include "Utility.h"
11+
#import <Foundation/Foundation.h>
12+
13+
int hapCodecMaxTasks()
14+
{
15+
/*
16+
Some Adobe products throw an error if they queue more than 10 buffers
17+
*/
18+
NSString *name = [[NSProcessInfo processInfo] processName];
19+
if ([name containsString:@"Adobe"])
20+
{
21+
return 10;
22+
}
23+
NSLog(@"%@", name);
24+
return 20;
25+
}
26+
27+
#endif

0 commit comments

Comments
 (0)