Commit 344b1df5 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

qtcapture: Use Hosttime when available.

parent 1d31c009
...@@ -4954,6 +4954,7 @@ then ...@@ -4954,6 +4954,7 @@ then
VLC_ADD_LDFLAGS([macosx], [-Wl,-framework,IOKit]) VLC_ADD_LDFLAGS([macosx], [-Wl,-framework,IOKit])
VLC_ADD_LDFLAGS([macosx], [-Wl,-framework,QuickTime]) VLC_ADD_LDFLAGS([macosx], [-Wl,-framework,QuickTime])
VLC_ADD_LDFLAGS([macosx qtcapture], [-Wl,-framework,QTKit]) 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([macosx], [-Wl,-framework,WebKit])
VLC_ADD_LDFLAGS([opengllayer qtcapture], [-Wl,-framework,QuartzCore]) VLC_ADD_LDFLAGS([opengllayer qtcapture], [-Wl,-framework,QuartzCore])
VLC_ADD_LDFLAGS([qtcapture], [-Wl,-framework,CoreVideo]) VLC_ADD_LDFLAGS([qtcapture], [-Wl,-framework,CoreVideo])
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <vlc_interface.h> #include <vlc_interface.h>
#import <QTKit/QTKit.h> #import <QTKit/QTKit.h>
#import <CoreAudio/CoreAudio.h>
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
...@@ -109,7 +110,11 @@ vlc_module_end(); ...@@ -109,7 +110,11 @@ vlc_module_end();
{ {
imageBufferToRelease = currentImageBuffer; imageBufferToRelease = currentImageBuffer;
currentImageBuffer = videoFrame; 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); CVBufferRelease(imageBufferToRelease);
} }
......
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