在OpenBSD上编译了ffmpeg后,VIMP在转码的时候无法将mp4文件转换为m4v格式。手工执行同样的命令出现类似下面的错误: malformated aac bit stream , use -absf aac_adtstoasc av_interleaved_write_frame(): Operation not permitted 折腾了半天才发现,可能是OpenBSD 5.0的faac-2.18p2软件包的问题,将它卸载后重新编译faac软件后转码成功。 至此,VIMP2.2可以在OpenBSD 上运行了。 http://kdump.no-ip.org/
首先,建议使用openbsd 的package安装,而不是从源码编译,除非里面的mplayer确实不适用。 source file: http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc2.tar.bz2 编译之前,先下载:
1 |
http://www2.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2 |
1 |
然后解压至/usr/local/lib/codecs文件夹 |
1 |
configure选项: –codecsdir=/usr/local/lib/codecs –extra-cflags=-I/usr/local/include –extra-ldflags=-L/usr/local/lib gmake && gmake install #(gmake, not make) 如果出现: network.h:69: error: redefinition of ‘struct sockaddr_storage’ 编辑 libavformat/network.h文件,在文件前面添加: #define HAVE_STRUCT_SOCKADDR_STORAGE 1 在AMD64平台上,你可能会遇到下面的错误:
1 2 3 4 5 |
{standard input}: Assembler messages: {standard input}:18: Error: `ff_h264_lps_range(%eax,%esi,2)' is not a valid 64 bit base/index expression {standard input}:28: Error: `ff_h264_norm_shift(%esi)' is not a valid 64 bit base/index expression {standard input}:30: Error: `ff_h264_mlps_state+128(%eax)' is not a valid 64 bit base/index expression {standard input}:42: Error: `-1(%ebx)' is not a valid 64 bit base/index expression |
1 |
...... |
1 |
一个临时的解决方案是: |
1 |
在 libavcodec/h264.h顶部加入; |
1 |
#define HAVE_EBX_AVAILABLE 0 |
1 |
参考:<a href="http://web.archiveorange.com/archive/v/bFtHWRep6AGOQUhfzoHN">http://web.archiveorange.com/archive/v/bFtHWRep6AGOQUhfzoHN</a> |
…
由于要配合nginx使用php-fpm,于是自己编译php-5.3.8。 在make的时候出现如下错误: ext/iconv/iconv.c:615: undefined reference to `iconv’ google了一下,说是在make的时候要加上参数 EXTRA_CFLAGS=-liconv,或者是修改Makefile,但是依然不行。 最后,删除config.cache, 运行make clean,加上“–with-iconv=/usr/local”参数重新configure,然后make && make install 成功。 configure参数如下,仅供参考:
1 2 3 4 5 6 |
./configure' '--enable-fpm' '--with-fpm-user=_nginx' '--with-fpm-group=_nginx' \ '--enable-mbstring' '--with-mysqli' '--with-mysql' '--with-pdo-mysql' '--with--openssl' \ '--with-curl' '--with-xsl' '--enable-mbstring' '--with-zlib' '--with-bz2' '--with-mhash' \ '--with-mcrypt' '--with-iconv=/usr/local' 2011/11/29 更新:目前已经有php-fpm软件包,无需自己编译了。 |
cd /usr/src/ pkg_add -v ruby-1.8 ftp http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz tar xzf flvtool2-1.0.6.tgz cd flvtool2-1.0.6 ruby setup.rb config ruby setup.rb setup ruby setup.rb install cd ..
http://www.datadisk.co.uk/html_docs/veritas/veritas_cluster_cs.htm VCS uses two components, LLT and GAB to share data over the private networks among systems. These components provide the performance and reliability required by VCS. LLT LLT (Low Latency Transport) provides fast, kernel-to-kernel comms and monitors network connections….
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
http://www.bakercomputeranddata.com/doc/misc/veritas_vcs_llt_trblsht - Ensure that /etc/llthosts are the same on all nodes. If not fix, restart. (See 233032). - Ensure that /etc/llttab is the same except the "set-node" line. - Ensure that "eeprom local-mac-address?" is true. Later trouble shooting, and performance on switches require. - Compare the "/sbin/lltstat -nvv | more" from each node. Other than the astrisk showing where it was run, they should be identical. - Verify that each link sees only the links it should via dlpiping. (See 247259 above. Note; need to start server, then client for results.) (Note: irregardless of tag in /etc/llttab, links are numbered 0,.. ( by their order in the /etc/llttab.) - Check "/sbin/lltstat" on each node. Compare numbers and errors. - Compare /var/adm/messages on each node. LLT messages and missed heartbeats are expected if: - This or the other node have NIC hardware errors. - The other node rebooted, or cycled LLT for a Patch, for example. - If the systems, switch, or hub lost power. - Check ndd and/or /etc/system settings. They should be the same for each link on every node. (i.e. 100 Full mode on switch and NIC) - Check the number of missed heartbeats. - Negative or over 1000: - hub or switch is rebroadcasting old packets or has lost terminators. Extrememly rare. - Multiple links are sharing the same network broadcasts. Split links into different hubs, vlans, or setup a differnt SAP key. Check cabling, dlpiping to verify. - Hardware nic, port on hub or switch is switched. Recable or configure a new port on the switch or hub. - Less than 10 but possitive: - The other node could have started at nearly the same time Thus see above. - Possibly missed due to hardware failure or EM surge. Not critical unless there are many a day. If so, see above. - Test and/or replace cables, hub, and/or switch. Label them with Link#, attached Nodes, Cluster Ids, VLAN ID, port range/list. Make sure they are well seated. Put cables and network equipment in a secure location where other work in the area will not interfere. Tie down if possible. - Recable and re-configure /etc/llttab to use same nic type and number for same links. Restart llt (see above tnote.) Mixing different speed nic's can cause. - Verify that you have the latest drivers and patches for the NIC. Example /etc/llttab: # Get Node Number from /etc/llthosts set-node nodea # Can put different clusters on same vlan/hubs. # Just make sure their cluster id's are different. # All the members of the same cluster must have same clusterid. set-cluster 22 # link0 link hme12 /dev/hme:12 - ether - - # link1 link hme5 /dev/hme:5 - ether - - start Example using SAP: set-node 9 set-cluster 57 # SAP key is hex, 0123456789ABCDEF. Default is 0xCAFE link Link0 /dev/ce:0 - ether 0xFACE - link Link1 /dev/qfe:1 - ether 0x1212 - start ----------------------------------------------------------------------- What is the <LLT> warning level ? TechNote ID: 255168 Link: http://support.veritas.com/docs/255168 ------------------------------------------------------------------------ What do "Lost Heartbeat" messages mean? TechNote ID: 254862 VERITAS Cluster Server (VCS) uses a heartbeat mechanism that is serialised, and the issue here is that the heartbeats are arriving out of sequence. The heartbeats are not being lost, VCS is just expecting them in a different order. In two node clusters, this is often seen if only one hub is used to connect the private networks. The hub gets flooded with LLT packets and invariably some packets arrive out of sequence. In this scenario, it is advisable to add a second hub which will make the implementation more robust by increasing the redundancy and it will also stop the lost hb messages. The goal when using switches is that the traffic from the two different cards never meet. In the example, the traffic from qfe2 is to never meet the traffic from qfe4, the way to achieve this is by using 2 VLANS to isolate the traffic. Below you can see the first vlan isolates all the qfe2 traffic and the second vlan isolates all the qfe4 traffic. ------------------------------------------------------------------------------ What do the "lost hb" messages mean? TechNote ID: 245878 The reason for these messages is as follows. VCS uses a heartbeat mechanism that is serialised, and the issue here is that the heartbeats are arriving out of sequence. The heartbeats are not being lost, VCS is just expecting them in a different order. In two node clusters this is often seen if only one hub is used to connect the private networks. The hub gets flooded with LLT packets and invariably some packets arrive out of sequence. In this scenario it is advisable to add a second hub which will make the implementation more robust by increasing the redundancy and it will also stop the lost hb messages. These messages can also be noted sporadically when using switches to connect the private heartbeats. -------------------------------------------------------------------------------- Ways to prevent and reduce the effects of split-brain in VCS for UNIX TechNote ID: 252635 Link: http://support.veritas.com/docs/252635 Worse case schenario for LLT problems, and ways to fix LLT. -------------------------------------------------------------------------------- A VCS node may not rejoin the cluster after receiving an IOFence message. TechNote ID: 251079 Link: http://support.veritas.com/docs/251079 -------------------------------------------------------------------------------- I'm using a network switch for LLT for my VCS installation and it's not working. TechNote ID: 181388 Link: http://support.veritas.com/docs/181388 Ans: Must have eeprom local-mac-address? = true -------------------------------------------------------------------------------- How to use the "dlpiping" command to test VCS heartbeat interfaces TechNote ID: 247259 Link: http://support.veritas.com/docs/247259 Note: Must have eeprom local-mac-address? = true. -------------------------------------------------------------------------------- How to restart GAB and LLT without rebooting the system TechNote ID: 233032 Link: http://support.veritas.com/docs/233032 ------------------------------------------------------------------------------ Run Apparenet "SAS". Download from : http://www.apparentnetworks.com/veritas_sas/ NOTE: Nic's must be plumbed up to run Apparenet. Although, SAS is only built for Windows, Linux or Solaris, it can be run from any supported OS to any NIC/IP, irregardless of OS. --------------------------------------------------------------------- |
git clone git://git.videolan.org/ffmpeg.git
1 2 3 4 5 6 7 8 9 10 |
cd ffmpeg ./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc \ --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb \ --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis \ --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab (上面的参数需要预先安装相应的codec/Library。或者直接运行./configure) make make tools/qt-faststart |
cp -a tools/qt-faststart /usr/local/bin/
在OpenBSD 5.0-current上编译libfaac的时候出现如下问题 [root@cactus /usr/src/faac-1.28]# ./bootstrap Provide an AUTOMAKE_VERSION environment variable, please Provide an AUTOCONF_VERSION environment variable, please Provide an AUTOMAKE_VERSION environment variable, please Provide an AUTOCONF_VERSION environment variable, please 检查一下automake和autoconf的版本: [root@cactus /usr/src/faac-1.28]# pkg_info | grep auto autoconf-2.59p3 automatically configure…
我学习cat命令的源码及注释。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
/* $OpenBSD: cat.c,v 1.20 2009/10/27 23:59:19 deraadt Exp $ */ /* $NetBSD: cat.c,v 1.11 1995/09/07 06:12:54 jtc Exp $ */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Kevin Fall. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <sys/param.h> #include <sys/stat.h> #include #include #include #include #include #include #include #include #include extern char *__progname; /* 使用extern表示变量来自另外一个源文件 */ int bflag, eflag, nflag, sflag, tflag, vflag; int rval; char *filename; void cook_args(char *argv[]); void cook_buf(FILE *); void raw_args(char *argv[]); void raw_cat(int); int main(int argc, char *argv[]) { int ch; setlocale(LC_ALL, ""); /* setlocale为库中某些特定的例程(routines)设定自然语言的显示格式。 每种这样的显示格式称为一个locale * 用法:setlocale(int category, const char *locale); 其中第一个参数LC_ALL类(category)定义全部通用的显示格式; 其他的还有LC_COLLATE,LC_CTYPE,LC_MONETRAY等。 第二个参数为空“”,表示程序调用时所处的环境(native environment); 其他的还有“C”,“POSIX"。它们是默认的三种locale 如果参数中category和locale是一个没有意义的组合, setlocale()返回一个空指针(NULL) */ while ((ch = getopt(argc, argv, "benstuv")) != -1) /* getopt用于获取cat命令的参数,有效参数为benstuv中的一个或多个 */ switch (ch) { case 'b': /* 不计算空白行,且输出行号 */ bflag = nflag = 1; /* -b implies -n */ break; /* 跳出当前的switch循环 */ case 'e': /* 在行尾输出$字符,且显示非打印字符(=v)*/ eflag = vflag = 1; /* -e implies -v */ break; case 'n': /* 输出行号 */ nflag = 1; break; case 's': /* 合并多个相邻的空白行 */ sflag = 1; break; case 't': /* 将tab字符显示为^I,且显示非打印字符 */ tflag = vflag = 1; /* -t implies -v */ break; case 'u': /* 保证输出不被缓冲 */ setbuf(stdout, NULL); break; case 'v': /* 显示非打印字符 */ vflag = 1; break; default: (void)fprintf(stderr, "usage: %s [-benstuv] [file ...]\n", __progname); exit(1); /* NOTREACHED */ } argv += optind; /* optind 用于多次调用getopt;第一次从getopt返回后, optind含有指向下一个argv参数的索引 * optind初始化为1 * The variables "opterr" and "optind" are both initialized to 1. The optind * variable may be set to another value larger than 0 before a set of calls * to getopt() in order to skip over more or less argv entries. An optind * value of 0 is reserved for compatibility with GNU getopt(). */ if (bflag || eflag || nflag || sflag || tflag || vflag) cook_args(argv); /* 如果有参数就执行cook_args函数*/ else raw_args(argv); /* 如果没有参数就执行raw_args函数*/ if (fclose(stdout)) err(1, "stdout"); exit(rval); /* NOTREACHED */ } void cook_args(char **argv) { FILE *fp; fp = stdin; filename = "stdin"; /* starting a do...while loop ... */ do { if (*argv) { if (!strcmp(*argv, "-")) / * strcmp,如果两个字符相同则返回0 */ fp = stdin; else if ((fp = fopen(*argv, "r")) == NULL) { warn("%s", *argv); /* warn 用于在stderr上显示格式化的错误信息 */ rval = 1; ++argv; continue; /* 结束本次循环,即跳过循环体下面尚未执行的语句,接着进行下一次是否执行循环的判断, * (就是执行到continue时,立即结束本次循环,重新去判断循环条件是否为真) */ } filename = *argv++; } cook_buf(fp); if (fp == stdin) clearerr(fp); /* clearerr的作用是清楚fp的EOF和错误标志*/ else (void)fclose(fp); } while (*argv); } /* end of a do...while loop ... */ void cook_buf(FILE *fp) { int ch, gobble, line, prev; line = gobble = 0; for (prev = '\n'; (ch = getc(fp)) != EOF; prev = ch) { /* prev = '\n'; while (ch = getc(fp) != EOF) { ....;prev = ch;} */ if (prev == '\n') { /* 第一个IF */ if (sflag) { /* 第二个IF */ /* 如果设置sflag=1,表示多个相邻的空白行要合并成一个*/ if (ch == '\n') { if (gobble) continue; gobble = 1; } else /* else和离它最近的一个没有else的IF关键词结合,这里应该是if (ch == '\n'), 如果有大括号进行分段则以大括号为准 */ gobble = 0; } /* 第二个IF 结束*/ if (nflag && (!bflag || ch != '\n')) { /* nflag 控制是否显示行号, bflag也是要求显示行号,但不计算空白行 */ (void)fprintf(stdout, "%6d\t", ++line); /* fprintf中“%6d\t"这种格式是要将打印的变量至少占6个字符的宽度, 不够6个字符的情况下前面补上空格 */ if (ferror(stdout)) /* ferror函数测试文件流的错误指示标志(error indicator), 如果标志已经设置则返回非0值 */ break; } } /* 第一个IF 结束*/ if (ch == '\n') { if (eflag && putchar('$') == EOF) break; } else if (ch == '\t') { if (tflag) { if (putchar('^') == EOF || putchar('I') == EOF) break; continue; } } else if (vflag) { if (!isascii(ch)) { if (putchar('M') == EOF || putchar('-') == EOF) break; ch = toascii(ch); } if (iscntrl(ch)) { if (putchar('^') == EOF || putchar(ch == '\177' ? '?' : ch | 0100) == EOF) break; continue; } } if (putchar(ch) == EOF) break; } /* FOR循环结束 */ if (ferror(fp)) { warn("%s", filename); rval = 1; clearerr(fp); } if (ferror(stdout)) err(1, "stdout"); } void raw_args(char **argv) { int fd; fd = fileno(stdin); filename = "stdin"; do { if (*argv) { if (!strcmp(*argv, "-")) fd = fileno(stdin); else if ((fd = open(*argv, O_RDONLY, 0)) < 0) { warn("%s", *argv); rval = 1; ++argv; continue; } filename = *argv++; } raw_cat(fd); if (fd != fileno(stdin)) (void)close(fd); } while (*argv); } void raw_cat(int rfd) { int wfd; ssize_t nr, nw, off; static size_t bsize; static char *buf = NULL; struct stat sbuf; wfd = fileno(stdout); if (buf == NULL) { if (fstat(wfd, &sbuf)) err(1, "stdout"); bsize = MAX(sbuf.st_blksize, BUFSIZ); if ((buf = malloc(bsize)) == NULL) err(1, "malloc"); } while ((nr = read(rfd, buf, bsize)) != -1 && nr != 0) for (off = 0; nr; nr -= nw, off += nw) if ((nw = write(wfd, buf + off, (size_t)nr)) == 0 || nw == -1) err(1, "stdout"); if (nr < 0) { warn("%s", filename); rval = 1; } } |