Call fileSystemRepresentation directly on NSURL.

This commit is contained in:
Damiano Galassi committed 2016-09-09 17:14:45 +02:00
1 parent 598bb185c9
commit e8e0db5da1
7 files changed
+16 -16

No files matched your search

+3 -3
View File
@@ -732,11 +732,11 @@ static bool GetFirstHeader(FILE* inFile)
newTrack.sourceURL = self.fileURL; newTrack.sourceURL = self.fileURL;
if (!inFile) { if (!inFile) {
inFile = fopen(self.fileURL.path.fileSystemRepresentation, "rb"); inFile = fopen(self.fileURL.fileSystemRepresentation, "rb");
} }
struct stat st; struct stat st;
stat(self.fileURL.path.fileSystemRepresentation, &st); stat(self.fileURL.fileSystemRepresentation, &st);
size = st.st_size * 8; size = st.st_size * 8;
// collect all the necessary meta information // collect all the necessary meta information
@@ -842,7 +842,7 @@ static bool GetFirstHeader(FILE* inFile)
{ {
@autoreleasepool { @autoreleasepool {
if (!inFile) { if (!inFile) {
inFile = fopen(self.fileURL.path.fileSystemRepresentation, "rb"); inFile = fopen(self.fileURL.fileSystemRepresentation, "rb");
} }
MP4TrackId trackId = self.inputTracks.lastObject.sourceId; MP4TrackId trackId = self.inputTracks.lastObject.sourceId;
+3 -3
View File
@@ -281,11 +281,11 @@ static bool GetFirstHeader(FILE* inFile)
newTrack.sourceURL = self.fileURL; newTrack.sourceURL = self.fileURL;
if (!inFile) { if (!inFile) {
inFile = fopen(self.fileURL.path.fileSystemRepresentation, "rb"); inFile = fopen(self.fileURL.fileSystemRepresentation, "rb");
} }
struct stat st; struct stat st;
stat(self.fileURL.path.fileSystemRepresentation, &st); stat(self.fileURL.fileSystemRepresentation, &st);
size = st.st_size * 8; size = st.st_size * 8;
// collect all the necessary meta information // collect all the necessary meta information
@@ -356,7 +356,7 @@ static bool GetFirstHeader(FILE* inFile)
{ {
@autoreleasepool { @autoreleasepool {
if (!inFile) { if (!inFile) {
inFile = fopen(self.fileURL.path.fileSystemRepresentation, "rb"); inFile = fopen(self.fileURL.fileSystemRepresentation, "rb");
} }
MP4TrackId trackId = self.inputTracks.lastObject.sourceId; MP4TrackId trackId = self.inputTracks.lastObject.sourceId;
+4 -4
View File
@@ -128,7 +128,7 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
- (BOOL)startReading { - (BOOL)startReading {
NSAssert(self.fileHandle == MP4_INVALID_FILE_HANDLE, @"File Handle already open"); NSAssert(self.fileHandle == MP4_INVALID_FILE_HANDLE, @"File Handle already open");
_fileHandle = MP4Read(self.URL.path.fileSystemRepresentation); _fileHandle = MP4Read(self.URL.fileSystemRepresentation);
if (self.fileHandle != MP4_INVALID_FILE_HANDLE) { if (self.fileHandle != MP4_INVALID_FILE_HANDLE) {
self.status = MP42StatusReading; self.status = MP42StatusReading;
@@ -147,7 +147,7 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
- (BOOL)startWriting { - (BOOL)startWriting {
NSAssert(self.fileHandle == MP4_INVALID_FILE_HANDLE, @"File Handle already open"); NSAssert(self.fileHandle == MP4_INVALID_FILE_HANDLE, @"File Handle already open");
_fileHandle = MP4Modify(self.URL.path.fileSystemRepresentation, 0); _fileHandle = MP4Modify(self.URL.fileSystemRepresentation, 0);
if (self.fileHandle != MP4_INVALID_FILE_HANDLE) { if (self.fileHandle != MP4_INVALID_FILE_HANDLE) {
self.status = MP42StatusWriting; self.status = MP42StatusWriting;
@@ -602,7 +602,7 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
unsigned long long originalFileSize = [[[fileManager attributesOfItemAtPath:self.URL.path error:nil] valueForKey:NSFileSize] unsignedLongLongValue]; unsigned long long originalFileSize = [[[fileManager attributesOfItemAtPath:self.URL.path error:nil] valueForKey:NSFileSize] unsignedLongLongValue];
dispatch_async(dispatch_get_global_queue(0, 0), ^{ dispatch_async(dispatch_get_global_queue(0, 0), ^{
noErr = MP4Optimize(self.URL.path.fileSystemRepresentation, tempURL.path.fileSystemRepresentation); noErr = MP4Optimize(self.URL.fileSystemRepresentation, tempURL.fileSystemRepresentation);
OSAtomicIncrement32Barrier(&done); OSAtomicIncrement32Barrier(&done);
dispatch_semaphore_signal(sem); dispatch_semaphore_signal(sem);
}); });
@@ -745,7 +745,7 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
supportedBrandsCount = 2; supportedBrandsCount = 2;
} }
self.fileHandle = MP4CreateEx(self.URL.path.fileSystemRepresentation, self.fileHandle = MP4CreateEx(self.URL.fileSystemRepresentation,
flags, 1, 1, flags, 1, 1,
majorBrand, 0, majorBrand, 0,
supportedBrands, supportedBrandsCount); supportedBrands, supportedBrandsCount);
+3 -3
View File
@@ -1368,11 +1368,11 @@ NSData* H264Info(const char *filePath, uint32_t *pic_width, uint32_t *pic_height
newTrack.sourceURL = self.fileURL; newTrack.sourceURL = self.fileURL;
if (!inFile) { if (!inFile) {
inFile = fopen(self.fileURL.path.fileSystemRepresentation, "rb"); inFile = fopen(self.fileURL.fileSystemRepresentation, "rb");
} }
struct stat st; struct stat st;
stat(self.fileURL.path.fileSystemRepresentation, &st); stat(self.fileURL.fileSystemRepresentation, &st);
_size = st.st_size; _size = st.st_size;
uint32_t tw, th; uint32_t tw, th;
@@ -1422,7 +1422,7 @@ NSData* H264Info(const char *filePath, uint32_t *pic_width, uint32_t *pic_height
{ {
@autoreleasepool { @autoreleasepool {
if (!inFile) { if (!inFile) {
inFile = fopen(self.fileURL.path.fileSystemRepresentation, "rb"); inFile = fopen(self.fileURL.fileSystemRepresentation, "rb");
} }
MP42Track *track = self.inputTracks.lastObject; MP42Track *track = self.inputTracks.lastObject;
+1 -1
View File
@@ -165,7 +165,7 @@ static int readMkvPacket(struct StdIoStream *ioStream, TrackInfo *trackInfo, ui
{ {
if ((self = [super initWithURL:fileURL])) { if ((self = [super initWithURL:fileURL])) {
_ioStream = calloc(1, sizeof(StdIoStream)); _ioStream = calloc(1, sizeof(StdIoStream));
_matroskaFile = openMatroskaFile(self.fileURL.path.fileSystemRepresentation, _ioStream); _matroskaFile = openMatroskaFile(self.fileURL.fileSystemRepresentation, _ioStream);
if (!_matroskaFile) { if (!_matroskaFile) {
if (outError) { if (outError) {
+1 -1
View File
@@ -74,7 +74,7 @@
- (NSData *)magicCookieForTrack:(MP42Track *)track - (NSData *)magicCookieForTrack:(MP42Track *)track
{ {
if (!_fileHandle) { if (!_fileHandle) {
_fileHandle = MP4Read(self.fileURL.path.fileSystemRepresentation); _fileHandle = MP4Read(self.fileURL.fileSystemRepresentation);
} }
NSData *magicCookie = nil; NSData *magicCookie = nil;
+1 -1
View File
@@ -250,7 +250,7 @@ static void insertTagsFromStyleRecord(style_record record, NSMutableString *samp
- (BOOL)exportToURL:(NSURL *)url error:(NSError **)error - (BOOL)exportToURL:(NSURL *)url error:(NSError **)error
{ {
MP4FileHandle fileHandle = MP4Read(_sourceURL.path.fileSystemRepresentation); MP4FileHandle fileHandle = MP4Read(_sourceURL.fileSystemRepresentation);
if (!fileHandle) if (!fileHandle)
return NO; return NO;