Use AF_INET instead of htons(AF_INET) to initialize sin_family.
这个ffserver不是我编译的,貌似用arm-linux工具链可以直接编译,下回来试试,能不能再android上跑呢?
https://code.google.com/p/rxwen-blog-stuff/downloads/detail?name=ffserver&can=2&q= 人家的
http://rxwen.blogspot.com/ 人家博客
https://code.google.com/p/rmdmakefiles/source/browse/ 人家还有编译系统
G:\>adb push ffserver 192.168.1.108:5555/zhangbin/ error: more than one device and emulator G:\>adb push ffserver 192.168.1.108:5555 error: more than one device and emulator G:\>adb push ffserver /zhangbin/ error: more than one device and emulator G:\>adb push ffserver /sdcard error: more than one device and emulator G:\>adb push ffserver 192.168.1.108:5555 error: more than one device and emulator G:\>adb push ffserver 192.168.1.108:5555/ error: more than one device and emulator G:\>adb devices List of devices attached 0146A07E02014015 device 192.168.1.108:5555 device G:\>adb push ffserver 192.168.1.108:5555 error: more than one device and emulator G:\>adb devices List of devices attached 192.168.1.108:5555 device 到底应该怎么指定设备名呢???? G:\> adb push ffserver /zhangbin/ 2482 KB/s (9414756 bytes in 3.704s)
G:\>
root@android:/ # cd zhangbin root@android:/zhangbin # root@android:/zhangbin # root@android:/zhangbin # ls ffserver root@android:/zhangbin # ls -al -rw-rw-rw- root root 9414756 2013-08-23 17:42 ffserver root@android:/zhangbin # chmod 777 * root@android:/zhangbin # ls ffserver
还真可以跑ffserver root@android:/zhangbin # ./ffserver ffserver version 0.8, Copyright (c) 2000-2011 the FFmpeg developers built on Jun 23 2011 09:52:28 with gcc 4.5.2
这是编译参数 configuration: --arch=arm --cross-prefix=arm-none-linux-gnueabi- --extra-ldflags=-static --target-os=linux libavutil 51. 9. 1 / 51. 9. 1 libavcodec 53. 7. 0 / 53. 7. 0 libavformat 53. 4. 0 / 53. 4. 0 libavdevice 53. 1. 1 / 53. 1. 1 libavfilter 2. 23. 0 / 2. 23. 0 libswscale 2. 0. 0 / 2. 0. 0
/etc/ffserver.conf: No such file or directory 配置文件要指定,跑跑才行吧。 要不还是不确定ffserver到底是不是能在android上真的跑起来啊。 Incorrect config file - exiting.
1|root@android:/zhangbin #
root@android:/zhangbin # ./ffserver ffserver version 0.8, Copyright (c) 2000-2011 the FFmpeg developers built on Jun 23 2011 09:52:28 with gcc 4.5.2 configuration: --arch=arm --cross-prefix=arm-none-linux-gnueabi- --extra-ldflags=-static --target-os=linux libavutil 51. 9. 1 / 51. 9. 1 libavcodec 53. 7. 0 / 53. 7. 0 libavformat 53. 4. 0 / 53. 4. 0 libavdevice 53. 1. 1 / 53. 1. 1 libavfilter 2. 23. 0 / 2. 23. 0 libswscale 2. 0. 0 / 2. 0. 0 /etc/ffserver.conf: No such file or directory Incorrect config file - exiting. 1|root@android:/zhangbin # ls ffserver ffserver.conf root@android:/zhangbin # ./ffserver -f ffserver.conf ffserver version 0.8, Copyright (c) 2000-2011 the FFmpeg developers built on Jun 23 2011 09:52:28 with gcc 4.5.2 configuration: --arch=arm --cross-prefix=arm-none-linux-gnueabi- --extra-ldflags=-static --target-os=linux libavutil 51. 9. 1 / 51. 9. 1 libavcodec 53. 7. 0 / 53. 7. 0 libavformat 53. 4. 0 / 53. 4. 0 libavdevice 53. 1. 1 / 53. 1. 1 libavfilter 2. 23. 0 / 2. 23. 0 libswscale 2. 0. 0 / 2. 0. 0 Fri Aug 23 10:50:51 2013 Opening file '/data/1.mp4' Fri Aug 23 10:50:51 2013 Opening file '/data/1.mp3' Fri Aug 23 10:50:51 2013 [mp3 @ 0x25face0]max_analyze_duration 5000000 reached at 5015510 bind(port 8090): Address family not supported by protocol Fri Aug 23 10:50:51 2013 Could not start server 1|root@android:/zhangbin #
http://stackoverflow.com/questions/8906904/ffserver-bindport-8090-address-family-not-supported-by-protocol
http://stackoverflow.com/questions/14860648/bind-address-family-not-supported-by-protocol
这个错误 bind(port 8090): Address family not supported by protocol
The address family should be AF_INET in case IPv4 or AF_INET6 in case IPv6. It seems that the sin_family member of the address struct is not assigned a valid value. Please check it.
这是ffserver的bug么????
http://ro-lookandfeel.blogspot.co.uk/2012/10/bind-address-family-not-supported-by.html
EDNESDAY, OCTOBER 31, 2012
#include #include #include #include int main() { int vnc_server; int port = 2008; struct sockaddr_in addr = { 0 }; addr.sin_family = htons( AF_INET ); addr.sin_port = htons( port ); if (-1 == (vnc_server = socket( AF_INET, SOCK_STREAM, 0 ))) perror( "socket" ); if (0 != bind( vnc_server, (struct sockaddr*) &addr, sizeof( addr ) )) perror( "bind" ); return 0; }