2016-04-07 14 views
0

Ich habe Webports konfiguriert, ffmpeg; und ich habe das folgende Makefile für das aktuelle Projekt erstellt. Ich habe jedoch ein Problem mit der ffmpeg-Bibliotheksverknüpfung festgestellt.FFMPEG-Bibliothek in PPAPI verwenden: Naclports mit 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 

Können Sie mir sagen, was ich falsch hier tue, mein Makefile ist unten dargestellt:

VALID_TOOLCHAINS: = PNaCl glibc Klirren-newlib

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

TARGET = Client

OTHERDIR = src

INC_DIR = inc

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

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

umfassen $ (NACL_SDK_ROOT) /tools/common.mk

CHROME_ARGS + = --allow-NaCI-Socket-API = localhost

LIBS = nacl_io ppapi_cpp PPAPI

CFLAGS = -Wall -g -O2 $ (einschließlich) -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-Regeln, die von Makros aus common.mk generiert:

$

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

# Der PNaCl-Workflow verwendet eine nicht entfernte und finalisierte/entfernte Binärdatei. # Erzeugen Sie auf NaCl nur eine bereinigte Binärdatei für Release-Konfigurationen (nicht Debug). ifneq (, $ (oder $ (findstring pnacl, $ (TOOLCHAIN)), $ (string Release, $ (CONFIG)))) $ (eval $ (call LINK_RULE, $ (TARGET) _unstripped, $ (QUELLEN), $ (LIBS), $ (DEPS))) $ (eval $ (Aufruf STRIP_RULE, $ (TARGET), $ (TARGET) _unstripped)) sonst $ (eval $ (Call LINK_RULE, $ (TARGET), $ (QUELLEN), $ (LIBS), $ (DEPS))) endif

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

Und hier ist die Art und Weise, wie die Bibliothek gewesen im Klassenkontext verwendet.

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(); 
    } 
... 

Antwort

0

Ich habe dieses Problem gelöst, indem sie mit zusätzlichen Bibliotheken für FFMPEG Verknüpfung hinzufügen: VPX, Vorbis, lahm. Und es ist sehr wichtig, die Reihenfolge der verknüpften Bibliotheken beizubehalten.

..... 
... 
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)))) 
.... 
...