I am going to call gstreamer functions in NPAPI plugin, but what I found is when I invoke method "gst_init" in plugin, it always failed! no matter I call it in a new thread or a child process, it can not get passed. so I'm wonder how can I call the gst_init function in the correct way? :)
for example :
Javascript code: obj.play();
obj is the plugin NPObject.
static void* play(void *) {
GMainLoop *loop;
GstElement *pipeline,*source,*decoder,*sink;
GstBus *bus;
gst_init(NULL, NULL);
...
}
bool plugin_invoke(NPObject *obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result) {
NPUTF8 *name = sBrowserFuncs->utf8fromidentifier(methodName);
if (strcmp(name, plugin_method_name_gs) == 0) {
...
pthread_t tid = 0;
int ret = 10000;
ret = pthread_create(&tid, NULL, play, NULL);
...
return true;
}
sBrowserFuncs->memfree(name);
return false;
}