androidmedia plugin doesn't register with gstreamer 1.8.3

Martin Vachovski Martin.Vachovski at skytek.com
Tue Sep 20 14:50:51 UTC 2016


Hi Sebastian,

Many thanks for the reply!

The project is derived from the HelloJNI
sample project of AndroidStudio- I have only added
the necessary libraries to the app/build.gradle file.
If it isn't against the mailing list policy I will be happy to provide the whole project as a .tar file
or the two files which I have basically modified- hello-jni.c and app/build.gradle
Let me know which form would be more convenient?

Meanwhile here it is the full listing of the hello-jni.c file
(basically the function Java_com_example_hellojni_HelloJni_stringFromJNI()
is called from java and I use it as a main function for my tests)

#include <jni.h>
#include <stdio.h>
#include <gst/gst.h>
#include <android/log.h>

GST_PLUGIN_STATIC_DECLARE(coreelements);
GST_PLUGIN_STATIC_DECLARE(androidmedia);

jstring
Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env,
                                                  jobject thiz )
{
    guint major, minor, micro, nano;
    char str[1024] = "default";
    GError *pError = NULL;
    GstPipeline *pPipe = NULL;
    GstElementFactory *factory;
    GstElement *pElement;
    GList* plugins; /* The head of the plug-in list */
    GList* pnode;   /* The currently viewed node */

    gst_init (NULL, NULL);
    gst_version (&major, &minor, &micro, &nano);

    GST_PLUGIN_STATIC_REGISTER(coreelements);
    GST_PLUGIN_STATIC_REGISTER(androidmedia);

    pPipe = gst_parse_launch("ahcsrc device=1 ! fakesink", &pError);

    factory = gst_element_factory_find("ahcsrc");
    if(factory)
        pElement = gst_element_factory_create (factory, "source");

    sprintf (str, "This program is linked against GStreamer %d.%d.%d\n"
             "pipeline %x\n"
             "factory %x\n"
             "element(ahcsrc) %x\n"
             "Error: %s\n",
             major, minor, micro,
             (void*) pPipe, (void*) factory, (void*) pElement, pError ? pError->message : "None");

    plugins = pnode = gst_registry_get_plugin_list(gst_registry_get());
    while(pnode)
    {
        GstPlugin* plugin = (GstPlugin*)pnode->data;
        sprintf (str, "%s%s\n", str, gst_plugin_get_name(plugin));
        pnode = g_list_next(pnode);
    }

    __android_log_write(ANDROID_LOG_INFO, "gst-test", str);//Or ANDROID_LOG_INFO, ...
    return (*env)->NewStringUTF(env, str);
}

Many thanks
________________________________________
From: gstreamer-android <gstreamer-android-bounces at lists.freedesktop.org> on behalf of Sebastian Dröge <sebastian at centricular.com>
Sent: Tuesday, September 20, 2016 3:33 PM
To: Discussions about GStreamer on Android
Subject: Re: androidmedia plugin doesn't register with gstreamer 1.8.3

On Di, 2016-09-20 at 10:23 +0000, Martin Vachovski wrote:
> Hello everybody,
>
> My name is Martin, I am new to this list.
>
> I am trying to build a pipeline which uses the ahcsrc element
> Here it is what I have:
> [...]

Please provide complete and buildable code so that someone can review
all steps you did and possibly try to reproduce it.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com


More information about the gstreamer-android mailing list