#include <vlc_interface.h>
#import <QTKit/QTKit.h>
+#import <CoreAudio/CoreAudio.h>
/*****************************************************************************
* Local prototypes
{
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);
}
if( vlc_object_alive(p_this->p_libvlc))
{
[p_sys->session stopRunning];
- [p_sys->device release];
[p_sys->output release];
[p_sys->session release];
}