1
SWIG를 사용하여 Gstreamer 함수를 PHP로 래핑하려고하는데 C 콜백을 처리하는 방법을 알 수 없습니다. C에서 PHP 함수를 호출 할 수 있습니까? 다음과 같은 콜백을 어떻게 처리 할 것인가?SWIG를 통한 Wrap C 콜백
#include <gst/gst.h>
// ...
static gboolean my_callback(GstBus *bus, GstMessage *message, gpointer user_data) {
g_print("Got %s message\n", GST_MESSAGE_TYPE_NAME(message));
switch(GST_MESSAGE_TYPE(message)) {
// ...
}
return TRUE;
}
main(gint argc, gchar *argv[])
{
GstElement *pipeline;
GstBus *bus;
gst_init (&argc, &argv);
pipeline = gst_pipeline_new ("my_pipeline");
/* add handler */
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
gst_bus_add_watch (bus, my_bus_callback, NULL); // ------------<
gst_object_unref (bus);
// ...
}
답변 주셔서 감사하지만 예제에서는 C++을 사용합니다. – Fuerteflojo