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

标签 ffmpeg rtsp google-nativeclient rtsp-client

我已经配置了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/

相关文章:

c++ - 如何知道代表一张图片的H.264流中NAL单元的数量

python - Python 3.5 中的 FFMPEG 命令实际上并不创建音频文件

ffmpeg:如何重复音频 "watermark"

FFMPEG 扫描和转换电影文件并删除原始文件 - 隐居

Gstreamer、rtspsrc 和负载类型

ffmpeg - 如何从 ffserver 流式传输音频

compiler-errors - native 客户端-如何使用GetTime?

c++ - 检查 google-nativeclient 文件系统中是否存在目录?

ffmpeg的php exec()不起作用

javascript - 检测 Chrome NaCl 是否可用