Fix MP4Dump default log verbosity.

This commit is contained in:
Damiano Galassi committed 2020-09-24 09:41:58 +02:00
1 parent 4be2b21d7a
commit c9bceeb42f
5 files changed
+673 -4107

No files matched your search

+1
View File
@@ -44,6 +44,7 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap)
{ {
MP4SetLogCallback(logCallback); MP4SetLogCallback(logCallback);
MP4LogSetLevel(MP4_LOG_INFO); MP4LogSetLevel(MP4_LOG_INFO);
[NSUserDefaults.standardUserDefaults registerDefaults:@{@"MP42LogLevel" : @3}];
} }
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
File diff suppressed because it is too large. Load diff
+16 -9
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15504" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17503.1" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies> <dependencies>
<deployment identifier="macosx"/> <deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15504"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17503.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<objects> <objects>
@@ -18,7 +18,7 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/> <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="69" y="418" width="637" height="542"/> <rect key="contentRect" x="69" y="418" width="637" height="542"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/> <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
<value key="minSize" type="size" width="94" height="86"/> <value key="minSize" type="size" width="94" height="86"/>
<view key="contentView" id="6"> <view key="contentView" id="6">
<rect key="frame" x="0.0" y="0.0" width="637" height="542"/> <rect key="frame" x="0.0" y="0.0" width="637" height="542"/>
@@ -27,11 +27,11 @@
<scrollView fixedFrame="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="100021"> <scrollView fixedFrame="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="100021">
<rect key="frame" x="-1" y="22" width="639" height="521"/> <rect key="frame" x="-1" y="22" width="639" height="521"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" ambiguous="YES" drawsBackground="NO" id="vWS-ib-gMH"> <clipView key="contentView" drawsBackground="NO" id="vWS-ib-gMH">
<rect key="frame" x="1" y="1" width="622" height="519"/> <rect key="frame" x="1" y="1" width="622" height="519"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<textView ambiguous="YES" editable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" findStyle="bar" incrementalSearchingEnabled="YES" allowsCharacterPickerTouchBarItem="NO" allowsNonContiguousLayout="YES" textCompletion="NO" id="100024"> <textView editable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" findStyle="bar" incrementalSearchingEnabled="YES" allowsCharacterPickerTouchBarItem="NO" allowsNonContiguousLayout="YES" textCompletion="NO" id="100024">
<rect key="frame" x="0.0" y="0.0" width="637" height="519"/> <rect key="frame" x="0.0" y="0.0" width="637" height="519"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -51,12 +51,14 @@
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
</scroller> </scroller>
</scrollView> </scrollView>
<popUpButton fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="100025"> <popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="100025">
<rect key="frame" x="-1" y="-2" width="100" height="26"/> <rect key="frame" x="-5" y="0.0" width="100" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="95" id="ZCj-uf-QNs"/>
</constraints>
<popUpButtonCell key="cell" type="bevel" title="Info" bezelStyle="regularSquare" imagePosition="left" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="bezel" tag="3" inset="2" selectedItem="100042" id="100026"> <popUpButtonCell key="cell" type="bevel" title="Info" bezelStyle="regularSquare" imagePosition="left" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="bezel" tag="3" inset="2" selectedItem="100042" id="100026">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="menu"/>
<menu key="menu" title="OtherViews" id="100027"> <menu key="menu" title="OtherViews" id="100027">
<items> <items>
<menuItem title="Error" tag="1" id="100029"> <menuItem title="Error" tag="1" id="100029">
@@ -99,6 +101,11 @@
</popUpButtonCell> </popUpButtonCell>
</popUpButton> </popUpButton>
</subviews> </subviews>
<constraints>
<constraint firstItem="100025" firstAttribute="leading" secondItem="6" secondAttribute="leading" id="57r-Wz-FcB"/>
<constraint firstAttribute="bottom" secondItem="100025" secondAttribute="bottom" id="BEa-x1-qfp"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="100025" secondAttribute="trailing" constant="20" symbolic="YES" id="M0y-xi-Lot"/>
</constraints>
</view> </view>
<connections> <connections>
<outlet property="delegate" destination="-2" id="17"/> <outlet property="delegate" destination="-2" id="17"/>
@@ -160,7 +160,7 @@
2A37F4A9FDCFA73011CA2CEA /* Project object */ = { 2A37F4A9FDCFA73011CA2CEA /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 1200; LastUpgradeCheck = 1220;
}; };
buildConfigurationList = C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "MP4Dump" */; buildConfigurationList = C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "MP4Dump" */;
compatibilityVersion = "Xcode 11.4"; compatibilityVersion = "Xcode 11.4";
@@ -333,6 +333,7 @@
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../MP42Foundation/contrib/**"; HEADER_SEARCH_PATHS = "$(SRCROOT)/../../MP42Foundation/contrib/**";
MACOSX_DEPLOYMENT_TARGET = 10.15; MACOSX_DEPLOYMENT_TARGET = 10.15;
ONLY_ACTIVE_ARCH = YES;
}; };
name = Debug; name = Debug;
}; };
+11 -13
View File
@@ -40,14 +40,16 @@ extern NSString *libraryPath;
{ {
[super windowControllerDidLoadNib:aController]; [super windowControllerDidLoadNib:aController];
if ([NSUserDefaults.standardUserDefaults valueForKey:@"LogLevel"]) { if ([NSUserDefaults.standardUserDefaults valueForKey:@"MP42LogLevel"]) {
[logLevelButton selectItemWithTag:[NSUserDefaults.standardUserDefaults integerForKey:@"LogLevel"]]; [logLevelButton selectItemWithTag:[NSUserDefaults.standardUserDefaults integerForKey:@"MP42LogLevel"]];
} }
[self _resetTextView]; [self _resetTextView];
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:result attributes:self.attributes]; if (result) {
[textView.textStorage appendAttributedString:attributedString]; NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:result attributes:self.attributes];
[textView.textStorage appendAttributedString:attributedString];
}
} }
- (void)_resetTextView - (void)_resetTextView
@@ -64,7 +66,7 @@ extern NSString *libraryPath;
return NO; return NO;
} }
MP4LogLevel level = (MP4LogLevel)[NSUserDefaults.standardUserDefaults integerForKey:@"LogLevel"]; MP4LogLevel level = (MP4LogLevel)[NSUserDefaults.standardUserDefaults integerForKey:@"MP42LogLevel"];
MP4LogSetLevel(level); MP4LogSetLevel(level);
MP4Dump(fileHandle, 0); MP4Dump(fileHandle, 0);
@@ -76,11 +78,7 @@ extern NSString *libraryPath;
[NSFileManager.defaultManager removeItemAtPath:libraryPath error:nil]; [NSFileManager.defaultManager removeItemAtPath:libraryPath error:nil];
} }
if (result) { return result;
return YES;
} else {
return NO;
}
} }
- (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError
@@ -90,8 +88,8 @@ extern NSString *libraryPath;
return NO; return NO;
} }
if ([[NSFileManager defaultManager] isDeletableFileAtPath:libraryPath]) { if ([NSFileManager.defaultManager isDeletableFileAtPath:libraryPath]) {
[[NSFileManager defaultManager] removeItemAtPath:libraryPath error:nil]; [NSFileManager.defaultManager removeItemAtPath:libraryPath error:nil];
} }
return YES; return YES;
@@ -100,7 +98,7 @@ extern NSString *libraryPath;
- (IBAction)setLogLevel:(id)sender - (IBAction)setLogLevel:(id)sender
{ {
MP4LogLevel level = (MP4LogLevel)[sender tag]; MP4LogLevel level = (MP4LogLevel)[sender tag];
[NSUserDefaults.standardUserDefaults setInteger:level forKey:@"LogLevel"]; [NSUserDefaults.standardUserDefaults setInteger:level forKey:@"MP42LogLevel"];
MP4LogSetLevel(level); MP4LogSetLevel(level);
if ([self _loadFileDump:self.fileURL error:nil]) { if ([self _loadFileDump:self.fileURL error:nil]) {