2016-04-07 92 views
0

我配置了Webports ffmpeg;並且爲當前項目創建了以下Makefile。但是,我遇到了ffmpeg庫鏈接的一些問題。在PPAPI中使用FFMPEG庫:使用FFmpeg的Naclports

$ 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鐺-newlib贏得

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

TARGET =客戶端

OTHERDIR = SRC

INC_DIR = INC

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

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

包括$(NACL_SDK_ROOT)/tools/common.mk

CHROME_ARGS + = --allow-NaCl的插座-API =本地主機

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

從common.mk由宏生成#生成規則:

$(SRC的foreach,$(源),$($的eval(呼叫 COMPILE_RULE,$(SRC),$(CFLAGS))))

012a

#PNaCl工作流程同時使用未剝離和已完成/已剝離的二進制文件。 #在NaCl上,只爲釋放配置(不是調試)生成一個剝離的二進制文件。 ifneq(,$(或$(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 $(叫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(); 
    } 
... 

回答

0

我已經解決了這個問題,爲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)))) 
.... 
...