Commit fa36e769 authored by Alexander Alekhin's avatar Alexander Alekhin Committed by GitHub

Merge pull request #8979 from sabzo:issue/8305_unhandled_objective_c_exception_video_avi_playback

Unhandled Objective-C exception when playing video
parents e397794a f71bf21a
...@@ -697,7 +697,15 @@ CvCaptureFile::CvCaptureFile(const char* filename) { ...@@ -697,7 +697,15 @@ CvCaptureFile::CvCaptureFile(const char* filename) {
return; return;
} }
mAssetTrack = [[mAsset tracksWithMediaType: AVMediaTypeVideo][0] retain]; NSArray *tracks = [mAsset tracksWithMediaType:AVMediaTypeAudio];
if ([tracks count] == 0) {
fprintf(stderr, "OpenCV: Couldn't read movie file \"%s\"\n", filename);
[localpool drain];
started = 0;
return;
}
mAssetTrack = [tracks[0] retain];
if ( ! setupReadingAt(kCMTimeZero) ) { if ( ! setupReadingAt(kCMTimeZero) ) {
fprintf(stderr, "OpenCV: Couldn't read movie file \"%s\"\n", filename); fprintf(stderr, "OpenCV: Couldn't read movie file \"%s\"\n", filename);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment