主题 : 关于ffmpeg到编译出错问题 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 101690
精华: 0
发帖: 11
金钱: 55 两
威望: 11 点
贡献值: 0 点
综合积分: 22 分
注册时间: 2014-03-15
最后登录: 2014-11-07
楼主  发表于: 2014-04-28 19:20

 关于ffmpeg到编译出错问题

准备移植ffmpeg到mini6410上,但是编译出错了,知道错误代码在哪里,但是不知道怎么该,求大神帮助
系统版本:ubuntu13.10
交叉编译环境:4.5.1
开发板:mini6410
ffmpeg版本:0.5.1
配置: ./configure --prefix=./_install --arch=arm --cross-prefix=arm-linux- --enable-shared

错误信息:
arm-linux-gcc -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I. -I"/opt/Works/ffmpeg-0.5.1" -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -fomit-frame-pointer -pthread -g -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -O3 -fno-math-errno -fno-signed-zeros        -c -o libavformat/matroskadec.o libavformat/matroskadec.c
libavformat/matroskadec.c: In function 'matroska_decode_buffer':
libavformat/matroskadec.c:895:9: error: 'z_stream' undeclared (first use in this function)
libavformat/matroskadec.c:895:9: note: each undeclared identifier is reported only once for each function it appears in
libavformat/matroskadec.c:895:18: error: expected ';' before 'zstream'
libavformat/matroskadec.c:896:9: warning: implicit declaration of function 'inflateInit'
libavformat/matroskadec.c:896:26: error: 'zstream' undeclared (first use in this function)
libavformat/matroskadec.c:896:38: error: 'Z_OK' undeclared (first use in this function)
libavformat/matroskadec.c:905:13: warning: implicit declaration of function 'inflate'
libavformat/matroskadec.c:905:40: error: 'Z_NO_FLUSH' undeclared (first use in this function)
libavformat/matroskadec.c:908:9: warning: implicit declaration of function 'inflateEnd'
libavformat/matroskadec.c:909:23: error: 'Z_STREAM_END' undeclared (first use in this function)
make: *** [libavformat/matroskadec.o] 错误 1

matroskadec.c代码从855开始到912
855 static MatroskaTrack *matroska_find_track_by_num(MatroskaDemuxContext *matr     oska,
 856                                                  int num)
 857 {
 858     MatroskaTrack *tracks = matroska->tracks.elem;
 859     int i;
 860
 861     for (i=0; i < matroska->tracks.nb_elem; i++)
 862         if (tracks.num == num)
 863             return &tracks;
 864
 865     av_log(matroska->ctx, AV_LOG_ERROR, "Invalid track number %d\n", num);
 866     return NULL;
 867 }
 868
 869 static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
 870                                   MatroskaTrack *track)
 871 {
 872     MatroskaTrackEncoding *encodings = track->encodings.elem;
 873     uint8_t* data = *buf;
 874     int isize = *buf_size;
 875     uint8_t* pkt_data = NULL;
 876     int pkt_size = isize;
 877     int result = 0;
 878     int olen;
 879
 880     switch (encodings[0].compression.algo) {
 881     case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP:
 882         return encodings[0].compression.settings.size;
 883     case MATROSKA_TRACK_ENCODING_COMP_LZO:
 884         do {
 885             olen = pkt_size *= 3;
 886             pkt_data = av_realloc(pkt_data, pkt_size+AV_LZO_OUTPUT_PADDING)     ;
 887             result = av_lzo1x_decode(pkt_data, &olen, data, &isize);
 888         } while (result==AV_LZO_OUTPUT_FULL && pkt_size<10000000);
 889         if (result)
 890             goto failed;
 891         pkt_size -= olen;
 892         break;
 893 #if CONFIG_ZLIB
 894     case MATROSKA_TRACK_ENCODING_COMP_ZLIB: {
 895         z_stream zstream = {0};
 896         if (inflateInit(&zstream) != Z_OK)
 897             return -1;
898         zstream.next_in = data;
 899         zstream.avail_in = isize;
 900         do {
 901             pkt_size *= 3;
 902             pkt_data = av_realloc(pkt_data, pkt_size);
 903             zstream.avail_out = pkt_size - zstream.total_out;
 904             zstream.next_out = pkt_data + zstream.total_out;
 905             result = inflate(&zstream, Z_NO_FLUSH);
 906         } while (result==Z_OK && pkt_size<10000000);
 907         pkt_size = zstream.total_out;
 908         inflateEnd(&zstream);
 909         if (result != Z_STREAM_END)
 910             goto failed;
 911         break;
 912     }

*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2014-04-28 21:11
 这些定义应该是包含在zlib.h里面的,在这个文件的42行有

复制代码
  1. #if CONFIG_ZLIB
  2. #include <zlib.h>
  3. #endif
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 101690
精华: 0
发帖: 11
金钱: 55 两
威望: 11 点
贡献值: 0 点
综合积分: 22 分
注册时间: 2014-03-15
最后登录: 2014-11-07
2楼  发表于: 2014-04-29 09:25
感谢版主大大的回答,等会儿去验证一下