mareksuma1985 / GStreamer_Tutorial_udpsink

Streams video from main camera to a given IP address.
10 stars 4 forks source link

There was an error building in the latest version #2

Open QiaoJingjing opened 10 months ago

QiaoJingjing commented 10 months ago

``Hi , Thank you for trying. I'm working on it. Now I have some problems. Can we discuss them together? I am currently building with the following versions NDK: 21.4.7075529 Gstreamer: 1.22.7 SDK: 32

During this build, I ran into problems with “undefined reference to gst_photography_get_type' and ”undefined reference togst_photography_set_autofocus' in function `gst_native_set_auto_focus'。

I'm stuck here and don't know how to proceed. This is my Android.mk and Application.mk and build. Gradle Please help me! Thank you!

Android.mk: `LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS) LOCAL_CFLAGS := -DGST_USE_UNSTABLE_API

设置源文件

LOCAL_MODULE :=android_camera LOCAL_SRC_FILES := android_camera.c dummy.cpp LOCAL_SHARED_LIBRARIES := gstreamer_android

添加 GStreamer 库

LOCAL_LDLIBS += -landroid -ldl -llog include $(BUILD_SHARED_LIBRARY)

GST_V4L2_USE_LIBV4L2 := 1

设置你的 GStreamer 路径

GSTREAMER_ROOT_PATH := D:\CodeRepo\AndroidProject\gstreamer-1.0-android-universal-1.22.7

ifndef GSTREAMER_ROOT_ANDROID $(error GSTREAMER_ROOT_ANDROID is not defined!) endif

ifeq ($(TARGET_ARCH_ABI),armeabi) GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/arm else ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/armv7 else ifeq ($(TARGET_ARCH_ABI),arm64-v8a) GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/arm64 else ifeq ($(TARGET_ARCH_ABI),x86) GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/x86 else ifeq ($(TARGET_ARCH_ABI),x86_64) GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/x86_64 else $(error Target arch ABI not supported: $(TARGET_ARCH_ABI)) endif

GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_ROOT)/share/gst-android/ndk-build/

include $(GSTREAMER_NDK_BUILD_PATH)/plugins.mk GSTREAMER_PLUGINS := $(GSTREAMER_PLUGINS_CORE) $(GSTREAMER_PLUGINS_ENCODING) androidmedia videofilter openh264 flac opensles opengl $(GSTREAMER_PLUGINS_NET)

GSTREAMER_EXTRA_DEPS := gstreamer-video-1.0 gstreamer-player-1.0 gio-2.0 glib-2.0 GSTREAMER_EXTRA_LIBS := -liconv include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer-1.0.mk`

Application.mk: APP_ABI = armeabi armeabi-v7a arm64-v8a x86 x86_64 APP_STL = c++_shared

build.gradle: `plugins { id 'com.android.application' }

android { compileSdk 32

defaultConfig {
    applicationId "com.huracan.androidgstreamerapp"
    minSdk 21
    targetSdk 32
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    externalNativeBuild {
        ndkBuild {
            def gstRoot

            if (project.hasProperty('gstAndroidRoot'))
                gstRoot = project.gstAndroidRoot
            else
                gstRoot = System.env.GSTREAMER_ROOT_ANDROID

            if (gstRoot == null)
                throw new GradleException('GSTREAMER_ROOT_ANDROID must be set, or "gstAndroidRoot" must be defined in your gradle.properties in the top level directory of the unpacked universal GStreamer Android binaries')

            arguments "NDK_APPLICATION_MK=jni/Application.mk", "GSTREAMER_JAVA_SRC_DIR=src", "GSTREAMER_ROOT_ANDROID=$gstRoot", "GSTREAMER_ASSETS_DIR=src/assets"

            targets "android_camera"

            // All archs except MIPS and MIPS64 are supported
            abiFilters  'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
        }
    }
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
externalNativeBuild {
    ndkBuild {
        path file('jni/Android.mk')
    }
}
ndkVersion '21.4.7075529'
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

}

dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.3.0' implementation 'com.google.android.material:material:1.4.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' }`

QiaoJingjing commented 10 months ago

“gst_photography_get_type” to remove this code can be published, run, this is required