openFrameworks

ofxHapPlayer with AVFoundation

More than 1 year has passed since last update.

ofxHapPlayerをoF0.9.x+macOS 10.12で使う

masterだとQTKitがあれなのであれですね.

なので素直にlibavformatブランチを使いましょう.

基本的には普通に動きますがオーディオが入ってるとアプリ終了時にAudioThreadが怪しいです.
今回はオーディオは要らない使い方だったのでhapファイルからオーディオを抜いて逃げ腰の解決.

配布

で, 問題の配布(展示用のマシンで走らせたい, とか.)ですが, ofxHapがdylib使ってるのでdylibなんですね.

なのでRun Scriptの最後に

# libsnappy

rsync -aved ../../../addons/ofxHapPlayer/libs/snappy/lib/osx/libsnappy.1.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/";
install_name_tool -change @rpath/snappy/lib/osx/libsnappy.1.dylib @executable_path/../Frameworks/libsnappy.1.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME";

# libffmpeg

rsync -aved ../../../addons/ofxHapPlayer/libs/ffmpeg/lib/osx/libavcodec.57.64.101.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/";
install_name_tool -change @rpath/ffmpeg/lib/osx/libavcodec.57.dylib @executable_path/../Frameworks/libavcodec.57.64.101.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME";

rsync -aved ../../../addons/ofxHapPlayer/libs/ffmpeg/lib/osx/libavformat.57.56.101.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/";
install_name_tool -change @rpath/ffmpeg/lib/osx/libavformat.57.dylib @executable_path/../Frameworks/libavformat.57.56.101.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME";

rsync -aved ../../../addons/ofxHapPlayer/libs/ffmpeg/lib/osx/libavutil.55.34.101.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/";
install_name_tool -change @rpath/ffmpeg/lib/osx/libavutil.55.dylib @executable_path/../Frameworks/libavutil.55.34.101.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME";

rsync -aved ../../../addons/ofxHapPlayer/libs/ffmpeg/lib/osx/libswresample.2.3.100.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Frameworks/";
install_name_tool -change @rpath/ffmpeg/lib/osx/libswresample.2.dylib @executable_path/../Frameworks/libswresample.2.3.100.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME";

を追加しましょう. これで何とかなります.

なんかもっとスマートな方法ある気もするけど取り敢えず.