File tree Expand file tree Collapse file tree 3 files changed +21
-17
lines changed
Expand file tree Collapse file tree 3 files changed +21
-17
lines changed Original file line number Diff line number Diff line change @@ -171,16 +171,17 @@ - (instancetype)initWithInputSource:(SFBInputSource *)inputSource detectContentT
171171 NSString *lowercaseExtension = inputSource.url .pathExtension .lowercaseString ;
172172 NSString *lowercaseMIMEType = mimeTypeHint.lowercaseString ;
173173
174- // Instead of failing for non-seekable inputs just skip content type detection
175- if (detectContentType && !inputSource.supportsSeeking ) {
176- os_log_error (gSFBAudioDecoderLog , " Unable to detect content type for non-seekable input source %{public}@" , inputSource);
177- detectContentType = NO ;
174+ if (detectContentType) {
175+ // If the input source can't be opened decoding is destined to fail; give up now
176+ if (!inputSource.isOpen && ![inputSource openReturningError: error])
177+ return nil ;
178+ // Instead of failing for non-seekable inputs just skip content type detection
179+ if (!inputSource.supportsSeeking ) {
180+ os_log_error (gSFBAudioDecoderLog , " Unable to detect content type for non-seekable input source %{public}@" , inputSource);
181+ detectContentType = NO ;
182+ }
178183 }
179184
180- // If the input source can't be opened decoding is destined to fail; give up now
181- if (detectContentType && !inputSource.isOpen && ![inputSource openReturningError: error])
182- return nil ;
183-
184185 int score = 10 ;
185186 Class subclass = nil ;
186187
Original file line number Diff line number Diff line change @@ -171,16 +171,17 @@ - (instancetype)initWithInputSource:(SFBInputSource *)inputSource detectContentT
171171 NSString *lowercaseExtension = inputSource.url .pathExtension .lowercaseString ;
172172 NSString *lowercaseMIMEType = mimeTypeHint.lowercaseString ;
173173
174- // Instead of failing for non-seekable inputs just skip content type detection
175- if (detectContentType && !inputSource.supportsSeeking ) {
176- os_log_error (gSFBDSDDecoderLog , " Unable to detect content type for non-seekable input source %{public}@" , inputSource);
177- detectContentType = NO ;
174+ if (detectContentType) {
175+ // If the input source can't be opened decoding is destined to fail; give up now
176+ if (!inputSource.isOpen && ![inputSource openReturningError: error])
177+ return nil ;
178+ // Instead of failing for non-seekable inputs just skip content type detection
179+ if (!inputSource.supportsSeeking ) {
180+ os_log_error (gSFBDSDDecoderLog , " Unable to detect content type for non-seekable input source %{public}@" , inputSource);
181+ detectContentType = NO ;
182+ }
178183 }
179184
180- // If the input source can't be opened decoding is destined to fail; give up now
181- if (detectContentType && !inputSource.isOpen && ![inputSource openReturningError: error])
182- return nil ;
183-
184185 int score = 10 ;
185186 Class subclass = nil ;
186187
Original file line number Diff line number Diff line change @@ -125,7 +125,9 @@ - (BOOL)getLength:(NSInteger *)length error:(NSError **)error
125125
126126- (BOOL )supportsSeeking
127127{
128- return YES ;
128+ // Regular files are always seekable.
129+ // Punt on testing whether ftello() and fseeko() actually work.
130+ return S_ISREG (_filestats.st_mode );
129131}
130132
131133- (BOOL )seekToOffset : (NSInteger )offset error : (NSError **)error
You can’t perform that action at this time.
0 commit comments