2013-12-16 68 views
1

我試圖編譯PJSIP 2.1在Ubuntu視頻支持編譯PJSIP但在運行時「使」我得到以下錯誤:錯誤在Ubuntu

In file included from ../src/pjmedia/ffmpeg_util.c:26:0: 
../src/pjmedia/ffmpeg_util.h:50:12: warning: ‘enum CodecID’ declared inside parameter list [enabled by default] 
     enum CodecID *codec_id); 
      ^
../src/pjmedia/ffmpeg_util.h:50:12: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] 
../src/pjmedia/ffmpeg_util.h:53:7: warning: ‘enum CodecID’ declared inside parameter list [enabled by default] 
     pjmedia_format_id *fmt_id); 
    ^
../src/pjmedia/ffmpeg_util.c:65:18: error: field ‘codec_id’ has incomplete type 
    enum CodecID codec_id; 
       ^
../src/pjmedia/ffmpeg_util.c:167:13: error: conflicting types for ‘pjmedia_format_id_to_CodecID’ 
pj_status_t pjmedia_format_id_to_CodecID(pjmedia_format_id fmt_id, 
      ^
In file included from ../src/pjmedia/ffmpeg_util.c:26:0: 
../src/pjmedia/ffmpeg_util.h:49:13: note: previous declaration of ‘pjmedia_format_id_to_CodecID’ was here 
pj_status_t pjmedia_format_id_to_CodecID(pjmedia_format_id fmt_id, 
      ^
../src/pjmedia/ffmpeg_util.c: In function ‘pjmedia_format_id_to_CodecID’: 
../src/pjmedia/ffmpeg_util.c:173:35: warning: comparison between pointer and integer [enabled by default] 
    if (t->id==fmt_id && t->codec_id != PIX_FMT_NONE) { 
           ^
../src/pjmedia/ffmpeg_util.c:174:6: error: dereferencing pointer to incomplete type 
     *codec_id = t->codec_id; 
    ^
../src/pjmedia/ffmpeg_util.c:174:6: warning: statement with no effect [-Wunused-value] 
../src/pjmedia/ffmpeg_util.c:179:5: error: dereferencing pointer to incomplete type 
    *codec_id = PIX_FMT_NONE; 
    ^
../src/pjmedia/ffmpeg_util.c:179:5: warning: statement with no effect [-Wunused-value] 
../src/pjmedia/ffmpeg_util.c: At top level: 
../src/pjmedia/ffmpeg_util.c:183:55: error: parameter 1 (‘codec_id’) has incomplete type 
pj_status_t CodecID_to_pjmedia_format_id(enum CodecID codec_id, 
                ^
make[2]: *** [output/pjmedia-i686-pc-linux-gnu/ffmpeg_util.o] Error 1 
make[2]: Leaving directory `/home/gboutmy/Downloads/pjproject-2.1.0/pjmedia/build' 
make[1]: *** [pjmedia] Error 2 
make[1]: Leaving directory `/home/gboutmy/Downloads/pjproject-2.1.0/pjmedia/build' 
make: *** [all] Error 1 

我已經安裝了所需的依賴和不知道是什麼問題是。閱讀錯誤信息,它看起來像來自PJSIP代碼中的錯誤?

編輯:我根據Getting 「field has incomplete type」 and "conflicting types"改名enum CodecIDenum AVCodecID但現在我發現了以下錯誤:

../lib/libpjmedia-codec-i686-pc-linux-gnu.a(ffmpeg_vid_codecs.o): In function `ffmpeg_codec_encode_whole.isra.7': 
ffmpeg_vid_codecs.c:(.text+0x1374): undefined reference to `avcodec_encode_video2' 
collect2: error: ld returned 1 exit status 
make[2]: *** [../bin/pjmedia-test-i686-pc-linux-gnu] Error 1 
make[2]: Leaving directory `/home/gboutmy/Downloads/pjproject-2.1.0/pjmedia/build' 
make[1]: *** [pjmedia-test] Error 2 
make[1]: Leaving directory `/home/gboutmy/Downloads/pjproject-2.1.0/pjmedia/build' 
make: *** [all] Error 1 

回答

1

看來你錯過libavcodec/avcodec.h和,最有可能,也libavformat/avformat.h。這應該是因爲ffmpeg包含的文件夾不在gcc的目錄列表中查找頭文件。

從你的更新看來,pjsip正在構建一個更新的ffmpeg版本,該版本是Ubuntu存儲庫中的一個版本。正如你自己建造它,你可以配置pjsip運行使用您的版本:

./configure --with-ffmpeg=<YOUR_FFMPEG_FOLDER> 

#Copy all library ffmpeg library files into one folder 
CFLAGS="-I<YOUR_FFMPEG_FOLDER>" LDFLAGS="-L<YOUR_FFMPEG_LIB_FOLDER>" ./configure 
+0

這兩個文件不見了,但在安裝它們似乎並沒有解決問題。我仍然收到相同的錯誤信息。 我編譯了自己的ffmpeg,這可能與問題有關嗎? – noisegrrrl

+0

@Emualynk這是可能的,但從你上次更新,似乎你正在使用一個相當舊的版本,也許是1.x版本?我認爲'avcodec_encode_video2'是在2.X – jcm

+0

中引入的,我從網站上抓取了ffmpeg 2.1.1版本,但是:/ – noisegrrrl

0

答案原來的問題:

在編寫PJSIP我發現該CodecID枚舉已從ffmpeg棄用。但是它已被AV_CodecID取代,並且枚舉值也有一個前導AV_添加到它們。

因此在將CodecID更改爲AV_CodecID後,請更改ffmpeg_util.c中的枚舉。

例如,這是什麼樣的表看起來像變更後:

/* Conversion table between pjmedia_format_id and CodecID */ 
static const struct ffmpeg_codec_table_t 
{ 
    pjmedia_format_id id; 
    enum AVCodecID  codec_id; 
} ffmpeg_codec_table[] = 
{ 
    {PJMEDIA_FORMAT_H261,  AV_CODEC_ID_H261}, 
    {PJMEDIA_FORMAT_H263,  AV_CODEC_ID_H263}, 
    {PJMEDIA_FORMAT_H263P,  AV_CODEC_ID_H263P}, 
    {PJMEDIA_FORMAT_H264,  AV_CODEC_ID_H264}, 
    {PJMEDIA_FORMAT_MPEG1VIDEO, AV_CODEC_ID_MPEG1VIDEO}, 
    {PJMEDIA_FORMAT_MPEG2VIDEO, AV_CODEC_ID_MPEG2VIDEO}, 
    {PJMEDIA_FORMAT_MPEG4,  AV_CODEC_ID_MPEG4}, 
    {PJMEDIA_FORMAT_MJPEG,  AV_CODEC_ID_MJPEG} 
};