Fixup OSX execution & packaging.

This commit is contained in:
brunoherbelin
2020-07-23 15:35:59 +02:00
parent cec49a9a62
commit ad15f2096b
5 changed files with 59 additions and 28 deletions

View File

@@ -414,12 +414,17 @@ IF(APPLE)
RUNTIME DESTINATION bin COMPONENT Runtime
)
set(plugin_dest_dir vimix.app/Contents/MacOS/)
set(plugin_dest_dir vimix.app/Contents/Resources/)
install(FILES "/usr/local/Cellar/gstreamer/1.16.2/libexec/gstreamer-1.0/gst-plugin-scanner"
DESTINATION "${plugin_dest_dir}"
PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
COMPONENT Runtime
)
install(DIRECTORY "${PKG_GSTREAMER_PLUGIN_DIR}" DESTINATION "${plugin_dest_dir}" COMPONENT Runtime)
install(DIRECTORY "/usr/local/Cellar/gst-plugins-base/1.16.2/lib/gstreamer-1.0" DESTINATION "${plugin_dest_dir}" COMPONENT Runtime)
install(DIRECTORY "/usr/local/Cellar/gst-plugins-good/1.16.2/lib/gstreamer-1.0" DESTINATION "${plugin_dest_dir}" COMPONENT Runtime)
install(DIRECTORY "/usr/local/Cellar/gst-plugins-bad/1.16.2_3/lib/gstreamer-1.0" DESTINATION "${plugin_dest_dir}" COMPONENT Runtime)
install(DIRECTORY "/usr/local/Cellar/gst-plugins-ugly/1.16.2_1/lib/gstreamer-1.0" DESTINATION "${plugin_dest_dir}" COMPONENT Runtime)
# install(DIRECTORY "/usr/local/Cellar/gst-plugins-ugly/1.16.2_1/lib/gstreamer-1.0" DESTINATION "${plugin_dest_dir}" COMPONENT Runtime)
install(DIRECTORY "/usr/local/Cellar/gst-libav/1.16.2/lib/gstreamer-1.0" DESTINATION "${plugin_dest_dir}" COMPONENT Runtime)
# package runtime fixup bundle

View File

@@ -161,8 +161,8 @@ void MediaPlayer::execute_open()
// instruct the sink to send samples synched in time
gst_base_sink_set_sync (GST_BASE_SINK(sink), true);
gst_base_sink_set_max_lateness (GST_BASE_SINK(sink), 0 );
gst_base_sink_set_processing_deadline (GST_BASE_SINK(sink), 0 );
// gst_base_sink_set_max_lateness (GST_BASE_SINK(sink), 0 );
// gst_base_sink_set_processing_deadline (GST_BASE_SINK(sink), 0 );
// instruct sink to use the required caps
gst_app_sink_set_caps (GST_APP_SINK(sink), caps);
@@ -173,9 +173,15 @@ void MediaPlayer::execute_open()
// set the callbacks
GstAppSinkCallbacks callbacks;
callbacks.eos = callback_end_of_stream;
callbacks.new_preroll = callback_new_preroll;
if (isimage_) {
callbacks.eos = NULL;
callbacks.new_sample = NULL;
}
else {
callbacks.eos = callback_end_of_stream;
callbacks.new_sample = callback_new_sample;
}
gst_app_sink_set_callbacks (GST_APP_SINK(sink), &callbacks, this, NULL);
gst_app_sink_set_emit_signals (GST_APP_SINK(sink), false);
@@ -614,7 +620,8 @@ void MediaPlayer::update()
discoverer_ = nullptr;
}
if (!enabled_)
// prevent unnecessary updates
if (!enabled_ || (isimage_ && textureindex_>0 ) )
return;
// local variables before trying to update
@@ -633,10 +640,12 @@ void MediaPlayer::update()
}
index_lock_.unlock();
// lock frame while reading it
if (!frame_[read_index].access.try_lock())
// do not block rendering if everything is too busy
return;
// // lock frame while reading it
// if (!frame_[read_index].access.try_lock())
// // do not block rendering if everything is too busy
// return;
frame_[read_index].access.lock();
// do not fill a frame twice
if (frame_[read_index].status != EMPTY ) {

View File

@@ -146,30 +146,33 @@ bool Rendering::init()
//
// Gstreamer setup
//
std::string plugins_path = SystemToolkit::path_filename(Settings::application.executable);
plugins_path += "gstreamer-1.0";
std::string plugins_path = SystemToolkit::cwd_path() + "gstreamer-1.0";
std::string plugins_scanner = SystemToolkit::cwd_path() + "gst-plugin-scanner" ;
if ( SystemToolkit::file_exists(plugins_path)) {
Log::Info("Found Gstreamer plugins in %s", plugins_path.c_str());
g_setenv ("GST_PLUGIN_SYSTEM_PATH", plugins_path.c_str(), TRUE);
g_setenv ("GST_PLUGIN_SCANNER", plugins_scanner.c_str(), TRUE);
}
g_setenv ("GST_GL_API", "opengl3", TRUE);
gst_init (NULL, NULL);
#if GST_GL_HAVE_PLATFORM_WGL
global_gl_context = gst_gl_context_new_wrapped (display, (guintptr) wglGetCurrentContext (),
GST_GL_PLATFORM_WGL, GST_GL_API_OPENGL);
#elif GST_GL_HAVE_PLATFORM_CGL
// global_display = GST_GL_DISPLAY ( glfwGetCocoaMonitor(main_.window()) );
global_display = GST_GL_DISPLAY (gst_gl_display_cocoa_new ());
global_gl_context = gst_gl_context_new_wrapped (global_display,
(guintptr) 0,
GST_GL_PLATFORM_CGL, GST_GL_API_OPENGL);
#elif GST_GL_HAVE_PLATFORM_GLX
global_display = (GstGLDisplay*) gst_gl_display_x11_new_with_display( glfwGetX11Display() );
global_gl_context = gst_gl_context_new_wrapped (global_display,
(guintptr) glfwGetGLXContext(main_.window()),
GST_GL_PLATFORM_GLX, GST_GL_API_OPENGL);
#endif
//#if GST_GL_HAVE_PLATFORM_WGL
// global_gl_context = gst_gl_context_new_wrapped (display, (guintptr) wglGetCurrentContext (),
// GST_GL_PLATFORM_WGL, GST_GL_API_OPENGL);
//#elif GST_GL_HAVE_PLATFORM_CGL
//// global_display = GST_GL_DISPLAY ( glfwGetCocoaMonitor(main_.window()) );
// global_display = GST_GL_DISPLAY (gst_gl_display_cocoa_new ());
// global_gl_context = gst_gl_context_new_wrapped (global_display,
// (guintptr) 0,
// GST_GL_PLATFORM_CGL, GST_GL_API_OPENGL);
//#elif GST_GL_HAVE_PLATFORM_GLX
// global_display = (GstGLDisplay*) gst_gl_display_x11_new_with_display( glfwGetX11Display() );
// global_gl_context = gst_gl_context_new_wrapped (global_display,
// (guintptr) glfwGetGLXContext(main_.window()),
// GST_GL_PLATFORM_GLX, GST_GL_API_OPENGL);
//#endif
//

View File

@@ -178,6 +178,17 @@ std::string SystemToolkit::home_path()
return string(mHomePath) + PATH_SEP;
}
std::string SystemToolkit::cwd_path()
{
char mCwdPath[PATH_MAX];
if (getcwd(mCwdPath, sizeof(mCwdPath)) != NULL)
return string(mCwdPath) + PATH_SEP;
else
return string();
}
std::string SystemToolkit::username()
{
// 1. find home

View File

@@ -21,6 +21,9 @@ namespace SystemToolkit
// get the OS dependent home path
std::string home_path();
// get the OS dependent location
std::string cwd_path();
// get the OS dependent path where to store settings
std::string settings_path();