Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1529691
  • 博文数量: 290
  • 博客积分: 3468
  • 博客等级: 中校
  • 技术积分: 3461
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-28 22:21
文章分类

全部博文(290)

文章存档

2016年(13)

2015年(3)

2014年(42)

2013年(67)

2012年(90)

2011年(75)

分类: 嵌入式

2012-07-09 11:50:01

系统环境:ubuntu 10.04

1. 安装解码库(若是windows 平台,下载ffmpeg sdk即可)
# apt-get install libavcodec-dev libavformat-dev libavutil-dev libswscale-dev

2.编译
# gcc -Wall decode_h264.c -o decode  -lavcodec -lavformat  -lavutil -lswscale

若没有指定链连库则会出现如下错误提示:
/tmp/ccJYTdYT.o: In function `nextFrame':
ipcam.c:(.text+0x3d0): undefined reference to `avcodec_decode_video'
ipcam.c:(.text+0x490): undefined reference to `sws_getContext'
ipcam.c:(.text+0x4e0): undefined reference to `sws_scale'
/tmp/ccJYTdYT.o: In function `main':
ipcam.c:(.text+0x590): undefined reference to `avcodec_init'
ipcam.c:(.text+0x595): undefined reference to `avcodec_register_all'
ipcam.c:(.text+0x5a1): undefined reference to `avcodec_find_decoder'
ipcam.c:(.text+0x5be): undefined reference to `avcodec_alloc_context'
ipcam.c:(.text+0x5ed): undefined reference to `avcodec_open'
ipcam.c:(.text+0x600): undefined reference to `avcodec_alloc_frame'
ipcam.c:(.text+0x65c): undefined reference to `avcodec_alloc_frame'
ipcam.c:(.text+0x67d): undefined reference to `avpicture_get_size'
ipcam.c:(.text+0x68d): undefined reference to `av_malloc'
ipcam.c:(.text+0x6c1): undefined reference to `avpicture_fill'
ipcam.c:(.text+0x6f9): undefined reference to `avcodec_close'
ipcam.c:(.text+0x706): undefined reference to `av_free'
ipcam.c:(.text+0x713): undefined reference to `av_free'
collect2: ld returned 1 exit status

3.源代码

阅读(4436) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~