Skip to content

Commit

Permalink
Minor project updates and code tweaks
Browse files Browse the repository at this point in the history
Update Xcode projects
Snappy and Squish use libc++
Update hap.h/.c to latest
Minor tweaks to satisfy a couple of new Xcode warnings
  • Loading branch information
bangnoise committed Apr 11, 2018
1 parent 0499d0d commit fa24e21
Show file tree
Hide file tree
Showing 10 changed files with 142 additions and 24 deletions.
48 changes: 46 additions & 2 deletions HapInAVFoundation.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
1A642D171A65245600E2152D /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A680E291A39F67E007678E5 /* CoreMedia.framework */; };
1A642D181A65245900E2152D /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A680E231A39CFFF007678E5 /* AVFoundation.framework */; };
1A642D1C1A652CE900E2152D /* HapInAVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A97F5AB1A38ABBF00E0DC74 /* HapInAVFoundation.framework */; };
1A642D1D1A652CF000E2152D /* HapInAVFoundation.framework in copy frameworks */ = {isa = PBXBuildFile; fileRef = 1A97F5AB1A38ABBF00E0DC74 /* HapInAVFoundation.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
1A642D1D1A652CF000E2152D /* HapInAVFoundation.framework in copy frameworks */ = {isa = PBXBuildFile; fileRef = 1A97F5AB1A38ABBF00E0DC74 /* HapInAVFoundation.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1A680E241A39CFFF007678E5 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A680E231A39CFFF007678E5 /* AVFoundation.framework */; };
1A680E2A1A39F67E007678E5 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A680E291A39F67E007678E5 /* CoreMedia.framework */; };
1A8904FD1A38D25400A6CE71 /* libsquish.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A0535F11A38C9C4005B47BD /* libsquish.dylib */; };
Expand Down Expand Up @@ -668,7 +668,7 @@
1A97F5A21A38ABBF00E0DC74 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0720;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = Vidvox;
TargetAttributes = {
1A3230131A3BA14000DDB2E0 = {
Expand Down Expand Up @@ -875,6 +875,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
Expand Down Expand Up @@ -910,6 +911,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
Expand Down Expand Up @@ -942,6 +944,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
Expand Down Expand Up @@ -978,6 +981,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
Expand Down Expand Up @@ -1005,11 +1009,29 @@
1A97F5BF1A38ABBF00E0DC74 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = s;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand All @@ -1020,6 +1042,7 @@
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
Expand All @@ -1034,14 +1057,33 @@
1A97F5C01A38ABBF00E0DC74 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
Expand All @@ -1056,6 +1098,7 @@
1A97F5C21A38ABBF00E0DC74 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_X86_VECTOR_INSTRUCTIONS = ssse3;
COMBINE_HIDPI_IMAGES = YES;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -1081,6 +1124,7 @@
1A97F5C31A38ABBF00E0DC74 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_X86_VECTOR_INSTRUCTIONS = ssse3;
COMBINE_HIDPI_IMAGES = YES;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
Expand Down
2 changes: 1 addition & 1 deletion HapInAVFoundation/AVAssetWriterHapInput.m
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ - (BOOL) appendPixelBuffer:(CVPixelBufferRef)pb withPresentationTime:(CMTime)t a


// assemble a block that will encode the passed pixel buffer- i'll either be dispatching this block (via GCD) or executing it immediately...
void (^encodeBlock)() = ^(){
void (^encodeBlock)(void) = ^(){
//NSLog(@"%s",__func__);
// if there's a pixel buffer to encode, let's take care of that first
if (pb!=NULL) {
Expand Down
30 changes: 24 additions & 6 deletions external/hap/hap.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,22 @@ unsigned long HapMaxEncodedLength(unsigned int count,
// Start with the length of a multiple-image section header
unsigned long total_length = 8;

if (count == 0 || count > 2)
// Return 0 for bad arguments
if (count == 0 || count > 2
|| inputBytes == NULL
|| textureFormats == NULL
|| chunkCounts == NULL)
{
return HapResult_Bad_Arguments;
return 0;
}

for (unsigned int i = 0; i < count; i++) {
for (int i = 0; i < count; i++)
{
if (chunkCounts[i] == 0)
{
return 0;
}

// Assume snappy, the worst case
total_length += hap_max_encoded_length(inputBytes[i], textureFormats[i], HapCompressorSnappy, chunkCounts[i]);
}
Expand Down Expand Up @@ -491,6 +501,14 @@ unsigned int HapEncode(unsigned int count,
return HapResult_Bad_Arguments;
}

for (int i = 0; i < count; i++)
{
if (chunkCounts[i] == 0)
{
return HapResult_Bad_Arguments;
}
}

if (count == 1)
{
// Encode without the multi-image layout
Expand All @@ -516,7 +534,7 @@ unsigned int HapEncode(unsigned int count,
{
// Calculate the worst-case size for the top section and choose a header-length based on that
top_section_length = 0;
for (unsigned int i = 0; i < count; i++)
for (int i = 0; i < count; i++)
{
top_section_length += inputBuffersBytes[i] + hap_decode_instructions_length(chunkCounts[i]) + 4;
}
Expand All @@ -532,7 +550,7 @@ unsigned int HapEncode(unsigned int count,

// Encode each texture
top_section_length = 0;
for (unsigned int i = 0; i < count; i++)
for (int i = 0; i < count; i++)
{
void *section = ((uint8_t *)outputBuffer) + top_section_header_length + top_section_length;
unsigned int result = hap_encode_texture(inputBuffers[i],
Expand Down Expand Up @@ -892,7 +910,7 @@ int hap_get_section_at_index(const void *input_buffer, uint32_t input_buffer_byt
input_buffer = ((uint8_t *)input_buffer) + section_header_length;
section_header_length = 0;
*section_length = 0;
for (unsigned int i = 0; i <= index; i++) {
for (int i = 0; i <= index; i++) {
offset += section_header_length + *section_length;
if (offset >= top_section_length)
{
Expand Down
10 changes: 5 additions & 5 deletions external/hap/hap.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ typedef void (*HapDecodeWorkFunction)(void *p, unsigned int index);
typedef void (*HapDecodeCallback)(HapDecodeWorkFunction function, void *p, unsigned int count, void *info);

/*
Returns the maximum size of an output buffer for a frame composed of multiple textures.
count is the number of textures
Returns the maximum size of an output buffer for a frame composed of one or more textures, or returns 0 on error.
count is the number of textures (1 or 2) and matches the number of values in the array arguments
lengths is an array of input texture lengths in bytes
textureFormats is an array of HapTextureFormats
chunkCounts is an array of chunk counts
chunkCounts is an array of chunk counts (1 or more)
*/
unsigned long HapMaxEncodedLength(unsigned int count,
unsigned long *lengths,
Expand All @@ -82,12 +82,12 @@ unsigned long HapMaxEncodedLength(unsigned int count,
HapTextureFormat_YCoCg_DXT5 + HapTextureFormat_A_RGTC1
Use HapMaxEncodedLength() to discover the minimal value for outputBufferBytes.
count is the number of textures (1 or 2)
count is the number of textures (1 or 2) and matches the number of values in the array arguments
inputBuffers is an array of count pointers to texture data
inputBufferBytes is an array of texture data lengths in bytes
textureFormats is an array of HapTextureFormats
compressors is an array of HapCompressors
chunkCounts is an array of chunk counts to permit multithreaded decoding
chunkCounts is an array of chunk counts to permit multithreaded decoding (1 or more)
outputBuffer is the destination buffer to receive the encoded frame
outputBufferBytes is the destination buffer's length in bytes
outputBufferBytesUsed will be set to the actual encoded length of the frame on return
Expand Down
34 changes: 31 additions & 3 deletions external/snappy/snappy-mac/snappy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
E2830FC217E0C43A005E72C3 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0720;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = Vidvox;
};
buildConfigurationList = E2830FC517E0C43A005E72C3 /* Build configuration list for PBXProject "snappy" */;
Expand Down Expand Up @@ -171,22 +171,35 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libstdc++";
CLANG_CXX_LIBRARY = "compiler-default";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand All @@ -211,22 +224,35 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libstdc++";
CLANG_CXX_LIBRARY = "compiler-default";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"NDEBUG=1",
HAVE_CONFIG_H,
Expand All @@ -248,6 +274,7 @@
COMBINE_HIDPI_IMAGES = YES;
EXECUTABLE_PREFIX = lib;
LD_DYLIB_INSTALL_NAME = "@rpath/$(EXECUTABLE_PATH)";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
Expand All @@ -259,6 +286,7 @@
COMBINE_HIDPI_IMAGES = YES;
EXECUTABLE_PREFIX = lib;
LD_DYLIB_INSTALL_NAME = "@rpath/$(EXECUTABLE_PATH)";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
Expand Down
Loading

0 comments on commit fa24e21

Please sign in to comment.