X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=modules%2Faccess%2Fqtcapture.m;h=0a334ecff1c843d559e254db23838d7bea232927;hb=0ec27002334a468048bd296458610321370266c4;hp=78fb6049067cd46fedc117cfa86f5a5228fff2f8;hpb=bd4bd54dc68f76525ede8700361dc50e5872d376;p=vlc diff --git a/modules/access/qtcapture.m b/modules/access/qtcapture.m index 78fb604906..0a334ecff1 100644 --- a/modules/access/qtcapture.m +++ b/modules/access/qtcapture.m @@ -38,6 +38,7 @@ #include #import +#import /***************************************************************************** * Local prototypes @@ -109,7 +110,11 @@ vlc_module_end(); { imageBufferToRelease = currentImageBuffer; currentImageBuffer = videoFrame; - currentPts = 1000000L / [sampleBuffer presentationTime].timeScale * [sampleBuffer presentationTime].timeValue; + currentPts = (mtime_t)(1000000L / [sampleBuffer presentationTime].timeScale * [sampleBuffer presentationTime].timeValue); + + /* Try to use hosttime of the sample if available, because iSight Pts seems broken */ + NSNumber *hosttime = (NSNumber *)[sampleBuffer attributeForKey:QTSampleBufferHostTimeAttribute]; + if( hosttime ) currentPts = (mtime_t)AudioConvertHostTimeToNanos([hosttime unsignedLongLongValue])/1000; } CVBufferRelease(imageBufferToRelease); } @@ -323,9 +328,9 @@ static void Close( vlc_object_t *p_this ) if( vlc_object_alive(p_this->p_libvlc)) { [p_sys->session stopRunning]; + [p_sys->device release]; [p_sys->output release]; [p_sys->session release]; - [p_sys->device release]; } free( p_sys );