OCD
This commit is contained in:
1 parent
a6e03a0b06
commit
44ed8eb6d8
13 files changed
+44
-35
No files matched your search
@@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSArray (CSVAdditions)
|
||||
|
||||
+ (NSArray *)arrayWithContentsOfCSVURL: (NSURL *)url;
|
||||
+ (NSArray<NSArray<NSString *> *> * __nullable)arrayWithContentsOfCSVURL:(NSURL *)url;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@
|
||||
// <one>
|
||||
// <John said, "Hello there.">
|
||||
// <three>
|
||||
+ (NSArray *)arrayWithContentsOfCSVURL: (NSURL *)url
|
||||
+ (NSArray<NSArray<NSString *> *> * __nullable)arrayWithContentsOfCSVURL:(NSURL *)url;
|
||||
{
|
||||
NSString *str1 = STLoadFileWithUnknownEncoding(url.path);
|
||||
NSMutableString *csvString = STStandardizeStringNewlines(str1);
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "MP42Sample.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol MP42ConverterProtocol <NSObject>
|
||||
|
||||
@optional
|
||||
@@ -24,3 +26,5 @@
|
||||
- (void)setInputDone;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+6
-2
@@ -8,6 +8,8 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MP42Fifo : NSObject {
|
||||
@private
|
||||
id *_array;
|
||||
@@ -28,8 +30,8 @@
|
||||
- (instancetype)initWithCapacity:(NSUInteger)numItems;
|
||||
|
||||
- (void)enqueue:(id)item;
|
||||
- (id)deque NS_RETURNS_RETAINED;
|
||||
- (id)dequeAndWait NS_RETURNS_RETAINED;
|
||||
- (nullable id)deque NS_RETURNS_RETAINED;
|
||||
- (nullable id)dequeAndWait NS_RETURNS_RETAINED;
|
||||
|
||||
- (NSInteger)count;
|
||||
|
||||
@@ -40,3 +42,5 @@
|
||||
- (void)cancel;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+5
-6
@@ -30,11 +30,11 @@ extern NSString * const MP42OrganizeAlternateGroups;
|
||||
/**
|
||||
* MP42Status
|
||||
*/
|
||||
typedef enum MP42Status : NSInteger {
|
||||
typedef NS_ENUM(NSUInteger, MP42Status) {
|
||||
MP42StatusLoaded = 0,
|
||||
MP42StatusReading,
|
||||
MP42StatusWriting
|
||||
} MP42Status;
|
||||
};
|
||||
|
||||
/**
|
||||
* MP42FileDelegate
|
||||
@@ -42,7 +42,6 @@ typedef enum MP42Status : NSInteger {
|
||||
@protocol MP42FileDelegate <NSObject>
|
||||
@optional
|
||||
- (void)progressStatus:(CGFloat)progress;
|
||||
- (void)saveDidEnd:(id)sender;
|
||||
@end
|
||||
|
||||
@class MP42Muxer;
|
||||
@@ -77,7 +76,7 @@ typedef enum MP42Status : NSInteger {
|
||||
/**
|
||||
* indicates the URL with which the instance of MP42File was initialized.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSURL *URL;
|
||||
@property(nonatomic, readonly, nullable) NSURL *URL;
|
||||
|
||||
/**
|
||||
* Provides access to the mp4 file MP42Metadata instance.
|
||||
@@ -117,7 +116,7 @@ typedef enum MP42Status : NSInteger {
|
||||
*
|
||||
* @return An instance of MP42File
|
||||
*/
|
||||
- (instancetype)initWithExistingFile:(NSURL *)URL andDelegate:(_Nullable id <MP42FileDelegate>)del;
|
||||
- (instancetype)initWithExistingFile:(NSURL *)URL andDelegate:(nullable id <MP42FileDelegate>)del;
|
||||
|
||||
/**
|
||||
* Provides the array of MP42Tracks contained by the mp4 file
|
||||
@@ -140,7 +139,7 @@ typedef enum MP42Status : NSInteger {
|
||||
*
|
||||
* @return An instance of MP42Track; may be nil if no track of the specified trackID is available.
|
||||
*/
|
||||
- (MP42Track *)trackWithTrackID:(NSUInteger)trackID;
|
||||
- (MP42Track * __nullable)trackWithTrackID:(NSUInteger)trackID;
|
||||
|
||||
/**
|
||||
* Provides an array of MP42Track of the file that present media of the specified media type.
|
||||
|
||||
@@ -596,9 +596,6 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
|
||||
[fileManager release];
|
||||
}
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector(saveDidEnd:)])
|
||||
[self.delegate performSelector:@selector(saveDidEnd:) withObject:self];
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
@@ -829,10 +826,6 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
|
||||
[self customChaptersPreview];
|
||||
}
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector(saveDidEnd:)]) {
|
||||
[self.delegate performSelector:@selector(saveDidEnd:) withObject:self];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (NSUInteger)timescaleForTrack:(MP42Track *)track;
|
||||
- (NSSize)sizeForTrack:(MP42Track *)track;
|
||||
- (NSData *)magicCookieForTrack:(MP42Track *)track;
|
||||
- (nullable NSData *)magicCookieForTrack:(MP42Track *)track;
|
||||
- (AudioStreamBasicDescription)audioDescriptionForTrack:(MP42Track *)track;
|
||||
|
||||
- (void)setActiveTrack:(MP42Track *)track;
|
||||
@@ -58,10 +58,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (BOOL)done;
|
||||
- (void)setDone:(BOOL)status;
|
||||
|
||||
- (BOOL)cleanUp:(MP42FileHandle) fileHandle;
|
||||
- (BOOL)cleanUp:(MP42FileHandle)fileHandle;
|
||||
|
||||
@property(readwrite, retain) MP42Metadata *metadata;
|
||||
@property(readonly) NSMutableArray<MP42Track *> *tracks;
|
||||
@property(readonly) MP42Metadata *metadata;
|
||||
@property(readonly) NSArray<MP42Track *> *tracks;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+5
-1
@@ -8,6 +8,8 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A simple heap/priority queue implementations with a static size.
|
||||
* It takes a NSComparator in input.
|
||||
@@ -24,7 +26,7 @@
|
||||
- (instancetype)initWithCapacity:(NSUInteger)numItems andComparator:(NSComparator)cmptr;
|
||||
|
||||
- (void)insert:(id)item;
|
||||
- (id)extract NS_RETURNS_RETAINED;
|
||||
- (nullable id)extract NS_RETURNS_RETAINED;
|
||||
|
||||
- (NSInteger)count;
|
||||
|
||||
@@ -32,3 +34,5 @@
|
||||
- (BOOL)isEmpty;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+3
-3
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@interface MP42Metadata : NSObject <NSCoding, NSCopying> {
|
||||
@private
|
||||
NSString *presetName;
|
||||
NSMutableDictionary *tagsDict;
|
||||
NSMutableDictionary<NSString *, id> *tagsDict;
|
||||
|
||||
NSMutableArray<MP42Image *> *artworks;
|
||||
|
||||
@@ -54,11 +54,11 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (BOOL) mergeMetadata: (MP42Metadata *) newMetadata;
|
||||
|
||||
@property(nonatomic, readonly) NSMutableDictionary *tagsDict;
|
||||
@property(nonatomic, readonly) NSMutableDictionary<NSString *, id> *tagsDict;
|
||||
|
||||
@property(nonatomic, readwrite, copy) NSString *presetName;
|
||||
|
||||
@property(nonatomic, readwrite, retain) NSMutableArray *artworks;
|
||||
@property(nonatomic, readwrite, retain) NSMutableArray<MP42Image *> *artworks;
|
||||
|
||||
@property(nonatomic, readwrite, retain, nullable) NSArray<NSURL *> *artworkThumbURLs;
|
||||
@property(nonatomic, readwrite, retain, nullable) NSArray<NSURL *> *artworkFullsizeURLs;
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
return NSMakeSize([currentTrack width], [currentTrack height]);
|
||||
}
|
||||
|
||||
- (NSData*)magicCookieForTrack:(MP42Track *)track
|
||||
- (NSData *)magicCookieForTrack:(MP42Track *)track
|
||||
{
|
||||
if (!_fileHandle)
|
||||
_fileHandle = MP4Read([[_fileURL path] UTF8String]);
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
// Copyright 2010 Damiano Galassi. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "mp4v2.h"
|
||||
#import "MP42Logging.h"
|
||||
|
||||
|
||||
+12
-7
@@ -59,7 +59,7 @@
|
||||
|
||||
- (BOOL)setup:(NSError **)outError
|
||||
{
|
||||
NSMutableArray *unsupportedTracks = [[NSMutableArray alloc] init];;
|
||||
NSMutableArray<MP42Track *> *unsupportedTracks = [[NSMutableArray alloc] init];;
|
||||
|
||||
for (MP42Track *track in _workingTracks) {
|
||||
MP4TrackId dstTrackId = 0;
|
||||
@@ -388,21 +388,24 @@
|
||||
|
||||
- (void)work
|
||||
{
|
||||
if (![_workingTracks count])
|
||||
if (![_workingTracks count]) {
|
||||
return;
|
||||
}
|
||||
|
||||
@autoreleasepool {
|
||||
NSMutableArray *trackImportersArray = [[NSMutableArray alloc] init];
|
||||
NSMutableArray<MP42FileImporter *> *trackImportersArray = [[NSMutableArray alloc] init];
|
||||
NSUInteger done = 0, update = 0;
|
||||
CGFloat progress = 0;
|
||||
|
||||
for (MP42Track *track in _workingTracks) {
|
||||
if (![trackImportersArray containsObject:track.muxer_helper->importer])
|
||||
if (![trackImportersArray containsObject:track.muxer_helper->importer]) {
|
||||
[trackImportersArray addObject:track.muxer_helper->importer];
|
||||
}
|
||||
}
|
||||
|
||||
for (MP42FileImporter *importerHelper in trackImportersArray)
|
||||
for (MP42FileImporter *importerHelper in trackImportersArray) {
|
||||
[importerHelper startReading];
|
||||
}
|
||||
|
||||
NSUInteger tracksImportersCount = [trackImportersArray count];
|
||||
NSUInteger tracksCount = [_workingTracks count];
|
||||
@@ -426,8 +429,9 @@
|
||||
done += (track.muxer_helper->done ? 1 : 0);
|
||||
}
|
||||
|
||||
if (_cancelled)
|
||||
if (_cancelled) {
|
||||
break;
|
||||
}
|
||||
|
||||
// If all tracks are done, exit the loop
|
||||
if (done == tracksCount) {
|
||||
@@ -439,8 +443,9 @@
|
||||
// Update progress
|
||||
if (!(update % 200)) {
|
||||
progress = 0;
|
||||
for (MP42FileImporter *importerHelper in trackImportersArray)
|
||||
for (MP42FileImporter *importerHelper in trackImportersArray) {
|
||||
progress += [importerHelper progress];
|
||||
}
|
||||
|
||||
progress /= tracksImportersCount;
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
// Copyright 2010 Damiano Galassi. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class MP42Track;
|
||||
|
||||
|
||||
Reference in new issue
Block a user