与Gstreamer应用程序汇编有关以下问题。我试图使用以下代码从GSTREAMER管道中检索FrameBuffer的代码。
char* pullImage(int* outlen, GstElement* sink)
{
// Will block until sample is ready. In our case "sample" is encoded picture.
GstAppSink *appsink = GST_APP_SINK(sink);
if (!appsink) {
printf("appsink is NULL\n");
exit(1);
}
GstSample* sample = gst_app_sink_pull_sample(appsink);
if(sample == NULL)
{
fprintf(stderr, "gst_app_sink_pull_sample returned null\n");
return NULL;
}
// Actual compressed image is stored inside GstSample.
GstBuffer* buffer = gst_sample_get_buffer (sample);
GstMapInfo map;
gst_buffer_map (buffer, &map, GST_MAP_READ);
// Allocate appropriate buffer to store compressed image
char* pRet = new char[map.size];
// Copy image
memmove(pRet, map.data, map.size);
gst_buffer_unmap (buffer, &map);
gst_sample_unref (sample);
// Inform caller of image size
*outlen = map.size;
return pRet;
}
然后发生以下错误
COLLECT_GCC_OPTIONS='--sysroot=/opt/imx/4.14-sumo/sysroots/aarch64-poky-linux' '-march=armv8-a' '-mcpu=cortex-a53' '-std=c11' '-D' 'UCEXCONDATA_EXPORTS' '-D' '_GNU_SOURCE' '-I' '/opt/imx/4.14-sumo/sysroots/aarch64-poky-linux/usr/include' '-I' '/opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux/usr/include/gstreamer-1.0' '-I' '/opt/imx/4.14-sumo/sysroots/aarch64-poky-linux/usr/include/glib-2.0' '-I' '/opt/imx/4.14-sumo/sysroots/aarch64-poky-linux/usr/lib/glib-2.0/include' '-I' '/home/xxx/workspace/codeTester/src' '-I' '/opt/imx/4.14-sumo/sysroots/aarch64-poky-linux/usr/include/c++/7.3.0' '-I' '/home/xxx/LibPackages/arm-gsoap-2.8/gsoap/plugin' '-I' '/home/xxx/LibPackages/arm-gsoap-2.8/gsoap' '-I' '/home/xxx/LibPackages/arm-gsoap-2.8/gsoap/import' '-I' '/home/xxx/workspace/bwc-app/src/MsgProtocol/WSDD/gen' '-O0' '-Wall' '-c' '-fpermissive' '-fmessage-length=0' '-v' '-fPIC' '-pthread' '-MMD' '-MP' '-MF' '.metadata/.plugins/org.eclipse.cdt.make.core/specs.d' '-MT' '.metadata/.plugins/org.eclipse.cdt.make.core/specs.o' '-o' '.metadata/.plugins/org.eclipse.cdt.make.core/specs.o' '-mlittle-endian' '-mabi=lp64'
Building target: codeTester
Invoking: GCC C++ Cross-Linker
aarch64-poky-linux-g++ -march=armv8-a -mcpu=cortex-a53 --sysroot=/opt/imx/4.14-sumo/sysroots/aarch64-poky-linux -L/usr/local/aarch64-linux/lib -L"/home/xxx/imx/QRCodeTest/library" -L/opt/imx/4.14-sumo/sysroots/aarch64-poky-linux/usr/lib -L"/home/xxx/workspace/libwsdd" -pthread -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed ./src/utility/readpng.o ./src/TestLoopShotWithBuffer.o ./.metadata/.plugins/org.eclipse.cdt.make.core/specs.o -ldl -lgstreamer-1.0 -lgobject-2.0 -lglib-2.0 -lgstrtspserver-1.0 -lpng -lstdc++ -lcodeTest -o "codeTester"
./src/TestLoopShotWithBuffer.o: In function `pullImageBuffer(int*, _GstElement*)':
TestLoopShotWithBuffer.cpp:(.text+0x15c44): undefined reference to `gst_app_sink_get_type'
TestLoopShotWithBuffer.cpp:(.text+0x15c7c): undefined reference to `gst_app_sink_pull_sample'
collect2: error: ld returned 1 exit status
makefile:47: recipe for target 'codeTester' failed
make: *** [codeTester] Error 1
Building target: codeTester
Invoking: GCC C++ Cross-Linker
aarch64-poky-linux-g++ -march=armv8-a -mcpu=cortex-a53 --sysroot=/opt/imx/4.14-sumo/sysroots/aarch64-poky-linux -L/usr/local/aarch64-linux/lib -L"/home/xxx/workspace/codeTester/library" -L/opt/imx/4.14-sumo/sysroots/aarch64-poky-linux/usr/lib -L"/home/xxx/bwc-workspace/libwsdd" -pthread -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed ./src/utility/readpng.o ./src/TestLoopShotWithBuffer.o ./.metadata/.plugins/org.eclipse.cdt.make.core/specs.o -ldl -lgstreamer-1.0 -lgobject-2.0 -lglib-2.0 -lgstrtspserver-1.0 -lgstreamer-app-1.0 -lpng -lstdc++ -lnsl -lm -lcode -o "codeTester"
/opt/imx/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/7.3.0/real-ld: cannot find -lgstreamer-app-1.0
collect2: error: ld returned 1 exit status
makefile:47: recipe for target 'codeTester' failed
make: *** [codeTester] Error 1
我想知道这次怎么了?
雷德
对于我来说,这是通过添加到
gstapp-1.0
CMakeLists.txt
缺少。添加到cmakelists.txt:gstapp-1.0