gpt4 book ai didi

ffmpeg - 在 PPAPI : Naclports with FFmpeg 中使用 FFMPEG 库

转载 作者:行者123 更新时间:2023-12-04 23:27:54 24 4
gpt4 key购买 nike

我已经配置了Webports,ffmpeg;我为当前项目创建了以下 Makefile。但是,我在 ffmpeg 库链接方面遇到了一些问题。

$ TOOLCHAIN=pnacl make
LINK pnacl/Release/client_unstripped.bc
pnacl/Release/src/client.o: error: undefined reference to 'av_register_all'
make: *** [pnacl/Release/client_unstripped.bc] Error 1

你能告诉我我在这里做错了什么吗,我的 Makefile 如下所示:

VALID_TOOLCHAINS := pnacl glibc clang-newlib win

NACL_SDK_ROOT ?= $(abspath $(CURDIR)/../..)

TARGET = client

OTHERDIR=src

INC_DIR = inc

FFMPEG_INC_DIR = ../../toolchain/mac_pnacl/le32-nacl/usr/include

INCLUDES = -I$(INC_DIR) -I$(FFMPEG_INC_DIR)

include $(NACL_SDK_ROOT)/tools/common.mk

CHROME_ARGS += --allow-nacl-socket-api=localhost

LIBS = nacl_io ppapi_cpp ppapi

CFLAGS = -Wall -g -O2 $(INCLUDES) -L../../toolchain/mac_pnacl/le32-nacl/usr/lib -lavformat \ -lvpx -lvorbisenc -lvorbis -logg -ltheoraenc -ltheoradec -logg -lmp3lame -lm -pthread -lavcodec -lvpx -lvorbisenc -lvorbis -logg \ -ltheoraenc -ltheoradec -logg -lmp3lame -lm -pthread -lswresample -lm -lavutil -lm -lavdevice -lavfilter

SOURCES = $(OTHERDIR)/tcp_util.cc $(OTHERDIR)/tpool.cc $(OTHERDIR)/net.cc $(OTHERDIR)/rtsp_response.cc \ $(OTHERDIR)/rtsp.cc $(OTHERDIR)/rtsp_common.cc \ $(OTHERDIR)/rtsp_client.cc $(OTHERDIR)/udp_util.cc \ $(OTHERDIR)/client.cc

# Build rules generated by macros from common.mk:

$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS))))

# The PNaCl workflow uses both an unstripped and finalized/stripped binary. # On NaCl, only produce a stripped binary for Release configs (not Debug). ifneq (,$(or $(findstring pnacl,$(TOOLCHAIN)),$(findstring Release,$(CONFIG)))) $(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS))) $(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped)) else $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) endif

$(eval $(call NMF_RULE,$(TARGET),))



这就是在类上下文中如何使用库的方式。
class VideoDecodePack {
public:
VideoDecodePack() {
av_register_all();
}
};

class ClientInstance : public pp::Instance {
public:
explicit ClientInstance(PP_Instance instance) : pp::Instance(instance){
cses = InitRtspClientSession();
_videoDecoder = new VideoDecodePack();
}
...

最佳答案

我通过添加与 FFMPEG 的其他库的链接解决了这个问题:vpx、vorbis、lame。保持链接库的顺序非常重要。

.....
...
TARGET = client
INC_DIR := inc

include $(NACL_SDK_ROOT)/tools/common.mk

DEPS = ppapi_simple nacl_io
LIBS = ppapi_simple nacl_io ppapi pthread \
avformat vpx vorbisenc vorbis ogg theoraenc \
theoradec mp3lame m avcodec swresample avutil \
avdevice avfilter

OTHERDIR = src

CFLAGS = -Wall
# -I$(INC_DIR)
SOURCES = $(OTHERDIR)/client.cc

# Build rules generated by macros from common.mk:

$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep))))
$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS))))
....
...

关于ffmpeg - 在 PPAPI : Naclports with FFmpeg 中使用 FFMPEG 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36466832/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com