]> git.sesse.net Git - vlc/commitdiff
qtcapture: Use Hosttime when available.
authorDerk-Jan Hartman <hartman@videolan.org>
Mon, 21 Jul 2008 00:28:42 +0000 (02:28 +0200)
committerDerk-Jan Hartman <hartman@videolan.org>
Mon, 21 Jul 2008 00:28:42 +0000 (02:28 +0200)
configure.ac
modules/access/qtcapture.m

index 4c4dbc33723c8aa0b7fc25782c4c31436cbef052..351db9e189925337e0fa7b0f25dd8354770e2668 100644 (file)
@@ -4954,6 +4954,7 @@ then
   VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,IOKit])
   VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,QuickTime])
   VLC_ADD_LDFLAGS([macosx qtcapture],                 [-Wl,-framework,QTKit])
+  VLC_ADD_LDFLAGS([qtcapture],                        [-Wl,-framework,CoreAudio])
   VLC_ADD_LDFLAGS([macosx],                           [-Wl,-framework,WebKit])
   VLC_ADD_LDFLAGS([opengllayer qtcapture],            [-Wl,-framework,QuartzCore])
   VLC_ADD_LDFLAGS([qtcapture],                        [-Wl,-framework,CoreVideo])
index bb99846bb493f326586cdfd00be0eb50c5f4f376..0a334ecff1c843d559e254db23838d7bea232927 100644 (file)
@@ -38,6 +38,7 @@
 #include <vlc_interface.h>
 
 #import <QTKit/QTKit.h>
+#import <CoreAudio/CoreAudio.h>
 
 /*****************************************************************************
 * 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);
 }