Permalink
Browse files

From Eric Wing, QTKit plugin for reading movies under OSX using QTKit…

… + CoreVideo
  • Loading branch information...
1 parent edff01b commit 551eaccf691c3e57081198bff67f0028faf28843 @osg-training-guest osg-training-guest committed Sep 24, 2010
View
@@ -512,6 +512,8 @@ IF(NOT APPLE)
ELSE()
FIND_PACKAGE(QuickTime)
+ FIND_PACKAGE(QTKit)
+ FIND_PACKAGE(CoreVideo)
ENDIF()
################################################################################
@@ -0,0 +1,25 @@
+# Locate Apple CoreVideo (next-generation QuickTime)
+# This module defines
+# COREVIDEO_LIBRARY
+# COREVIDEO_FOUND, if false, do not try to link to gdal
+# COREVIDEO_INCLUDE_DIR, where to find the headers
+#
+# $COREVIDEO_DIR is an environment variable that would
+# correspond to the ./configure --prefix=$COREVIDEO_DIR
+#
+# Created by Eric Wing.
+
+# CoreVideo on OS X looks different than CoreVideo for Windows,
+# so I am going to case the two.
+
+IF(APPLE)
+ FIND_PATH(COREVIDEO_INCLUDE_DIR CoreVideo/CoreVideo.h)
+ FIND_LIBRARY(COREVIDEO_LIBRARY CoreVideo)
+ENDIF()
+
+
+SET(COREVIDEO_FOUND "NO")
+IF(COREVIDEO_LIBRARY AND COREVIDEO_INCLUDE_DIR)
+ SET(COREVIDEO_FOUND "YES")
+ENDIF()
+
@@ -0,0 +1,45 @@
+# Locate Apple QTKit (next-generation QuickTime)
+# This module defines
+# QTKIT_LIBRARY
+# QTKIT_FOUND, if false, do not try to link to gdal
+# QTKIT_INCLUDE_DIR, where to find the headers
+#
+# $QTKIT_DIR is an environment variable that would
+# correspond to the ./configure --prefix=$QTKIT_DIR
+#
+# Created by Eric Wing.
+
+# QTKit on OS X looks different than QTKit for Windows,
+# so I am going to case the two.
+
+IF(APPLE)
+ FIND_PATH(QTKIT_INCLUDE_DIR QTKit/QTKit.h)
+ FIND_LIBRARY(QTKIT_LIBRARY QTKit)
+ENDIF()
+
+
+SET(QTKIT_FOUND "NO")
+IF(QTKIT_LIBRARY AND QTKIT_INCLUDE_DIR)
+ SET(QTKIT_FOUND "YES")
+ENDIF()
+
+IF(APPLE)
+ # Technically QTKit is 64-bit capable, but the QTKit plug-in currently uses
+ # a few 32-bit only APIs to bridge QTKit and Core Video.
+ # As such, the plugin won't compile for 64-bit until Apple fixes this hole
+ # in their API.
+ # For simplicitly, I pretend QTKit is only 32-bit, but if/when Apple fixes
+ # this, we need an OS version check.
+ # Snow Leopard still lacks a 64-bit path for this.
+ #First check to see if we are running with a native 64-bit compiler (10.6 default) and implicit arch
+ IF(NOT CMAKE_OSX_ARCHITECTURES AND CMAKE_SIZEOF_VOID_P EQUAL 8)
+ SET(QTKIT_FOUND "NO")
+ ELSE()
+ #Otherwise check to see if 64-bit is explicitly called for.
+ LIST(FIND CMAKE_OSX_ARCHITECTURES "x86_64" has64Compile)
+ IF(NOT has64Compile EQUAL -1)
+ SET(QTKIT_FOUND "NO")
+ ENDIF()
+ ENDIF()
+ENDIF()
+
@@ -268,9 +268,28 @@ Registry::Registry()
addFileExtensionAlias("png", "imageio");
addFileExtensionAlias("psd", "imageio");
addFileExtensionAlias("tga", "imageio");
+
+#endif
+
+#if defined(DARWIN_QTKIT)
+ addFileExtensionAlias("mov", "QTKit");
+ addFileExtensionAlias("mp4", "QTKit");
+ addFileExtensionAlias("mov", "QTKit");
+ addFileExtensionAlias("mpg", "QTKit");
+ addFileExtensionAlias("mpeg", "QTKit");
+ addFileExtensionAlias("mpv", "QTKit");
+ addFileExtensionAlias("m4v", "QTKit");
+ addFileExtensionAlias("3gp", "QTKit");
+ addFileExtensionAlias("live", "QTKit");
+ // Requires Perian
+ addFileExtensionAlias("avi", "QTKit");
+ addFileExtensionAlias("xvid", "QTKit");
+ // Requires Flip4Mac
+ addFileExtensionAlias("wmv", "QTKit");
#endif
#if defined(DARWIN_QUICKTIME)
+
addFileExtensionAlias("jpg", "qt");
addFileExtensionAlias("jpe", "qt");
addFileExtensionAlias("jpeg", "qt");
@@ -280,24 +299,28 @@ Registry::Registry()
addFileExtensionAlias("png", "qt");
addFileExtensionAlias("psd", "qt");
addFileExtensionAlias("tga", "qt");
- addFileExtensionAlias("mov", "qt");
- addFileExtensionAlias("avi", "qt");
- addFileExtensionAlias("mpg", "qt");
addFileExtensionAlias("flv", "qt");
- addFileExtensionAlias("mpv", "qt");
addFileExtensionAlias("dv", "qt");
- addFileExtensionAlias("mp4", "qt");
- addFileExtensionAlias("m4v", "qt");
- addFileExtensionAlias("3gp", "qt");
- // Add QuickTime live support for OSX
- addFileExtensionAlias("live", "qt");
+ #if !defined(DARWIN_QTKIT)
+
+ addFileExtensionAlias("mov", "qt");
+ addFileExtensionAlias("avi", "qt");
+ addFileExtensionAlias("mpg", "qt");
+ addFileExtensionAlias("mpv", "qt");
+ addFileExtensionAlias("mp4", "qt");
+ addFileExtensionAlias("m4v", "qt");
+ addFileExtensionAlias("3gp", "qt");
+ // Add QuickTime live support for OSX
+ addFileExtensionAlias("live", "qt");
+ #endif
#else
addFileExtensionAlias("jpg", "jpeg");
addFileExtensionAlias("jpe", "jpeg");
addFileExtensionAlias("tif", "tiff");
// really need to decide this at runtime...
#if defined(USE_XINE)
+
addFileExtensionAlias("mov", "xine");
addFileExtensionAlias("mpg", "xine");
addFileExtensionAlias("ogv", "xine");
@@ -309,7 +332,10 @@ Registry::Registry()
#endif
// support QuickTime for Windows
- #if defined(USE_QUICKTIME)
+ // Logic error here. It is possible for Apple to not define Quicktime and end up in
+ // this Quicktime for Windows block. So add an extra check to avoid QTKit clashes.
+ #if defined(USE_QUICKTIME) && !defined(DARWIN_QTKIT)
+
addFileExtensionAlias("mov", "qt");
addFileExtensionAlias("live", "qt");
addFileExtensionAlias("mpg", "qt");
@@ -218,6 +218,12 @@ IF(QUICKTIME_FOUND)
ADD_SUBDIRECTORY(quicktime)
ENDIF()
+IF(QTKIT_FOUND)
+ ADD_SUBDIRECTORY(QTKit)
+ENDIF()
+
+
+
IF(FREETYPE_FOUND)
ADD_SUBDIRECTORY(freetype)
ENDIF()
@@ -0,0 +1,17 @@
+INCLUDE_DIRECTORIES( ${QTKIT_INCLUDE_DIR} )
+
+SET(TARGET_SRC
+ ReaderWriterQTKit.mm
+)
+
+SET(TARGET_LIBRARIES_VARS QTKIT_LIBRARY COCOA_LIBRARY QUICKTIME_LIBRARY COREVIDEO_LIBRARY)
+SET(TARGET_ADDED_LIBRARIES osgViewer )
+
+
+IF(CMAKE_COMPILER_IS_GNUCXX)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
+ENDIF()
+
+
+#### end var setup ###
+SETUP_PLUGIN(QTKit)
Oops, something went wrong.

0 comments on commit 551eacc

Please sign in to comment.