gtk+gstreamer编译错误处理方案
修改gtkgstsink.c:74行
static GstStaticPadTemplate gtk_gst_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (
#ifdef HAVE_GSTREAMER_DRM
GST_VIDEO_DMA_DRM_CAPS_MAKE "; "
#endif
"video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), "
"format = (string) RGBA, "
"width = " GST_VIDEO_SIZE_RANGE ", "
"height = " GST_VIDEO_SIZE_RANGE ", "
"framerate = " GST_VIDEO_FPS_RANGE ", "
"texture-target = (string) 2D"
"; " NOGL_CAPS)
);
#endif
修改为:
#ifdef _MSC_VER
static GstStaticPadTemplate gtk_gst_sink_template =
{
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
{
/* caps */ NULL,
/* string */ "video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), "
"format = (string) RGBA, "
"width = " GST_VIDEO_SIZE_RANGE ", "
"height = " GST_VIDEO_SIZE_RANGE ", "
"framerate = " GST_VIDEO_FPS_RANGE ", "
"texture-target = (string) 2D"
"; "
"video/x-raw, "
"format = (string) " FORMATS ", "
"width = " GST_VIDEO_SIZE_RANGE ", "
"height = " GST_VIDEO_SIZE_RANGE ", "
"framerate = " GST_VIDEO_FPS_RANGE,
{NULL}
}
};
#else
static GstStaticPadTemplate gtk_gst_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (
#ifdef HAVE_GSTREAMER_DRM
GST_VIDEO_DMA_DRM_CAPS_MAKE "; "
#endif
"video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), "
"format = (string) RGBA, "
"width = " GST_VIDEO_SIZE_RANGE ", "
"height = " GST_VIDEO_SIZE_RANGE ", "
"framerate = " GST_VIDEO_FPS_RANGE ", "
"texture-target = (string) 2D"
"; " NOGL_CAPS)
);
#endif
修改gskglframe.c:73行
g_clear_pointer(&self->sync, glDeleteSync);
修改为:
#ifndef _MSC_VER
g_clear_pointer(&self->sync, glDeleteSync);
#else
G_STMT_START
{
/* Only one access, please; work around type aliasing */
if (sizeof * (&self->sync) == sizeof(gpointer))
{
union
{
char* in;
gpointer* out;
} _pp;
gpointer _p; /* This assignment is needed to avoid a gcc warning */
_pp.in = (char*)(&self->sync);
_p = *_pp.out;
if (_p)
{
*_pp.out = NULL;
glDeleteSync(_p);
}
}
} G_STMT_END
GLIB_AVAILABLE_MACRO_IN_2_34;
#endif // !_MSC_VER
修改dispatch_wgl.c:78
if (!first_context_current)
{
first_context_current = true;
}
else
{
if (!already_switched_to_dispatch_table)
{
already_switched_to_dispatch_table = true;
gl_switch_to_dispatch_table();
wgl_switch_to_dispatch_table();
}
gl_init_dispatch_table();
wgl_init_dispatch_table();
}
修改为:
#ifdef _MSC_VER
if (!already_switched_to_dispatch_table)
{
{
gl_tls_index = TlsAlloc();
if (gl_tls_index == TLS_OUT_OF_INDEXES)
return;
void* data = LocalAlloc(LPTR, gl_tls_size);
TlsSetValue(gl_tls_index, data);
}
{
wgl_tls_index = TlsAlloc();
if (wgl_tls_index == TLS_OUT_OF_INDEXES)
return;
void* data = LocalAlloc(LPTR, wgl_tls_size);
TlsSetValue(wgl_tls_index, data);
}
already_switched_to_dispatch_table = true;
gl_switch_to_dispatch_table();
wgl_switch_to_dispatch_table();
gl_init_dispatch_table();
wgl_init_dispatch_table();
}
#else
if (!first_context_current)
{
first_context_current = true;
}
else
{
if (!already_switched_to_dispatch_table)
{
already_switched_to_dispatch_table = true;
gl_switch_to_dispatch_table();
wgl_switch_to_dispatch_table();
}
gl_init_dispatch_table();
wgl_init_dispatch_table();
}
#endif // _MSC_VER
修改dispatch_common.c:299
fputs("Attempting to dlopen() while in the dynamic linker.\n", stderr);
abort();
修改为:
#ifndef _MSC_VER
fputs("Attempting to dlopen() while in the dynamic linker.\n", stderr);
abort();
#else
fputs("Attempting to dlopen() while in the dynamic linker.\n", stdout);
#endif // !_MSC_VER
gstreamer编译命令:
meson setup --vsenv builddir --prefix=D:/gnome/gstreamer
meson compile -C builddir -j1
meson install -C builddir --no-rebuild
gtk4编译命令:
meson setup builddir --prefix=D:/gnome/gtk4 -Dbuild-tests=false
meson compile -C builddir -j1
meson install -C builddir --no-rebuild