正在显示
34 个修改的文件
包含
242 行增加
和
150 行删除
| @@ -289,21 +289,21 @@ if [ $SRS_HTTP_PARSER = YES ]; then | @@ -289,21 +289,21 @@ if [ $SRS_HTTP_PARSER = YES ]; then | ||
| 289 | fi | 289 | fi |
| 290 | 290 | ||
| 291 | if [ $SRS_HTTP_PARSER = YES ]; then | 291 | if [ $SRS_HTTP_PARSER = YES ]; then |
| 292 | - echo "#define SRS_HTTP_PARSER" >> $SRS_AUTO_HEADERS_H | 292 | + echo "#define SRS_AUTO_HTTP_PARSER" >> $SRS_AUTO_HEADERS_H |
| 293 | else | 293 | else |
| 294 | - echo "#undef SRS_HTTP_PARSER" >> $SRS_AUTO_HEADERS_H | 294 | + echo "#undef SRS_AUTO_HTTP_PARSER" >> $SRS_AUTO_HEADERS_H |
| 295 | fi | 295 | fi |
| 296 | 296 | ||
| 297 | if [ $SRS_HTTP_SERVER = YES ]; then | 297 | if [ $SRS_HTTP_SERVER = YES ]; then |
| 298 | - echo "#define SRS_HTTP_SERVER" >> $SRS_AUTO_HEADERS_H | 298 | + echo "#define SRS_AUTO_HTTP_SERVER" >> $SRS_AUTO_HEADERS_H |
| 299 | else | 299 | else |
| 300 | - echo "#undef SRS_HTTP_SERVER" >> $SRS_AUTO_HEADERS_H | 300 | + echo "#undef SRS_AUTO_HTTP_SERVER" >> $SRS_AUTO_HEADERS_H |
| 301 | fi | 301 | fi |
| 302 | 302 | ||
| 303 | if [ $SRS_HTTP_API = YES ]; then | 303 | if [ $SRS_HTTP_API = YES ]; then |
| 304 | - echo "#define SRS_HTTP_API" >> $SRS_AUTO_HEADERS_H | 304 | + echo "#define SRS_AUTO_HTTP_API" >> $SRS_AUTO_HEADERS_H |
| 305 | else | 305 | else |
| 306 | - echo "#undef SRS_HTTP_API" >> $SRS_AUTO_HEADERS_H | 306 | + echo "#undef SRS_AUTO_HTTP_API" >> $SRS_AUTO_HEADERS_H |
| 307 | fi | 307 | fi |
| 308 | 308 | ||
| 309 | ##################################################################################### | 309 | ##################################################################################### |
| @@ -373,15 +373,21 @@ ln -sf `pwd`/research/api-server/static-dir/favicon.ico ${SRS_OBJS}/nginx/html/f | @@ -373,15 +373,21 @@ ln -sf `pwd`/research/api-server/static-dir/favicon.ico ${SRS_OBJS}/nginx/html/f | ||
| 373 | echo "nginx is ok" > ${SRS_OBJS}/nginx/html/nginx.html | 373 | echo "nginx is ok" > ${SRS_OBJS}/nginx/html/nginx.html |
| 374 | 374 | ||
| 375 | if [ $SRS_NGINX = YES ]; then | 375 | if [ $SRS_NGINX = YES ]; then |
| 376 | - echo "#define SRS_NGINX" >> $SRS_AUTO_HEADERS_H | 376 | + echo "#define SRS_AUTO_NGINX" >> $SRS_AUTO_HEADERS_H |
| 377 | else | 377 | else |
| 378 | - echo "#undef SRS_NGINX" >> $SRS_AUTO_HEADERS_H | 378 | + echo "#undef SRS_AUTO_NGINX" >> $SRS_AUTO_HEADERS_H |
| 379 | +fi | ||
| 380 | + | ||
| 381 | +if [ $SRS_DVR = YES ]; then | ||
| 382 | + echo "#define SRS_AUTO_DVR" >> $SRS_AUTO_HEADERS_H | ||
| 383 | +else | ||
| 384 | + echo "#undef SRS_AUTO_DVR" >> $SRS_AUTO_HEADERS_H | ||
| 379 | fi | 385 | fi |
| 380 | 386 | ||
| 381 | if [ $SRS_HLS = YES ]; then | 387 | if [ $SRS_HLS = YES ]; then |
| 382 | - echo "#define SRS_HLS" >> $SRS_AUTO_HEADERS_H | 388 | + echo "#define SRS_AUTO_HLS" >> $SRS_AUTO_HEADERS_H |
| 383 | else | 389 | else |
| 384 | - echo "#undef SRS_HLS" >> $SRS_AUTO_HEADERS_H | 390 | + echo "#undef SRS_AUTO_HLS" >> $SRS_AUTO_HEADERS_H |
| 385 | fi | 391 | fi |
| 386 | 392 | ||
| 387 | ##################################################################################### | 393 | ##################################################################################### |
| @@ -405,9 +411,9 @@ if [ $SRS_HTTP_CALLBACK = YES ]; then | @@ -405,9 +411,9 @@ if [ $SRS_HTTP_CALLBACK = YES ]; then | ||
| 405 | fi | 411 | fi |
| 406 | 412 | ||
| 407 | if [ $SRS_HTTP_CALLBACK = YES ]; then | 413 | if [ $SRS_HTTP_CALLBACK = YES ]; then |
| 408 | - echo "#define SRS_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H | 414 | + echo "#define SRS_AUTO_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H |
| 409 | else | 415 | else |
| 410 | - echo "#undef SRS_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H | 416 | + echo "#undef SRS_AUTO_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H |
| 411 | fi | 417 | fi |
| 412 | 418 | ||
| 413 | echo "link players to cherrypy static-dir" | 419 | echo "link players to cherrypy static-dir" |
| @@ -489,9 +495,9 @@ if [ $SRS_SSL = YES ]; then | @@ -489,9 +495,9 @@ if [ $SRS_SSL = YES ]; then | ||
| 489 | fi | 495 | fi |
| 490 | 496 | ||
| 491 | if [ $SRS_SSL = YES ]; then | 497 | if [ $SRS_SSL = YES ]; then |
| 492 | - echo "#define SRS_SSL" >> $SRS_AUTO_HEADERS_H | 498 | + echo "#define SRS_AUTO_SSL" >> $SRS_AUTO_HEADERS_H |
| 493 | else | 499 | else |
| 494 | - echo "#undef SRS_SSL" >> $SRS_AUTO_HEADERS_H | 500 | + echo "#undef SRS_AUTO_SSL" >> $SRS_AUTO_HEADERS_H |
| 495 | fi | 501 | fi |
| 496 | 502 | ||
| 497 | ##################################################################################### | 503 | ##################################################################################### |
| @@ -520,21 +526,21 @@ __SRS_FFMPEG_STUB=NO | @@ -520,21 +526,21 @@ __SRS_FFMPEG_STUB=NO | ||
| 520 | if [ $SRS_TRANSCODE = YES ]; then __SRS_FFMPEG_STUB=YES; fi | 526 | if [ $SRS_TRANSCODE = YES ]; then __SRS_FFMPEG_STUB=YES; fi |
| 521 | if [ $SRS_INGEST = YES ]; then __SRS_FFMPEG_STUB=YES; fi | 527 | if [ $SRS_INGEST = YES ]; then __SRS_FFMPEG_STUB=YES; fi |
| 522 | if [ $__SRS_FFMPEG_STUB = YES ]; then | 528 | if [ $__SRS_FFMPEG_STUB = YES ]; then |
| 523 | - echo "#define SRS_FFMPEG_STUB" >> $SRS_AUTO_HEADERS_H | 529 | + echo "#define SRS_AUTO_FFMPEG" >> $SRS_AUTO_HEADERS_H |
| 524 | else | 530 | else |
| 525 | - echo "#undef SRS_FFMPEG_STUB" >> $SRS_AUTO_HEADERS_H | 531 | + echo "#undef SRS_AUTO_FFMPEG" >> $SRS_AUTO_HEADERS_H |
| 526 | fi | 532 | fi |
| 527 | 533 | ||
| 528 | if [ $SRS_TRANSCODE = YES ]; then | 534 | if [ $SRS_TRANSCODE = YES ]; then |
| 529 | - echo "#define SRS_RTMP_TRANSCODE" >> $SRS_AUTO_HEADERS_H | 535 | + echo "#define SRS_AUTO_TRANSCODE" >> $SRS_AUTO_HEADERS_H |
| 530 | else | 536 | else |
| 531 | - echo "#undef SRS_RTMP_TRANSCODE" >> $SRS_AUTO_HEADERS_H | 537 | + echo "#undef SRS_AUTO_TRANSCODE" >> $SRS_AUTO_HEADERS_H |
| 532 | fi | 538 | fi |
| 533 | 539 | ||
| 534 | if [ $SRS_INGEST = YES ]; then | 540 | if [ $SRS_INGEST = YES ]; then |
| 535 | - echo "#define SRS_RTMP_INGEST" >> $SRS_AUTO_HEADERS_H | 541 | + echo "#define SRS_AUTO_INGEST" >> $SRS_AUTO_HEADERS_H |
| 536 | else | 542 | else |
| 537 | - echo "#undef SRS_RTMP_INGEST" >> $SRS_AUTO_HEADERS_H | 543 | + echo "#undef SRS_AUTO_INGEST" >> $SRS_AUTO_HEADERS_H |
| 538 | fi | 544 | fi |
| 539 | 545 | ||
| 540 | ##################################################################################### | 546 | ##################################################################################### |
| @@ -591,38 +597,38 @@ if [ $SRS_GPERF = YES ]; then | @@ -591,38 +597,38 @@ if [ $SRS_GPERF = YES ]; then | ||
| 591 | fi | 597 | fi |
| 592 | 598 | ||
| 593 | if [ $SRS_GPERF = YES ]; then | 599 | if [ $SRS_GPERF = YES ]; then |
| 594 | - echo "#define SRS_GPERF" >> $SRS_AUTO_HEADERS_H | 600 | + echo "#define SRS_AUTO_GPERF" >> $SRS_AUTO_HEADERS_H |
| 595 | else | 601 | else |
| 596 | - echo "#undef SRS_GPERF" >> $SRS_AUTO_HEADERS_H | 602 | + echo "#undef SRS_AUTO_GPERF" >> $SRS_AUTO_HEADERS_H |
| 597 | fi | 603 | fi |
| 598 | if [ $SRS_GPERF_MC = YES ]; then | 604 | if [ $SRS_GPERF_MC = YES ]; then |
| 599 | - echo "#define SRS_GPERF_MC" >> $SRS_AUTO_HEADERS_H | 605 | + echo "#define SRS_AUTO_GPERF_MC" >> $SRS_AUTO_HEADERS_H |
| 600 | else | 606 | else |
| 601 | - echo "#undef SRS_GPERF_MC" >> $SRS_AUTO_HEADERS_H | 607 | + echo "#undef SRS_AUTO_GPERF_MC" >> $SRS_AUTO_HEADERS_H |
| 602 | fi | 608 | fi |
| 603 | if [ $SRS_GPERF_MP = YES ]; then | 609 | if [ $SRS_GPERF_MP = YES ]; then |
| 604 | - echo "#define SRS_GPERF_MP" >> $SRS_AUTO_HEADERS_H | 610 | + echo "#define SRS_AUTO_GPERF_MP" >> $SRS_AUTO_HEADERS_H |
| 605 | else | 611 | else |
| 606 | - echo "#undef SRS_GPERF_MP" >> $SRS_AUTO_HEADERS_H | 612 | + echo "#undef SRS_AUTO_GPERF_MP" >> $SRS_AUTO_HEADERS_H |
| 607 | fi | 613 | fi |
| 608 | if [ $SRS_GPERF_CP = YES ]; then | 614 | if [ $SRS_GPERF_CP = YES ]; then |
| 609 | - echo "#define SRS_GPERF_CP" >> $SRS_AUTO_HEADERS_H | 615 | + echo "#define SRS_AUTO_GPERF_CP" >> $SRS_AUTO_HEADERS_H |
| 610 | else | 616 | else |
| 611 | - echo "#undef SRS_GPERF_CP" >> $SRS_AUTO_HEADERS_H | 617 | + echo "#undef SRS_AUTO_GPERF_CP" >> $SRS_AUTO_HEADERS_H |
| 612 | fi | 618 | fi |
| 613 | 619 | ||
| 614 | ##################################################################################### | 620 | ##################################################################################### |
| 615 | # for arm. | 621 | # for arm. |
| 616 | ##################################################################################### | 622 | ##################################################################################### |
| 617 | if [ $SRS_ARM_UBUNTU12 = YES ]; then | 623 | if [ $SRS_ARM_UBUNTU12 = YES ]; then |
| 618 | - echo "#define SRS_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H | 624 | + echo "#define SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H |
| 619 | else | 625 | else |
| 620 | - echo "#undef SRS_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H | 626 | + echo "#undef SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H |
| 621 | fi | 627 | fi |
| 622 | 628 | ||
| 623 | echo "" >> $SRS_AUTO_HEADERS_H | 629 | echo "" >> $SRS_AUTO_HEADERS_H |
| 624 | # prefix | 630 | # prefix |
| 625 | -echo "#define SRS_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H | 631 | +echo "#define SRS_AUTO_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H |
| 626 | 632 | ||
| 627 | echo "" >> $SRS_AUTO_HEADERS_H | 633 | echo "" >> $SRS_AUTO_HEADERS_H |
| 628 | 634 | ||
| @@ -634,7 +640,7 @@ if [ $OS_IS_CENTOS = YES ]; then | @@ -634,7 +640,7 @@ if [ $OS_IS_CENTOS = YES ]; then | ||
| 634 | else | 640 | else |
| 635 | SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk -F '\* ' '{print $2}'` | 641 | SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk -F '\* ' '{print $2}'` |
| 636 | fi | 642 | fi |
| 637 | -echo "#define SRS_CONSTRIBUTORS \"\\" >> $SRS_AUTO_HEADERS_H | 643 | +echo "#define SRS_AUTO_CONSTRIBUTORS \"\\" >> $SRS_AUTO_HEADERS_H |
| 638 | for CONTRIBUTOR in $SRS_CONSTRIBUTORS; do | 644 | for CONTRIBUTOR in $SRS_CONSTRIBUTORS; do |
| 639 | echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H | 645 | echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H |
| 640 | done | 646 | done |
| @@ -14,6 +14,7 @@ | @@ -14,6 +14,7 @@ | ||
| 14 | help=no | 14 | help=no |
| 15 | 15 | ||
| 16 | SRS_HLS=RESERVED | 16 | SRS_HLS=RESERVED |
| 17 | +SRS_DVR=RESERVED | ||
| 17 | SRS_NGINX=RESERVED | 18 | SRS_NGINX=RESERVED |
| 18 | SRS_SSL=RESERVED | 19 | SRS_SSL=RESERVED |
| 19 | SRS_FFMPEG_TOOL=RESERVED | 20 | SRS_FFMPEG_TOOL=RESERVED |
| @@ -74,6 +75,7 @@ do | @@ -74,6 +75,7 @@ do | ||
| 74 | 75 | ||
| 75 | --with-ssl) SRS_SSL=YES ;; | 76 | --with-ssl) SRS_SSL=YES ;; |
| 76 | --with-hls) SRS_HLS=YES ;; | 77 | --with-hls) SRS_HLS=YES ;; |
| 78 | + --with-dvr) SRS_DVR=YES ;; | ||
| 77 | --with-nginx) SRS_NGINX=YES ;; | 79 | --with-nginx) SRS_NGINX=YES ;; |
| 78 | --with-ffmpeg) SRS_FFMPEG_TOOL=YES ;; | 80 | --with-ffmpeg) SRS_FFMPEG_TOOL=YES ;; |
| 79 | --with-transcode) SRS_TRANSCODE=YES ;; | 81 | --with-transcode) SRS_TRANSCODE=YES ;; |
| @@ -94,6 +96,7 @@ do | @@ -94,6 +96,7 @@ do | ||
| 94 | 96 | ||
| 95 | --without-ssl) SRS_SSL=NO ;; | 97 | --without-ssl) SRS_SSL=NO ;; |
| 96 | --without-hls) SRS_HLS=NO ;; | 98 | --without-hls) SRS_HLS=NO ;; |
| 99 | + --without-dvr) SRS_DVR=NO ;; | ||
| 97 | --without-nginx) SRS_NGINX=NO ;; | 100 | --without-nginx) SRS_NGINX=NO ;; |
| 98 | --without-ffmpeg) SRS_FFMPEG_TOOL=NO ;; | 101 | --without-ffmpeg) SRS_FFMPEG_TOOL=NO ;; |
| 99 | --without-transcode) SRS_TRANSCODE=NO ;; | 102 | --without-transcode) SRS_TRANSCODE=NO ;; |
| @@ -142,6 +145,7 @@ if [ $SRS_INGEST = YES ]; then if [ $SRS_FFMPEG_TOOL = RESERVED ]; then SRS_FFMP | @@ -142,6 +145,7 @@ if [ $SRS_INGEST = YES ]; then if [ $SRS_FFMPEG_TOOL = RESERVED ]; then SRS_FFMP | ||
| 142 | # if arm specified, set some default to disabled. | 145 | # if arm specified, set some default to disabled. |
| 143 | if [ $SRS_ARM_UBUNTU12 = YES ]; then | 146 | if [ $SRS_ARM_UBUNTU12 = YES ]; then |
| 144 | if [ $SRS_HLS = RESERVED ]; then SRS_HLS=YES; fi | 147 | if [ $SRS_HLS = RESERVED ]; then SRS_HLS=YES; fi |
| 148 | + if [ $SRS_DVR = RESERVED ]; then SRS_DVR=YES; fi | ||
| 145 | SRS_NGINX=NO | 149 | SRS_NGINX=NO |
| 146 | if [ $SRS_SSL = RESERVED ]; then SRS_SSL=YES; fi | 150 | if [ $SRS_SSL = RESERVED ]; then SRS_SSL=YES; fi |
| 147 | SRS_FFMPEG_TOOL=NO | 151 | SRS_FFMPEG_TOOL=NO |
| @@ -167,6 +171,7 @@ if [ $SRS_ARM_UBUNTU12 = YES ]; then | @@ -167,6 +171,7 @@ if [ $SRS_ARM_UBUNTU12 = YES ]; then | ||
| 167 | SRS_STATIC=YES | 171 | SRS_STATIC=YES |
| 168 | else | 172 | else |
| 169 | if [ $SRS_HLS = RESERVED ]; then SRS_HLS=YES; fi | 173 | if [ $SRS_HLS = RESERVED ]; then SRS_HLS=YES; fi |
| 174 | + if [ $SRS_DVR = RESERVED ]; then SRS_DVR=YES; fi | ||
| 170 | if [ $SRS_NGINX = RESERVED ]; then SRS_NGINX=NO; fi | 175 | if [ $SRS_NGINX = RESERVED ]; then SRS_NGINX=NO; fi |
| 171 | if [ $SRS_SSL = RESERVED ]; then SRS_SSL=YES; fi | 176 | if [ $SRS_SSL = RESERVED ]; then SRS_SSL=YES; fi |
| 172 | if [ $SRS_FFMPEG_TOOL = RESERVED ]; then SRS_FFMPEG_TOOL=NO; fi | 177 | if [ $SRS_FFMPEG_TOOL = RESERVED ]; then SRS_FFMPEG_TOOL=NO; fi |
| @@ -194,6 +199,7 @@ fi | @@ -194,6 +199,7 @@ fi | ||
| 194 | # if dev specified, open features if possible. | 199 | # if dev specified, open features if possible. |
| 195 | if [ $SRS_DEV = YES ]; then | 200 | if [ $SRS_DEV = YES ]; then |
| 196 | SRS_HLS=YES | 201 | SRS_HLS=YES |
| 202 | + SRS_DVR=YES | ||
| 197 | SRS_NGINX=NO | 203 | SRS_NGINX=NO |
| 198 | SRS_SSL=YES | 204 | SRS_SSL=YES |
| 199 | SRS_FFMPEG_TOOL=YES | 205 | SRS_FFMPEG_TOOL=YES |
| @@ -220,6 +226,7 @@ fi | @@ -220,6 +226,7 @@ fi | ||
| 220 | # if raspberry-pi specified, open ssl/hls/static features | 226 | # if raspberry-pi specified, open ssl/hls/static features |
| 221 | if [ $SRS_PI = YES ]; then | 227 | if [ $SRS_PI = YES ]; then |
| 222 | SRS_HLS=YES | 228 | SRS_HLS=YES |
| 229 | + SRS_DVR=YES | ||
| 223 | SRS_NGINX=NO | 230 | SRS_NGINX=NO |
| 224 | SRS_SSL=YES | 231 | SRS_SSL=YES |
| 225 | SRS_FFMPEG_TOOL=NO | 232 | SRS_FFMPEG_TOOL=NO |
| @@ -264,6 +271,7 @@ if [ $help = yes ]; then | @@ -264,6 +271,7 @@ if [ $help = yes ]; then | ||
| 264 | --with-ssl enable rtmp complex handshake, requires openssl-devel installed. | 271 | --with-ssl enable rtmp complex handshake, requires openssl-devel installed. |
| 265 | to delivery h264 video and aac audio to flash player. | 272 | to delivery h264 video and aac audio to flash player. |
| 266 | --with-hls enable hls streaming, mux RTMP to m3u8/ts files. | 273 | --with-hls enable hls streaming, mux RTMP to m3u8/ts files. |
| 274 | + --with-dvr enable dvr, mux RTMP to flv files. | ||
| 267 | --with-nginx enable delivery HTTP stream with nginx. | 275 | --with-nginx enable delivery HTTP stream with nginx. |
| 268 | build nginx at: ./objs/nginx/sbin/nginx | 276 | build nginx at: ./objs/nginx/sbin/nginx |
| 269 | --with-http-callback enable http hooks, build cherrypy as demo api server. | 277 | --with-http-callback enable http hooks, build cherrypy as demo api server. |
| @@ -288,6 +296,7 @@ if [ $help = yes ]; then | @@ -288,6 +296,7 @@ if [ $help = yes ]; then | ||
| 288 | 296 | ||
| 289 | --without-ssl disable rtmp complex handshake. | 297 | --without-ssl disable rtmp complex handshake. |
| 290 | --without-hls disable hls, rtmp streaming only. | 298 | --without-hls disable hls, rtmp streaming only. |
| 299 | + --without-dvr disable dvr, donot support record RTMP stream to flv. | ||
| 291 | --without-nginx disable delivery HTTP stream with nginx. | 300 | --without-nginx disable delivery HTTP stream with nginx. |
| 292 | --without-http-callback disable http, http hooks callback. | 301 | --without-http-callback disable http, http hooks callback. |
| 293 | --without-http-server disable http server, use external server to delivery http stream. | 302 | --without-http-server disable http server, use external server to delivery http stream. |
| @@ -360,6 +369,7 @@ fi | @@ -360,6 +369,7 @@ fi | ||
| 360 | 369 | ||
| 361 | # check variable neccessary | 370 | # check variable neccessary |
| 362 | if [ $SRS_HLS = RESERVED ]; then echo "you must specifies the hls, see: ./configure --help"; __check_ok=NO; fi | 371 | if [ $SRS_HLS = RESERVED ]; then echo "you must specifies the hls, see: ./configure --help"; __check_ok=NO; fi |
| 372 | +if [ $SRS_DVR = RESERVED ]; then echo "you must specifies the dvr, see: ./configure --help"; __check_ok=NO; fi | ||
| 363 | if [ $SRS_NGINX = RESERVED ]; then echo "you must specifies the nginx, see: ./configure --help"; __check_ok=NO; fi | 373 | if [ $SRS_NGINX = RESERVED ]; then echo "you must specifies the nginx, see: ./configure --help"; __check_ok=NO; fi |
| 364 | if [ $SRS_SSL = RESERVED ]; then echo "you must specifies the ssl, see: ./configure --help"; __check_ok=NO; fi | 374 | if [ $SRS_SSL = RESERVED ]; then echo "you must specifies the ssl, see: ./configure --help"; __check_ok=NO; fi |
| 365 | if [ $SRS_FFMPEG_TOOL = RESERVED ]; then echo "you must specifies the ffmpeg, see: ./configure --help"; __check_ok=NO; fi | 375 | if [ $SRS_FFMPEG_TOOL = RESERVED ]; then echo "you must specifies the ffmpeg, see: ./configure --help"; __check_ok=NO; fi |
| @@ -386,6 +396,7 @@ SRS_CONFIGURE="" | @@ -386,6 +396,7 @@ SRS_CONFIGURE="" | ||
| 386 | if [ $SRS_DEV = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --dev"; fi | 396 | if [ $SRS_DEV = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --dev"; fi |
| 387 | if [ $SRS_PI = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --pi"; fi | 397 | if [ $SRS_PI = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --pi"; fi |
| 388 | if [ $SRS_HLS = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-hls"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-hls"; fi | 398 | if [ $SRS_HLS = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-hls"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-hls"; fi |
| 399 | +if [ $SRS_DVR = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-dvr"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-dvr"; fi | ||
| 389 | if [ $SRS_NGINX = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-nginx"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-nginx"; fi | 400 | if [ $SRS_NGINX = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-nginx"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-nginx"; fi |
| 390 | if [ $SRS_SSL = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-ssl"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-ssl"; fi | 401 | if [ $SRS_SSL = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-ssl"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-ssl"; fi |
| 391 | if [ $SRS_FFMPEG_TOOL = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-ffmpeg"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-ffmpeg"; fi | 402 | if [ $SRS_FFMPEG_TOOL = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-ffmpeg"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-ffmpeg"; fi |
| @@ -35,10 +35,10 @@ echo "#ifndef SRS_AUTO_HEADER_HPP" >> $SRS_AUTO_HEADERS_H | @@ -35,10 +35,10 @@ echo "#ifndef SRS_AUTO_HEADER_HPP" >> $SRS_AUTO_HEADERS_H | ||
| 35 | echo "#define SRS_AUTO_HEADER_HPP" >> $SRS_AUTO_HEADERS_H | 35 | echo "#define SRS_AUTO_HEADER_HPP" >> $SRS_AUTO_HEADERS_H |
| 36 | echo "" >> $SRS_AUTO_HEADERS_H | 36 | echo "" >> $SRS_AUTO_HEADERS_H |
| 37 | 37 | ||
| 38 | -echo "#define SRS_BUILD_TS \"`date +%s`\"" >> $SRS_AUTO_HEADERS_H | ||
| 39 | -echo "#define SRS_BUILD_DATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $SRS_AUTO_HEADERS_H | ||
| 40 | -echo "#define SRS_UNAME \"`uname -a`\"" >> $SRS_AUTO_HEADERS_H | ||
| 41 | -echo "#define SRS_CONFIGURE \"${SRS_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H | 38 | +echo "#define SRS_AUTO_BUILD_TS \"`date +%s`\"" >> $SRS_AUTO_HEADERS_H |
| 39 | +echo "#define SRS_AUTO_BUILD_DATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $SRS_AUTO_HEADERS_H | ||
| 40 | +echo "#define SRS_AUTO_UNAME \"`uname -a`\"" >> $SRS_AUTO_HEADERS_H | ||
| 41 | +echo "#define SRS_AUTO_CONFIGURE \"${SRS_AUTO_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H | ||
| 42 | 42 | ||
| 43 | # new empty line to auto headers file. | 43 | # new empty line to auto headers file. |
| 44 | echo "" >> $SRS_AUTO_HEADERS_H | 44 | echo "" >> $SRS_AUTO_HEADERS_H |
| @@ -54,7 +54,7 @@ if [[ -z $SrsArmAR ]]; then SrsArmAR="arm-linux-gnueabi-ar"; fi | @@ -54,7 +54,7 @@ if [[ -z $SrsArmAR ]]; then SrsArmAR="arm-linux-gnueabi-ar"; fi | ||
| 54 | if [[ -z $SrsArmLD ]]; then SrsArmLD="arm-linux-gnueabi-ld"; fi | 54 | if [[ -z $SrsArmLD ]]; then SrsArmLD="arm-linux-gnueabi-ld"; fi |
| 55 | if [[ -z $SrsArmRANDLIB ]]; then SrsArmRANDLIB="arm-linux-gnueabi-ranlib"; fi | 55 | if [[ -z $SrsArmRANDLIB ]]; then SrsArmRANDLIB="arm-linux-gnueabi-ranlib"; fi |
| 56 | echo "cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB" | 56 | echo "cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB" |
| 57 | -echo "#define SRS_ARM_TOOL_CHAIN \"cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB\"" >> $SRS_AUTO_HEADERS_H | 57 | +echo "#define SRS_AUTO_ARM_TOOL_CHAIN \"cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB\"" >> $SRS_AUTO_HEADERS_H |
| 58 | echo "" >> $SRS_AUTO_HEADERS_H | 58 | echo "" >> $SRS_AUTO_HEADERS_H |
| 59 | 59 | ||
| 60 | # apply user options. | 60 | # apply user options. |
| @@ -82,6 +82,7 @@ if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd ${SRS_OBJS}/utest; \$(MAKE) | @@ -82,6 +82,7 @@ if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd ${SRS_OBJS}/utest; \$(MAKE) | ||
| 82 | ##################################################################################### | 82 | ##################################################################################### |
| 83 | # colorful summary | 83 | # colorful summary |
| 84 | SrsHlsSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HLS = YES ]; then SrsHlsSummaryColor="\${GREEN}"; fi | 84 | SrsHlsSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HLS = YES ]; then SrsHlsSummaryColor="\${GREEN}"; fi |
| 85 | +SrsDvrSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_DVR = YES ]; then SrsDvrSummaryColor="\${GREEN}"; fi | ||
| 85 | SrsNginxSummaryColor="\${GREEN}{disabled} "; if [ $SRS_NGINX = YES ]; then SrsNginxSummaryColor="\${GREEN}"; fi | 86 | SrsNginxSummaryColor="\${GREEN}{disabled} "; if [ $SRS_NGINX = YES ]; then SrsNginxSummaryColor="\${GREEN}"; fi |
| 86 | SrsSslSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_SSL = YES ]; then SrsSslSummaryColor="\${GREEN}"; fi | 87 | SrsSslSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_SSL = YES ]; then SrsSslSummaryColor="\${GREEN}"; fi |
| 87 | SrsFfmpegSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_FFMPEG_TOOL = YES ]; then SrsFfmpegSummaryColor="\${GREEN}"; fi | 88 | SrsFfmpegSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_FFMPEG_TOOL = YES ]; then SrsFfmpegSummaryColor="\${GREEN}"; fi |
| @@ -149,6 +150,8 @@ echo -e " \${BLACK}+-------------------------------------------------------- | @@ -149,6 +150,8 @@ echo -e " \${BLACK}+-------------------------------------------------------- | ||
| 149 | echo -e " |\${GREEN}server: ./objs/srs -c conf/srs.conf, start the srs server\${BLACK}" | 150 | echo -e " |\${GREEN}server: ./objs/srs -c conf/srs.conf, start the srs server\${BLACK}" |
| 150 | echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS\${BLACK}" | 151 | echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS\${BLACK}" |
| 151 | echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts from rtmp stream\${BLACK}" | 152 | echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts from rtmp stream\${BLACK}" |
| 153 | +echo -e " | ${SrsDvrSummaryColor}dvr @see: https://github.com/winlinvip/simple-rtmp-server/wiki/DVR\${BLACK}" | ||
| 154 | +echo -e " | ${SrsDvrSummaryColor}dvr: record RTMP stream to flv files.\${BLACK}" | ||
| 152 | echo -e " | ${SrsNginxSummaryColor}nginx @see: https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS\${BLACK}" | 155 | echo -e " | ${SrsNginxSummaryColor}nginx @see: https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS\${BLACK}" |
| 153 | echo -e " | ${SrsNginxSummaryColor}nginx: delivery HLS stream by nginx\${BLACK}" | 156 | echo -e " | ${SrsNginxSummaryColor}nginx: delivery HLS stream by nginx\${BLACK}" |
| 154 | echo -e " | ${SrsSslSummaryColor}ssl @see: https://github.com/winlinvip/simple-rtmp-server/wiki/RTMPHandshake\${BLACK}" | 157 | echo -e " | ${SrsSslSummaryColor}ssl @see: https://github.com/winlinvip/simple-rtmp-server/wiki/RTMPHandshake\${BLACK}" |
| @@ -436,7 +439,7 @@ MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_socke | @@ -436,7 +439,7 @@ MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_socke | ||
| 436 | "srs_app_http" "srs_app_thread" "srs_app_bandwidth" "srs_app_st" "srs_app_log" | 439 | "srs_app_http" "srs_app_thread" "srs_app_bandwidth" "srs_app_st" "srs_app_log" |
| 437 | "srs_app_config" "srs_app_pithy_print" "srs_app_reload" "srs_app_http_api" | 440 | "srs_app_config" "srs_app_pithy_print" "srs_app_reload" "srs_app_http_api" |
| 438 | "srs_app_http_conn" "srs_app_http_hooks" "srs_app_json" "srs_app_ingest" | 441 | "srs_app_http_conn" "srs_app_http_hooks" "srs_app_json" "srs_app_ingest" |
| 439 | - "srs_app_ffmpeg" "srs_app_utility") | 442 | + "srs_app_ffmpeg" "srs_app_utility" "srs_app_flv") |
| 440 | APP_INCS="src/app"; MODULE_DIR=${APP_INCS} . auto/modules.sh | 443 | APP_INCS="src/app"; MODULE_DIR=${APP_INCS} . auto/modules.sh |
| 441 | APP_OBJS="${MODULE_OBJS[@]}" | 444 | APP_OBJS="${MODULE_OBJS[@]}" |
| 442 | # | 445 | # |
| @@ -504,7 +507,7 @@ mkdir -p ${SRS_OBJS}/logs | @@ -504,7 +507,7 @@ mkdir -p ${SRS_OBJS}/logs | ||
| 504 | # summary | 507 | # summary |
| 505 | echo "" | 508 | echo "" |
| 506 | echo "configure summary:" | 509 | echo "configure summary:" |
| 507 | -echo " ${SRS_CONFIGURE}" | 510 | +echo " ${SRS_AUTO_CONFIGURE}" |
| 508 | if [ $SRS_HLS = YES ]; then | 511 | if [ $SRS_HLS = YES ]; then |
| 509 | echo -e "${GREEN}HLS is enabled${BLACK}" | 512 | echo -e "${GREEN}HLS is enabled${BLACK}" |
| 510 | else | 513 | else |
| @@ -515,6 +518,11 @@ if [ $SRS_NGINX = YES ]; then | @@ -515,6 +518,11 @@ if [ $SRS_NGINX = YES ]; then | ||
| 515 | else | 518 | else |
| 516 | echo -e "${GREEN}note: Nginx http server is disabled${BLACK}" | 519 | echo -e "${GREEN}note: Nginx http server is disabled${BLACK}" |
| 517 | fi | 520 | fi |
| 521 | +if [ $SRS_DVR = YES ]; then | ||
| 522 | + echo -e "${GREEN}DVR is enabled${BLACK}" | ||
| 523 | +else | ||
| 524 | + echo -e "${YELLOW}warning: without DVR support${BLACK}" | ||
| 525 | +fi | ||
| 518 | if [ $SRS_SSL = YES ]; then | 526 | if [ $SRS_SSL = YES ]; then |
| 519 | echo -e "${GREEN}rtmp complex handshake is enabled${BLACK}" | 527 | echo -e "${GREEN}rtmp complex handshake is enabled${BLACK}" |
| 520 | else | 528 | else |
| @@ -1206,7 +1206,7 @@ void SrsConfig::print_help(char** argv) | @@ -1206,7 +1206,7 @@ void SrsConfig::print_help(char** argv) | ||
| 1206 | printf( | 1206 | printf( |
| 1207 | RTMP_SIG_SRS_NAME" "RTMP_SIG_SRS_VERSION" "RTMP_SIG_SRS_COPYRIGHT"\n" | 1207 | RTMP_SIG_SRS_NAME" "RTMP_SIG_SRS_VERSION" "RTMP_SIG_SRS_COPYRIGHT"\n" |
| 1208 | "Primary Authors: "RTMP_SIG_SRS_PRIMARY_AUTHROS"\n" | 1208 | "Primary Authors: "RTMP_SIG_SRS_PRIMARY_AUTHROS"\n" |
| 1209 | - "Build: "SRS_BUILD_DATE" Configuration:"SRS_CONFIGURE"\n" | 1209 | + "Build: "SRS_AUTO_BUILD_DATE" Configuration:"SRS_AUTO_CONFIGURE"\n" |
| 1210 | "Usage: %s [-h?vV] [[-t] -c <filename>]\n" | 1210 | "Usage: %s [-h?vV] [[-t] -c <filename>]\n" |
| 1211 | "\n" | 1211 | "\n" |
| 1212 | "Options:\n" | 1212 | "Options:\n" |
| @@ -2132,13 +2132,13 @@ string SrsConfig::get_ingest_input_type(SrsConfDirective* ingest) | @@ -2132,13 +2132,13 @@ string SrsConfig::get_ingest_input_type(SrsConfDirective* ingest) | ||
| 2132 | SrsConfDirective* conf = ingest->get("input"); | 2132 | SrsConfDirective* conf = ingest->get("input"); |
| 2133 | 2133 | ||
| 2134 | if (!conf) { | 2134 | if (!conf) { |
| 2135 | - return SRS_RTMP_INGEST_TYPE_FILE; | 2135 | + return SRS_AUTO_INGEST_TYPE_FILE; |
| 2136 | } | 2136 | } |
| 2137 | 2137 | ||
| 2138 | conf = conf->get("type"); | 2138 | conf = conf->get("type"); |
| 2139 | 2139 | ||
| 2140 | if (!conf) { | 2140 | if (!conf) { |
| 2141 | - return SRS_RTMP_INGEST_TYPE_FILE; | 2141 | + return SRS_AUTO_INGEST_TYPE_FILE; |
| 2142 | } | 2142 | } |
| 2143 | 2143 | ||
| 2144 | return conf->arg0(); | 2144 | return conf->arg0(); |
| @@ -70,8 +70,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -70,8 +70,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 70 | #define SRS_STAGE_INGESTER_INTERVAL_MS 2000 | 70 | #define SRS_STAGE_INGESTER_INTERVAL_MS 2000 |
| 71 | #define SRS_STAGE_HLS_INTERVAL_MS 2000 | 71 | #define SRS_STAGE_HLS_INTERVAL_MS 2000 |
| 72 | 72 | ||
| 73 | -#define SRS_RTMP_INGEST_TYPE_FILE "file" | ||
| 74 | -#define SRS_RTMP_INGEST_TYPE_STREAM "stream" | 73 | +#define SRS_AUTO_INGEST_TYPE_FILE "file" |
| 74 | +#define SRS_AUTO_INGEST_TYPE_STREAM "stream" | ||
| 75 | 75 | ||
| 76 | class SrsFileBuffer; | 76 | class SrsFileBuffer; |
| 77 | 77 |
| @@ -34,7 +34,7 @@ using namespace std; | @@ -34,7 +34,7 @@ using namespace std; | ||
| 34 | #include <srs_protocol_rtmp_stack.hpp> | 34 | #include <srs_protocol_rtmp_stack.hpp> |
| 35 | #include <srs_app_ffmpeg.hpp> | 35 | #include <srs_app_ffmpeg.hpp> |
| 36 | 36 | ||
| 37 | -#ifdef SRS_RTMP_TRANSCODE | 37 | +#ifdef SRS_AUTO_TRANSCODE |
| 38 | 38 | ||
| 39 | // when error, encoder sleep for a while and retry. | 39 | // when error, encoder sleep for a while and retry. |
| 40 | #define SRS_RTMP_ENCODER_SLEEP_US (int64_t)(3*1000*1000LL) | 40 | #define SRS_RTMP_ENCODER_SLEEP_US (int64_t)(3*1000*1000LL) |
| @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 29 | */ | 29 | */ |
| 30 | #include <srs_core.hpp> | 30 | #include <srs_core.hpp> |
| 31 | 31 | ||
| 32 | -#ifdef SRS_RTMP_TRANSCODE | 32 | +#ifdef SRS_AUTO_TRANSCODE |
| 33 | 33 | ||
| 34 | #include <string> | 34 | #include <string> |
| 35 | #include <vector> | 35 | #include <vector> |
| @@ -39,7 +39,7 @@ using namespace std; | @@ -39,7 +39,7 @@ using namespace std; | ||
| 39 | #include <srs_app_pithy_print.hpp> | 39 | #include <srs_app_pithy_print.hpp> |
| 40 | #include <srs_protocol_rtmp_stack.hpp> | 40 | #include <srs_protocol_rtmp_stack.hpp> |
| 41 | 41 | ||
| 42 | -#ifdef SRS_FFMPEG_STUB | 42 | +#ifdef SRS_AUTO_FFMPEG |
| 43 | 43 | ||
| 44 | #define SRS_RTMP_ENCODER_COPY "copy" | 44 | #define SRS_RTMP_ENCODER_COPY "copy" |
| 45 | #define SRS_RTMP_ENCODER_NO_VIDEO "vn" | 45 | #define SRS_RTMP_ENCODER_NO_VIDEO "vn" |
| @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 29 | */ | 29 | */ |
| 30 | #include <srs_core.hpp> | 30 | #include <srs_core.hpp> |
| 31 | 31 | ||
| 32 | -#ifdef SRS_FFMPEG_STUB | 32 | +#ifdef SRS_AUTO_FFMPEG |
| 33 | 33 | ||
| 34 | #include <string> | 34 | #include <string> |
| 35 | #include <vector> | 35 | #include <vector> |
trunk/src/app/srs_app_flv.cpp
0 → 100644
| 1 | +/* | ||
| 2 | +The MIT License (MIT) | ||
| 3 | + | ||
| 4 | +Copyright (c) 2013-2014 winlin | ||
| 5 | + | ||
| 6 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 7 | +this software and associated documentation files (the "Software"), to deal in | ||
| 8 | +the Software without restriction, including without limitation the rights to | ||
| 9 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| 10 | +the Software, and to permit persons to whom the Software is furnished to do so, | ||
| 11 | +subject to the following conditions: | ||
| 12 | + | ||
| 13 | +The above copyright notice and this permission notice shall be included in all | ||
| 14 | +copies or substantial portions of the Software. | ||
| 15 | + | ||
| 16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| 18 | +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| 19 | +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| 20 | +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 21 | +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 22 | +*/ | ||
| 23 | + | ||
| 24 | +#include <srs_app_flv.hpp> | ||
| 25 | + | ||
| 26 | +#ifdef SRS_AUTO_DVR | ||
| 27 | + | ||
| 28 | +#endif | ||
| 29 | + |
trunk/src/app/srs_app_flv.hpp
0 → 100644
| 1 | +/* | ||
| 2 | +The MIT License (MIT) | ||
| 3 | + | ||
| 4 | +Copyright (c) 2013-2014 winlin | ||
| 5 | + | ||
| 6 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 7 | +this software and associated documentation files (the "Software"), to deal in | ||
| 8 | +the Software without restriction, including without limitation the rights to | ||
| 9 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| 10 | +the Software, and to permit persons to whom the Software is furnished to do so, | ||
| 11 | +subject to the following conditions: | ||
| 12 | + | ||
| 13 | +The above copyright notice and this permission notice shall be included in all | ||
| 14 | +copies or substantial portions of the Software. | ||
| 15 | + | ||
| 16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| 18 | +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| 19 | +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| 20 | +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 21 | +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 22 | +*/ | ||
| 23 | + | ||
| 24 | +#ifndef SRS_APP_FLV_HPP | ||
| 25 | +#define SRS_APP_FLV_HPP | ||
| 26 | + | ||
| 27 | +/* | ||
| 28 | +#include <srs_app_flv.hpp> | ||
| 29 | +*/ | ||
| 30 | +#include <srs_core.hpp> | ||
| 31 | + | ||
| 32 | +#ifdef SRS_AUTO_DVR | ||
| 33 | + | ||
| 34 | +#endif | ||
| 35 | + | ||
| 36 | +#endif |
| @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 23 | 23 | ||
| 24 | #include <srs_app_hls.hpp> | 24 | #include <srs_app_hls.hpp> |
| 25 | 25 | ||
| 26 | -#ifdef SRS_HLS | 26 | +#ifdef SRS_AUTO_HLS |
| 27 | 27 | ||
| 28 | #include <sys/types.h> | 28 | #include <sys/types.h> |
| 29 | #include <sys/stat.h> | 29 | #include <sys/stat.h> |
| @@ -45,14 +45,14 @@ using namespace std; | @@ -45,14 +45,14 @@ using namespace std; | ||
| 45 | #include <srs_app_pithy_print.hpp> | 45 | #include <srs_app_pithy_print.hpp> |
| 46 | 46 | ||
| 47 | // max PES packets size to flush the video. | 47 | // max PES packets size to flush the video. |
| 48 | -#define SRS_HLS_AUDIO_CACHE_SIZE 1024 * 1024 | 48 | +#define SRS_AUTO_HLS_AUDIO_CACHE_SIZE 1024 * 1024 |
| 49 | 49 | ||
| 50 | // drop the segment when duration of ts too small. | 50 | // drop the segment when duration of ts too small. |
| 51 | -#define SRS_HLS_SEGMENT_MIN_DURATION_MS 100 | 51 | +#define SRS_AUTO_HLS_SEGMENT_MIN_DURATION_MS 100 |
| 52 | 52 | ||
| 53 | // @see: NGX_RTMP_HLS_DELAY, | 53 | // @see: NGX_RTMP_HLS_DELAY, |
| 54 | // 63000: 700ms, ts_tbn=90000 | 54 | // 63000: 700ms, ts_tbn=90000 |
| 55 | -#define SRS_HLS_DELAY 63000 | 55 | +#define SRS_AUTO_HLS_DELAY 63000 |
| 56 | 56 | ||
| 57 | // the mpegts header specifed the video/audio pid. | 57 | // the mpegts header specifed the video/audio pid. |
| 58 | #define TS_VIDEO_PID 256 | 58 | #define TS_VIDEO_PID 256 |
| @@ -199,7 +199,7 @@ public: | @@ -199,7 +199,7 @@ public: | ||
| 199 | p[-1] |= 0x20; // Both Adaption and Payload | 199 | p[-1] |= 0x20; // Both Adaption and Payload |
| 200 | *p++ = 7; // size | 200 | *p++ = 7; // size |
| 201 | *p++ = 0x50; // random access + PCR | 201 | *p++ = 0x50; // random access + PCR |
| 202 | - p = write_pcr(p, frame->dts - SRS_HLS_DELAY); | 202 | + p = write_pcr(p, frame->dts - SRS_AUTO_HLS_DELAY); |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | // PES header | 205 | // PES header |
| @@ -255,11 +255,11 @@ public: | @@ -255,11 +255,11 @@ public: | ||
| 255 | *p++ = header_size; | 255 | *p++ = header_size; |
| 256 | 256 | ||
| 257 | // pts; // 33bits | 257 | // pts; // 33bits |
| 258 | - p = write_pts(p, flags >> 6, frame->pts + SRS_HLS_DELAY); | 258 | + p = write_pts(p, flags >> 6, frame->pts + SRS_AUTO_HLS_DELAY); |
| 259 | 259 | ||
| 260 | // dts; // 33bits | 260 | // dts; // 33bits |
| 261 | if (frame->dts != frame->pts) { | 261 | if (frame->dts != frame->pts) { |
| 262 | - p = write_pts(p, 1, frame->dts + SRS_HLS_DELAY); | 262 | + p = write_pts(p, 1, frame->dts + SRS_AUTO_HLS_DELAY); |
| 263 | } | 263 | } |
| 264 | } | 264 | } |
| 265 | 265 | ||
| @@ -684,7 +684,7 @@ int SrsHlsMuxer::segment_close(string log_desc) | @@ -684,7 +684,7 @@ int SrsHlsMuxer::segment_close(string log_desc) | ||
| 684 | srs_assert(it == segments.end()); | 684 | srs_assert(it == segments.end()); |
| 685 | 685 | ||
| 686 | // valid, add to segments if segment duration is ok | 686 | // valid, add to segments if segment duration is ok |
| 687 | - if (current->duration * 1000 >= SRS_HLS_SEGMENT_MIN_DURATION_MS) { | 687 | + if (current->duration * 1000 >= SRS_AUTO_HLS_SEGMENT_MIN_DURATION_MS) { |
| 688 | segments.push_back(current); | 688 | segments.push_back(current); |
| 689 | 689 | ||
| 690 | srs_trace("%s reap ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64"", | 690 | srs_trace("%s reap ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64"", |
| @@ -1026,7 +1026,7 @@ int SrsHlsCache::write_audio(SrsCodec* codec, SrsHlsMuxer* muxer, int64_t pts, S | @@ -1026,7 +1026,7 @@ int SrsHlsCache::write_audio(SrsCodec* codec, SrsHlsMuxer* muxer, int64_t pts, S | ||
| 1026 | } | 1026 | } |
| 1027 | 1027 | ||
| 1028 | // flush if buffer exceed max size. | 1028 | // flush if buffer exceed max size. |
| 1029 | - if (ab->size > SRS_HLS_AUDIO_CACHE_SIZE) { | 1029 | + if (ab->size > SRS_AUTO_HLS_AUDIO_CACHE_SIZE) { |
| 1030 | if ((ret = muxer->flush_audio(af, ab)) != ERROR_SUCCESS) { | 1030 | if ((ret = muxer->flush_audio(af, ab)) != ERROR_SUCCESS) { |
| 1031 | return ret; | 1031 | return ret; |
| 1032 | } | 1032 | } |
| @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 29 | */ | 29 | */ |
| 30 | #include <srs_core.hpp> | 30 | #include <srs_core.hpp> |
| 31 | 31 | ||
| 32 | -#ifdef SRS_HLS | 32 | +#ifdef SRS_AUTO_HLS |
| 33 | 33 | ||
| 34 | #include <string> | 34 | #include <string> |
| 35 | #include <vector> | 35 | #include <vector> |
| @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 23 | 23 | ||
| 24 | #include <srs_app_http.hpp> | 24 | #include <srs_app_http.hpp> |
| 25 | 25 | ||
| 26 | -#ifdef SRS_HTTP_PARSER | 26 | +#ifdef SRS_AUTO_HTTP_PARSER |
| 27 | 27 | ||
| 28 | #include <stdlib.h> | 28 | #include <stdlib.h> |
| 29 | 29 |
| @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 29 | */ | 29 | */ |
| 30 | #include <srs_core.hpp> | 30 | #include <srs_core.hpp> |
| 31 | 31 | ||
| 32 | -#ifdef SRS_HTTP_PARSER | 32 | +#ifdef SRS_AUTO_HTTP_PARSER |
| 33 | 33 | ||
| 34 | #include <string> | 34 | #include <string> |
| 35 | #include <vector> | 35 | #include <vector> |
| @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 23 | 23 | ||
| 24 | #include <srs_app_http_api.hpp> | 24 | #include <srs_app_http_api.hpp> |
| 25 | 25 | ||
| 26 | -#ifdef SRS_HTTP_API | 26 | +#ifdef SRS_AUTO_HTTP_API |
| 27 | 27 | ||
| 28 | #include <sstream> | 28 | #include <sstream> |
| 29 | using namespace std; | 29 | using namespace std; |
| @@ -193,7 +193,7 @@ int SrsApiAuthors::do_process_request(SrsSocket* skt, SrsHttpMessage* req) | @@ -193,7 +193,7 @@ int SrsApiAuthors::do_process_request(SrsSocket* skt, SrsHttpMessage* req) | ||
| 193 | << JFIELD_ORG("data", JOBJECT_START) | 193 | << JFIELD_ORG("data", JOBJECT_START) |
| 194 | << JFIELD_STR("primary_authors", RTMP_SIG_SRS_PRIMARY_AUTHROS) << JFIELD_CONT | 194 | << JFIELD_STR("primary_authors", RTMP_SIG_SRS_PRIMARY_AUTHROS) << JFIELD_CONT |
| 195 | << JFIELD_STR("contributors_link", RTMP_SIG_SRS_CONTRIBUTORS_URL) << JFIELD_CONT | 195 | << JFIELD_STR("contributors_link", RTMP_SIG_SRS_CONTRIBUTORS_URL) << JFIELD_CONT |
| 196 | - << JFIELD_STR("contributors", SRS_CONSTRIBUTORS) | 196 | + << JFIELD_STR("contributors", SRS_AUTO_CONSTRIBUTORS) |
| 197 | << JOBJECT_END | 197 | << JOBJECT_END |
| 198 | << JOBJECT_END; | 198 | << JOBJECT_END; |
| 199 | 199 |
| @@ -30,7 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -30,7 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 30 | 30 | ||
| 31 | #include <srs_core.hpp> | 31 | #include <srs_core.hpp> |
| 32 | 32 | ||
| 33 | -#ifdef SRS_HTTP_API | 33 | +#ifdef SRS_AUTO_HTTP_API |
| 34 | 34 | ||
| 35 | class SrsSocket; | 35 | class SrsSocket; |
| 36 | class SrsHttpMessage; | 36 | class SrsHttpMessage; |
| @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 23 | 23 | ||
| 24 | #include <srs_app_http_conn.hpp> | 24 | #include <srs_app_http_conn.hpp> |
| 25 | 25 | ||
| 26 | -#ifdef SRS_HTTP_SERVER | 26 | +#ifdef SRS_AUTO_HTTP_SERVER |
| 27 | 27 | ||
| 28 | #include <sstream> | 28 | #include <sstream> |
| 29 | using namespace std; | 29 | using namespace std; |
| @@ -30,7 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -30,7 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 30 | 30 | ||
| 31 | #include <srs_core.hpp> | 31 | #include <srs_core.hpp> |
| 32 | 32 | ||
| 33 | -#ifdef SRS_HTTP_SERVER | 33 | +#ifdef SRS_AUTO_HTTP_SERVER |
| 34 | 34 | ||
| 35 | #include <srs_app_st.hpp> | 35 | #include <srs_app_st.hpp> |
| 36 | #include <srs_app_conn.hpp> | 36 | #include <srs_app_conn.hpp> |
| @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 23 | 23 | ||
| 24 | #include <srs_app_http_hooks.hpp> | 24 | #include <srs_app_http_hooks.hpp> |
| 25 | 25 | ||
| 26 | -#ifdef SRS_HTTP_CALLBACK | 26 | +#ifdef SRS_AUTO_HTTP_CALLBACK |
| 27 | 27 | ||
| 28 | #include <sstream> | 28 | #include <sstream> |
| 29 | using namespace std; | 29 | using namespace std; |
| @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 29 | */ | 29 | */ |
| 30 | #include <srs_core.hpp> | 30 | #include <srs_core.hpp> |
| 31 | 31 | ||
| 32 | -#ifdef SRS_HTTP_CALLBACK | 32 | +#ifdef SRS_AUTO_HTTP_CALLBACK |
| 33 | 33 | ||
| 34 | #include <http_parser.h> | 34 | #include <http_parser.h> |
| 35 | 35 |
| @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 23 | 23 | ||
| 24 | #include <srs_app_ingest.hpp> | 24 | #include <srs_app_ingest.hpp> |
| 25 | 25 | ||
| 26 | -#ifdef SRS_RTMP_INGEST | 26 | +#ifdef SRS_AUTO_INGEST |
| 27 | 27 | ||
| 28 | using namespace std; | 28 | using namespace std; |
| 29 | 29 | ||
| @@ -35,7 +35,7 @@ using namespace std; | @@ -35,7 +35,7 @@ using namespace std; | ||
| 35 | 35 | ||
| 36 | // when error, ingester sleep for a while and retry. | 36 | // when error, ingester sleep for a while and retry. |
| 37 | // ingest never sleep a long time, for we must start the stream ASAP. | 37 | // ingest never sleep a long time, for we must start the stream ASAP. |
| 38 | -#define SRS_RTMP_INGESTER_SLEEP_US (int64_t)(6*100*1000LL) | 38 | +#define SRS_AUTO_INGESTER_SLEEP_US (int64_t)(6*100*1000LL) |
| 39 | 39 | ||
| 40 | SrsIngesterFFMPEG::SrsIngesterFFMPEG(SrsFFMPEG* _ffmpeg, string _vhost, string _id) | 40 | SrsIngesterFFMPEG::SrsIngesterFFMPEG(SrsFFMPEG* _ffmpeg, string _vhost, string _id) |
| 41 | { | 41 | { |
| @@ -53,7 +53,7 @@ SrsIngester::SrsIngester() | @@ -53,7 +53,7 @@ SrsIngester::SrsIngester() | ||
| 53 | { | 53 | { |
| 54 | _srs_config->subscribe(this); | 54 | _srs_config->subscribe(this); |
| 55 | 55 | ||
| 56 | - pthread = new SrsThread(this, SRS_RTMP_INGESTER_SLEEP_US); | 56 | + pthread = new SrsThread(this, SRS_AUTO_INGESTER_SLEEP_US); |
| 57 | pithy_print = new SrsPithyPrint(SRS_STAGE_INGESTER); | 57 | pithy_print = new SrsPithyPrint(SRS_STAGE_INGESTER); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| @@ -187,7 +187,7 @@ int SrsIngester::cycle() | @@ -187,7 +187,7 @@ int SrsIngester::cycle() | ||
| 187 | 187 | ||
| 188 | // pithy print | 188 | // pithy print |
| 189 | ingester(); | 189 | ingester(); |
| 190 | - pithy_print->elapse(SRS_RTMP_INGESTER_SLEEP_US / 1000); | 190 | + pithy_print->elapse(SRS_AUTO_INGESTER_SLEEP_US / 1000); |
| 191 | 191 | ||
| 192 | return ret; | 192 | return ret; |
| 193 | } | 193 | } |
| @@ -282,7 +282,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S | @@ -282,7 +282,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S | ||
| 282 | return ret; | 282 | return ret; |
| 283 | } | 283 | } |
| 284 | 284 | ||
| 285 | - if (input_type == SRS_RTMP_INGEST_TYPE_FILE) { | 285 | + if (input_type == SRS_AUTO_INGEST_TYPE_FILE) { |
| 286 | std::string input_url = _srs_config->get_ingest_input_url(ingest); | 286 | std::string input_url = _srs_config->get_ingest_input_url(ingest); |
| 287 | if (input_url.empty()) { | 287 | if (input_url.empty()) { |
| 288 | ret = ERROR_ENCODER_NO_INPUT; | 288 | ret = ERROR_ENCODER_NO_INPUT; |
| @@ -296,7 +296,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S | @@ -296,7 +296,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S | ||
| 296 | if ((ret = ffmpeg->initialize(input_url, output, log_file)) != ERROR_SUCCESS) { | 296 | if ((ret = ffmpeg->initialize(input_url, output, log_file)) != ERROR_SUCCESS) { |
| 297 | return ret; | 297 | return ret; |
| 298 | } | 298 | } |
| 299 | - } else if (input_type == SRS_RTMP_INGEST_TYPE_STREAM) { | 299 | + } else if (input_type == SRS_AUTO_INGEST_TYPE_STREAM) { |
| 300 | std::string input_url = _srs_config->get_ingest_input_url(ingest); | 300 | std::string input_url = _srs_config->get_ingest_input_url(ingest); |
| 301 | if (input_url.empty()) { | 301 | if (input_url.empty()) { |
| 302 | ret = ERROR_ENCODER_NO_INPUT; | 302 | ret = ERROR_ENCODER_NO_INPUT; |
| @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 29 | */ | 29 | */ |
| 30 | #include <srs_core.hpp> | 30 | #include <srs_core.hpp> |
| 31 | 31 | ||
| 32 | -#ifdef SRS_RTMP_INGEST | 32 | +#ifdef SRS_AUTO_INGEST |
| 33 | 33 | ||
| 34 | #include <vector> | 34 | #include <vector> |
| 35 | 35 |
| @@ -68,7 +68,7 @@ SrsRtmpConn::SrsRtmpConn(SrsServer* srs_server, st_netfd_t client_stfd) | @@ -68,7 +68,7 @@ SrsRtmpConn::SrsRtmpConn(SrsServer* srs_server, st_netfd_t client_stfd) | ||
| 68 | skt = new SrsSocket(client_stfd); | 68 | skt = new SrsSocket(client_stfd); |
| 69 | rtmp = new SrsRtmpServer(skt); | 69 | rtmp = new SrsRtmpServer(skt); |
| 70 | refer = new SrsRefer(); | 70 | refer = new SrsRefer(); |
| 71 | -#ifdef SRS_HTTP_CALLBACK | 71 | +#ifdef SRS_AUTO_HTTP_CALLBACK |
| 72 | http_hooks = new SrsHttpHooks(); | 72 | http_hooks = new SrsHttpHooks(); |
| 73 | #endif | 73 | #endif |
| 74 | bandwidth = new SrsBandwidth(); | 74 | bandwidth = new SrsBandwidth(); |
| @@ -86,7 +86,7 @@ SrsRtmpConn::~SrsRtmpConn() | @@ -86,7 +86,7 @@ SrsRtmpConn::~SrsRtmpConn() | ||
| 86 | srs_freep(rtmp); | 86 | srs_freep(rtmp); |
| 87 | srs_freep(skt); | 87 | srs_freep(skt); |
| 88 | srs_freep(refer); | 88 | srs_freep(refer); |
| 89 | -#ifdef SRS_HTTP_CALLBACK | 89 | +#ifdef SRS_AUTO_HTTP_CALLBACK |
| 90 | srs_freep(http_hooks); | 90 | srs_freep(http_hooks); |
| 91 | #endif | 91 | #endif |
| 92 | srs_freep(bandwidth); | 92 | srs_freep(bandwidth); |
| @@ -727,7 +727,7 @@ int SrsRtmpConn::on_connect() | @@ -727,7 +727,7 @@ int SrsRtmpConn::on_connect() | ||
| 727 | { | 727 | { |
| 728 | int ret = ERROR_SUCCESS; | 728 | int ret = ERROR_SUCCESS; |
| 729 | 729 | ||
| 730 | -#ifdef SRS_HTTP_CALLBACK | 730 | +#ifdef SRS_AUTO_HTTP_CALLBACK |
| 731 | // HTTP: on_connect | 731 | // HTTP: on_connect |
| 732 | SrsConfDirective* on_connect = _srs_config->get_vhost_on_connect(req->vhost); | 732 | SrsConfDirective* on_connect = _srs_config->get_vhost_on_connect(req->vhost); |
| 733 | if (!on_connect) { | 733 | if (!on_connect) { |
| @@ -749,7 +749,7 @@ int SrsRtmpConn::on_connect() | @@ -749,7 +749,7 @@ int SrsRtmpConn::on_connect() | ||
| 749 | 749 | ||
| 750 | void SrsRtmpConn::on_close() | 750 | void SrsRtmpConn::on_close() |
| 751 | { | 751 | { |
| 752 | -#ifdef SRS_HTTP_CALLBACK | 752 | +#ifdef SRS_AUTO_HTTP_CALLBACK |
| 753 | // whatever the ret code, notify the api hooks. | 753 | // whatever the ret code, notify the api hooks. |
| 754 | // HTTP: on_close | 754 | // HTTP: on_close |
| 755 | SrsConfDirective* on_close = _srs_config->get_vhost_on_close(req->vhost); | 755 | SrsConfDirective* on_close = _srs_config->get_vhost_on_close(req->vhost); |
| @@ -769,7 +769,7 @@ int SrsRtmpConn::on_publish() | @@ -769,7 +769,7 @@ int SrsRtmpConn::on_publish() | ||
| 769 | { | 769 | { |
| 770 | int ret = ERROR_SUCCESS; | 770 | int ret = ERROR_SUCCESS; |
| 771 | 771 | ||
| 772 | -#ifdef SRS_HTTP_CALLBACK | 772 | +#ifdef SRS_AUTO_HTTP_CALLBACK |
| 773 | // HTTP: on_publish | 773 | // HTTP: on_publish |
| 774 | SrsConfDirective* on_publish = _srs_config->get_vhost_on_publish(req->vhost); | 774 | SrsConfDirective* on_publish = _srs_config->get_vhost_on_publish(req->vhost); |
| 775 | if (!on_publish) { | 775 | if (!on_publish) { |
| @@ -791,7 +791,7 @@ int SrsRtmpConn::on_publish() | @@ -791,7 +791,7 @@ int SrsRtmpConn::on_publish() | ||
| 791 | 791 | ||
| 792 | void SrsRtmpConn::on_unpublish() | 792 | void SrsRtmpConn::on_unpublish() |
| 793 | { | 793 | { |
| 794 | -#ifdef SRS_HTTP_CALLBACK | 794 | +#ifdef SRS_AUTO_HTTP_CALLBACK |
| 795 | // whatever the ret code, notify the api hooks. | 795 | // whatever the ret code, notify the api hooks. |
| 796 | // HTTP: on_unpublish | 796 | // HTTP: on_unpublish |
| 797 | SrsConfDirective* on_unpublish = _srs_config->get_vhost_on_unpublish(req->vhost); | 797 | SrsConfDirective* on_unpublish = _srs_config->get_vhost_on_unpublish(req->vhost); |
| @@ -811,7 +811,7 @@ int SrsRtmpConn::on_play() | @@ -811,7 +811,7 @@ int SrsRtmpConn::on_play() | ||
| 811 | { | 811 | { |
| 812 | int ret = ERROR_SUCCESS; | 812 | int ret = ERROR_SUCCESS; |
| 813 | 813 | ||
| 814 | -#ifdef SRS_HTTP_CALLBACK | 814 | +#ifdef SRS_AUTO_HTTP_CALLBACK |
| 815 | // HTTP: on_play | 815 | // HTTP: on_play |
| 816 | SrsConfDirective* on_play = _srs_config->get_vhost_on_play(req->vhost); | 816 | SrsConfDirective* on_play = _srs_config->get_vhost_on_play(req->vhost); |
| 817 | if (!on_play) { | 817 | if (!on_play) { |
| @@ -833,7 +833,7 @@ int SrsRtmpConn::on_play() | @@ -833,7 +833,7 @@ int SrsRtmpConn::on_play() | ||
| 833 | 833 | ||
| 834 | void SrsRtmpConn::on_stop() | 834 | void SrsRtmpConn::on_stop() |
| 835 | { | 835 | { |
| 836 | -#ifdef SRS_HTTP_CALLBACK | 836 | +#ifdef SRS_AUTO_HTTP_CALLBACK |
| 837 | // whatever the ret code, notify the api hooks. | 837 | // whatever the ret code, notify the api hooks. |
| 838 | // HTTP: on_stop | 838 | // HTTP: on_stop |
| 839 | SrsConfDirective* on_stop = _srs_config->get_vhost_on_stop(req->vhost); | 839 | SrsConfDirective* on_stop = _srs_config->get_vhost_on_stop(req->vhost); |
| @@ -42,7 +42,7 @@ class SrsRefer; | @@ -42,7 +42,7 @@ class SrsRefer; | ||
| 42 | class SrsConsumer; | 42 | class SrsConsumer; |
| 43 | class SrsCommonMessage; | 43 | class SrsCommonMessage; |
| 44 | class SrsSocket; | 44 | class SrsSocket; |
| 45 | -#ifdef SRS_HTTP_CALLBACK | 45 | +#ifdef SRS_AUTO_HTTP_CALLBACK |
| 46 | class SrsHttpHooks; | 46 | class SrsHttpHooks; |
| 47 | #endif | 47 | #endif |
| 48 | class SrsBandwidth; | 48 | class SrsBandwidth; |
| @@ -58,7 +58,7 @@ private: | @@ -58,7 +58,7 @@ private: | ||
| 58 | SrsSocket* skt; | 58 | SrsSocket* skt; |
| 59 | SrsRtmpServer* rtmp; | 59 | SrsRtmpServer* rtmp; |
| 60 | SrsRefer* refer; | 60 | SrsRefer* refer; |
| 61 | -#ifdef SRS_HTTP_CALLBACK | 61 | +#ifdef SRS_AUTO_HTTP_CALLBACK |
| 62 | SrsHttpHooks* http_hooks; | 62 | SrsHttpHooks* http_hooks; |
| 63 | #endif | 63 | #endif |
| 64 | SrsBandwidth* bandwidth; | 64 | SrsBandwidth* bandwidth; |
| @@ -41,7 +41,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -41,7 +41,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 41 | #include <srs_app_http_api.hpp> | 41 | #include <srs_app_http_api.hpp> |
| 42 | #include <srs_app_http_conn.hpp> | 42 | #include <srs_app_http_conn.hpp> |
| 43 | #include <srs_app_http.hpp> | 43 | #include <srs_app_http.hpp> |
| 44 | -#ifdef SRS_RTMP_INGEST | 44 | +#ifdef SRS_AUTO_INGEST |
| 45 | #include <srs_app_ingest.hpp> | 45 | #include <srs_app_ingest.hpp> |
| 46 | #endif | 46 | #endif |
| 47 | 47 | ||
| @@ -169,13 +169,13 @@ SrsServer::SrsServer() | @@ -169,13 +169,13 @@ SrsServer::SrsServer() | ||
| 169 | // donot new object in constructor, | 169 | // donot new object in constructor, |
| 170 | // for some global instance is not ready now, | 170 | // for some global instance is not ready now, |
| 171 | // new these objects in initialize instead. | 171 | // new these objects in initialize instead. |
| 172 | -#ifdef SRS_HTTP_API | 172 | +#ifdef SRS_AUTO_HTTP_API |
| 173 | http_api_handler = NULL; | 173 | http_api_handler = NULL; |
| 174 | #endif | 174 | #endif |
| 175 | -#ifdef SRS_HTTP_SERVER | 175 | +#ifdef SRS_AUTO_HTTP_SERVER |
| 176 | http_stream_handler = NULL; | 176 | http_stream_handler = NULL; |
| 177 | #endif | 177 | #endif |
| 178 | -#ifdef SRS_RTMP_INGEST | 178 | +#ifdef SRS_AUTO_INGEST |
| 179 | ingester = NULL; | 179 | ingester = NULL; |
| 180 | #endif | 180 | #endif |
| 181 | } | 181 | } |
| @@ -202,14 +202,14 @@ SrsServer::~SrsServer() | @@ -202,14 +202,14 @@ SrsServer::~SrsServer() | ||
| 202 | pid_fd = -1; | 202 | pid_fd = -1; |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | -#ifdef SRS_HTTP_API | 205 | +#ifdef SRS_AUTO_HTTP_API |
| 206 | srs_freep(http_api_handler); | 206 | srs_freep(http_api_handler); |
| 207 | #endif | 207 | #endif |
| 208 | 208 | ||
| 209 | -#ifdef SRS_HTTP_SERVER | 209 | +#ifdef SRS_AUTO_HTTP_SERVER |
| 210 | srs_freep(http_stream_handler); | 210 | srs_freep(http_stream_handler); |
| 211 | #endif | 211 | #endif |
| 212 | -#ifdef SRS_RTMP_INGEST | 212 | +#ifdef SRS_AUTO_INGEST |
| 213 | srs_freep(ingester); | 213 | srs_freep(ingester); |
| 214 | #endif | 214 | #endif |
| 215 | } | 215 | } |
| @@ -224,26 +224,26 @@ int SrsServer::initialize() | @@ -224,26 +224,26 @@ int SrsServer::initialize() | ||
| 224 | srs_assert(_srs_config); | 224 | srs_assert(_srs_config); |
| 225 | _srs_config->subscribe(this); | 225 | _srs_config->subscribe(this); |
| 226 | 226 | ||
| 227 | -#ifdef SRS_HTTP_API | 227 | +#ifdef SRS_AUTO_HTTP_API |
| 228 | srs_assert(!http_api_handler); | 228 | srs_assert(!http_api_handler); |
| 229 | http_api_handler = SrsHttpHandler::create_http_api(); | 229 | http_api_handler = SrsHttpHandler::create_http_api(); |
| 230 | #endif | 230 | #endif |
| 231 | -#ifdef SRS_HTTP_SERVER | 231 | +#ifdef SRS_AUTO_HTTP_SERVER |
| 232 | srs_assert(!http_stream_handler); | 232 | srs_assert(!http_stream_handler); |
| 233 | http_stream_handler = SrsHttpHandler::create_http_stream(); | 233 | http_stream_handler = SrsHttpHandler::create_http_stream(); |
| 234 | #endif | 234 | #endif |
| 235 | -#ifdef SRS_RTMP_INGEST | 235 | +#ifdef SRS_AUTO_INGEST |
| 236 | srs_assert(!ingester); | 236 | srs_assert(!ingester); |
| 237 | ingester = new SrsIngester(); | 237 | ingester = new SrsIngester(); |
| 238 | #endif | 238 | #endif |
| 239 | 239 | ||
| 240 | -#ifdef SRS_HTTP_API | 240 | +#ifdef SRS_AUTO_HTTP_API |
| 241 | if ((ret = http_api_handler->initialize()) != ERROR_SUCCESS) { | 241 | if ((ret = http_api_handler->initialize()) != ERROR_SUCCESS) { |
| 242 | return ret; | 242 | return ret; |
| 243 | } | 243 | } |
| 244 | #endif | 244 | #endif |
| 245 | 245 | ||
| 246 | -#ifdef SRS_HTTP_SERVER | 246 | +#ifdef SRS_AUTO_HTTP_SERVER |
| 247 | if ((ret = http_stream_handler->initialize()) != ERROR_SUCCESS) { | 247 | if ((ret = http_stream_handler->initialize()) != ERROR_SUCCESS) { |
| 248 | return ret; | 248 | return ret; |
| 249 | } | 249 | } |
| @@ -377,7 +377,7 @@ int SrsServer::ingest() | @@ -377,7 +377,7 @@ int SrsServer::ingest() | ||
| 377 | { | 377 | { |
| 378 | int ret = ERROR_SUCCESS; | 378 | int ret = ERROR_SUCCESS; |
| 379 | 379 | ||
| 380 | -#ifdef SRS_RTMP_INGEST | 380 | +#ifdef SRS_AUTO_INGEST |
| 381 | if ((ret = ingester->start()) != ERROR_SUCCESS) { | 381 | if ((ret = ingester->start()) != ERROR_SUCCESS) { |
| 382 | srs_error("start ingest streams failed. ret=%d", ret); | 382 | srs_error("start ingest streams failed. ret=%d", ret); |
| 383 | return ret; | 383 | return ret; |
| @@ -401,7 +401,7 @@ int SrsServer::cycle() | @@ -401,7 +401,7 @@ int SrsServer::cycle() | ||
| 401 | // if user interrupt the program, exit to check mem leak. | 401 | // if user interrupt the program, exit to check mem leak. |
| 402 | // but, if gperf, use reload to ensure main return normally, | 402 | // but, if gperf, use reload to ensure main return normally, |
| 403 | // because directly exit will cause core-dump. | 403 | // because directly exit will cause core-dump. |
| 404 | -#ifdef SRS_GPERF_MC | 404 | +#ifdef SRS_AUTO_GPERF_MC |
| 405 | if (signal_gmc_stop) { | 405 | if (signal_gmc_stop) { |
| 406 | break; | 406 | break; |
| 407 | } | 407 | } |
| @@ -419,7 +419,7 @@ int SrsServer::cycle() | @@ -419,7 +419,7 @@ int SrsServer::cycle() | ||
| 419 | } | 419 | } |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | -#ifdef SRS_RTMP_INGEST | 422 | +#ifdef SRS_AUTO_INGEST |
| 423 | ingester->stop(); | 423 | ingester->stop(); |
| 424 | #endif | 424 | #endif |
| 425 | 425 | ||
| @@ -449,7 +449,7 @@ void SrsServer::on_signal(int signo) | @@ -449,7 +449,7 @@ void SrsServer::on_signal(int signo) | ||
| 449 | } | 449 | } |
| 450 | 450 | ||
| 451 | if (signo == SIGINT) { | 451 | if (signo == SIGINT) { |
| 452 | -#ifdef SRS_GPERF_MC | 452 | +#ifdef SRS_AUTO_GPERF_MC |
| 453 | srs_trace("gmc is on, main cycle will terminate normally."); | 453 | srs_trace("gmc is on, main cycle will terminate normally."); |
| 454 | signal_gmc_stop = true; | 454 | signal_gmc_stop = true; |
| 455 | #else | 455 | #else |
| @@ -494,7 +494,7 @@ int SrsServer::listen_http_api() | @@ -494,7 +494,7 @@ int SrsServer::listen_http_api() | ||
| 494 | { | 494 | { |
| 495 | int ret = ERROR_SUCCESS; | 495 | int ret = ERROR_SUCCESS; |
| 496 | 496 | ||
| 497 | -#ifdef SRS_HTTP_API | 497 | +#ifdef SRS_AUTO_HTTP_API |
| 498 | close_listeners(SrsListenerHttpApi); | 498 | close_listeners(SrsListenerHttpApi); |
| 499 | if (_srs_config->get_http_api_enabled()) { | 499 | if (_srs_config->get_http_api_enabled()) { |
| 500 | SrsListener* listener = new SrsListener(this, SrsListenerHttpApi); | 500 | SrsListener* listener = new SrsListener(this, SrsListenerHttpApi); |
| @@ -515,7 +515,7 @@ int SrsServer::listen_http_stream() | @@ -515,7 +515,7 @@ int SrsServer::listen_http_stream() | ||
| 515 | { | 515 | { |
| 516 | int ret = ERROR_SUCCESS; | 516 | int ret = ERROR_SUCCESS; |
| 517 | 517 | ||
| 518 | -#ifdef SRS_HTTP_SERVER | 518 | +#ifdef SRS_AUTO_HTTP_SERVER |
| 519 | close_listeners(SrsListenerHttpStream); | 519 | close_listeners(SrsListenerHttpStream); |
| 520 | if (_srs_config->get_http_stream_enabled()) { | 520 | if (_srs_config->get_http_stream_enabled()) { |
| 521 | SrsListener* listener = new SrsListener(this, SrsListenerHttpStream); | 521 | SrsListener* listener = new SrsListener(this, SrsListenerHttpStream); |
| @@ -568,7 +568,7 @@ int SrsServer::accept_client(SrsListenerType type, st_netfd_t client_stfd) | @@ -568,7 +568,7 @@ int SrsServer::accept_client(SrsListenerType type, st_netfd_t client_stfd) | ||
| 568 | if (type == SrsListenerRtmpStream) { | 568 | if (type == SrsListenerRtmpStream) { |
| 569 | conn = new SrsRtmpConn(this, client_stfd); | 569 | conn = new SrsRtmpConn(this, client_stfd); |
| 570 | } else if (type == SrsListenerHttpApi) { | 570 | } else if (type == SrsListenerHttpApi) { |
| 571 | -#ifdef SRS_HTTP_API | 571 | +#ifdef SRS_AUTO_HTTP_API |
| 572 | conn = new SrsHttpApi(this, client_stfd, http_api_handler); | 572 | conn = new SrsHttpApi(this, client_stfd, http_api_handler); |
| 573 | #else | 573 | #else |
| 574 | srs_warn("close http client for server not support http-api"); | 574 | srs_warn("close http client for server not support http-api"); |
| @@ -576,7 +576,7 @@ int SrsServer::accept_client(SrsListenerType type, st_netfd_t client_stfd) | @@ -576,7 +576,7 @@ int SrsServer::accept_client(SrsListenerType type, st_netfd_t client_stfd) | ||
| 576 | return ret; | 576 | return ret; |
| 577 | #endif | 577 | #endif |
| 578 | } else if (type == SrsListenerHttpStream) { | 578 | } else if (type == SrsListenerHttpStream) { |
| 579 | -#ifdef SRS_HTTP_SERVER | 579 | +#ifdef SRS_AUTO_HTTP_SERVER |
| 580 | conn = new SrsHttpConn(this, client_stfd, http_stream_handler); | 580 | conn = new SrsHttpConn(this, client_stfd, http_stream_handler); |
| 581 | #else | 581 | #else |
| 582 | srs_warn("close http client for server not support http-server"); | 582 | srs_warn("close http client for server not support http-server"); |
| @@ -622,7 +622,7 @@ int SrsServer::on_reload_vhost_added(std::string vhost) | @@ -622,7 +622,7 @@ int SrsServer::on_reload_vhost_added(std::string vhost) | ||
| 622 | { | 622 | { |
| 623 | int ret = ERROR_SUCCESS; | 623 | int ret = ERROR_SUCCESS; |
| 624 | 624 | ||
| 625 | -#ifdef SRS_HTTP_SERVER | 625 | +#ifdef SRS_AUTO_HTTP_SERVER |
| 626 | if (!_srs_config->get_vhost_http_enabled(vhost)) { | 626 | if (!_srs_config->get_vhost_http_enabled(vhost)) { |
| 627 | return ret; | 627 | return ret; |
| 628 | } | 628 | } |
| @@ -639,7 +639,7 @@ int SrsServer::on_reload_vhost_removed(std::string vhost) | @@ -639,7 +639,7 @@ int SrsServer::on_reload_vhost_removed(std::string vhost) | ||
| 639 | { | 639 | { |
| 640 | int ret = ERROR_SUCCESS; | 640 | int ret = ERROR_SUCCESS; |
| 641 | 641 | ||
| 642 | -#ifdef SRS_HTTP_SERVER | 642 | +#ifdef SRS_AUTO_HTTP_SERVER |
| 643 | if ((ret = on_reload_vhost_http_updated()) != ERROR_SUCCESS) { | 643 | if ((ret = on_reload_vhost_http_updated()) != ERROR_SUCCESS) { |
| 644 | return ret; | 644 | return ret; |
| 645 | } | 645 | } |
| @@ -652,7 +652,7 @@ int SrsServer::on_reload_vhost_http_updated() | @@ -652,7 +652,7 @@ int SrsServer::on_reload_vhost_http_updated() | ||
| 652 | { | 652 | { |
| 653 | int ret = ERROR_SUCCESS; | 653 | int ret = ERROR_SUCCESS; |
| 654 | 654 | ||
| 655 | -#ifdef SRS_HTTP_SERVER | 655 | +#ifdef SRS_AUTO_HTTP_SERVER |
| 656 | srs_freep(http_stream_handler); | 656 | srs_freep(http_stream_handler); |
| 657 | http_stream_handler = SrsHttpHandler::create_http_stream(); | 657 | http_stream_handler = SrsHttpHandler::create_http_stream(); |
| 658 | 658 | ||
| @@ -668,7 +668,7 @@ int SrsServer::on_reload_http_api_enabled() | @@ -668,7 +668,7 @@ int SrsServer::on_reload_http_api_enabled() | ||
| 668 | { | 668 | { |
| 669 | int ret = ERROR_SUCCESS; | 669 | int ret = ERROR_SUCCESS; |
| 670 | 670 | ||
| 671 | -#ifdef SRS_HTTP_API | 671 | +#ifdef SRS_AUTO_HTTP_API |
| 672 | ret = listen_http_api(); | 672 | ret = listen_http_api(); |
| 673 | #endif | 673 | #endif |
| 674 | 674 | ||
| @@ -679,7 +679,7 @@ int SrsServer::on_reload_http_api_disabled() | @@ -679,7 +679,7 @@ int SrsServer::on_reload_http_api_disabled() | ||
| 679 | { | 679 | { |
| 680 | int ret = ERROR_SUCCESS; | 680 | int ret = ERROR_SUCCESS; |
| 681 | 681 | ||
| 682 | -#ifdef SRS_HTTP_API | 682 | +#ifdef SRS_AUTO_HTTP_API |
| 683 | close_listeners(SrsListenerHttpApi); | 683 | close_listeners(SrsListenerHttpApi); |
| 684 | #endif | 684 | #endif |
| 685 | 685 | ||
| @@ -690,7 +690,7 @@ int SrsServer::on_reload_http_stream_enabled() | @@ -690,7 +690,7 @@ int SrsServer::on_reload_http_stream_enabled() | ||
| 690 | { | 690 | { |
| 691 | int ret = ERROR_SUCCESS; | 691 | int ret = ERROR_SUCCESS; |
| 692 | 692 | ||
| 693 | -#ifdef SRS_HTTP_SERVER | 693 | +#ifdef SRS_AUTO_HTTP_SERVER |
| 694 | ret = listen_http_stream(); | 694 | ret = listen_http_stream(); |
| 695 | #endif | 695 | #endif |
| 696 | 696 | ||
| @@ -701,7 +701,7 @@ int SrsServer::on_reload_http_stream_disabled() | @@ -701,7 +701,7 @@ int SrsServer::on_reload_http_stream_disabled() | ||
| 701 | { | 701 | { |
| 702 | int ret = ERROR_SUCCESS; | 702 | int ret = ERROR_SUCCESS; |
| 703 | 703 | ||
| 704 | -#ifdef SRS_HTTP_SERVER | 704 | +#ifdef SRS_AUTO_HTTP_SERVER |
| 705 | close_listeners(SrsListenerHttpStream); | 705 | close_listeners(SrsListenerHttpStream); |
| 706 | #endif | 706 | #endif |
| 707 | 707 | ||
| @@ -712,7 +712,7 @@ int SrsServer::on_reload_http_stream_updated() | @@ -712,7 +712,7 @@ int SrsServer::on_reload_http_stream_updated() | ||
| 712 | { | 712 | { |
| 713 | int ret = ERROR_SUCCESS; | 713 | int ret = ERROR_SUCCESS; |
| 714 | 714 | ||
| 715 | -#ifdef SRS_HTTP_SERVER | 715 | +#ifdef SRS_AUTO_HTTP_SERVER |
| 716 | if ((ret = on_reload_http_stream_enabled()) != ERROR_SUCCESS) { | 716 | if ((ret = on_reload_http_stream_enabled()) != ERROR_SUCCESS) { |
| 717 | return ret; | 717 | return ret; |
| 718 | } | 718 | } |
| @@ -79,13 +79,13 @@ class SrsServer : public ISrsReloadHandler | @@ -79,13 +79,13 @@ class SrsServer : public ISrsReloadHandler | ||
| 79 | { | 79 | { |
| 80 | friend class SrsListener; | 80 | friend class SrsListener; |
| 81 | private: | 81 | private: |
| 82 | -#ifdef SRS_HTTP_API | 82 | +#ifdef SRS_AUTO_HTTP_API |
| 83 | SrsHttpHandler* http_api_handler; | 83 | SrsHttpHandler* http_api_handler; |
| 84 | #endif | 84 | #endif |
| 85 | -#ifdef SRS_HTTP_SERVER | 85 | +#ifdef SRS_AUTO_HTTP_SERVER |
| 86 | SrsHttpHandler* http_stream_handler; | 86 | SrsHttpHandler* http_stream_handler; |
| 87 | #endif | 87 | #endif |
| 88 | -#ifdef SRS_RTMP_INGEST | 88 | +#ifdef SRS_AUTO_INGEST |
| 89 | SrsIngester* ingester; | 89 | SrsIngester* ingester; |
| 90 | #endif | 90 | #endif |
| 91 | private: | 91 | private: |
| @@ -428,10 +428,10 @@ SrsSource::SrsSource(SrsRequest* _req) | @@ -428,10 +428,10 @@ SrsSource::SrsSource(SrsRequest* _req) | ||
| 428 | { | 428 | { |
| 429 | req = _req->copy(); | 429 | req = _req->copy(); |
| 430 | 430 | ||
| 431 | -#ifdef SRS_HLS | 431 | +#ifdef SRS_AUTO_HLS |
| 432 | hls = new SrsHls(this); | 432 | hls = new SrsHls(this); |
| 433 | #endif | 433 | #endif |
| 434 | -#ifdef SRS_RTMP_TRANSCODE | 434 | +#ifdef SRS_AUTO_TRANSCODE |
| 435 | encoder = new SrsEncoder(); | 435 | encoder = new SrsEncoder(); |
| 436 | #endif | 436 | #endif |
| 437 | 437 | ||
| @@ -474,10 +474,10 @@ SrsSource::~SrsSource() | @@ -474,10 +474,10 @@ SrsSource::~SrsSource() | ||
| 474 | 474 | ||
| 475 | srs_freep(gop_cache); | 475 | srs_freep(gop_cache); |
| 476 | 476 | ||
| 477 | -#ifdef SRS_HLS | 477 | +#ifdef SRS_AUTO_HLS |
| 478 | srs_freep(hls); | 478 | srs_freep(hls); |
| 479 | #endif | 479 | #endif |
| 480 | -#ifdef SRS_RTMP_TRANSCODE | 480 | +#ifdef SRS_AUTO_TRANSCODE |
| 481 | srs_freep(encoder); | 481 | srs_freep(encoder); |
| 482 | #endif | 482 | #endif |
| 483 | 483 | ||
| @@ -585,7 +585,7 @@ int SrsSource::on_reload_vhost_hls(string vhost) | @@ -585,7 +585,7 @@ int SrsSource::on_reload_vhost_hls(string vhost) | ||
| 585 | return ret; | 585 | return ret; |
| 586 | } | 586 | } |
| 587 | 587 | ||
| 588 | -#ifdef SRS_HLS | 588 | +#ifdef SRS_AUTO_HLS |
| 589 | hls->on_unpublish(); | 589 | hls->on_unpublish(); |
| 590 | if ((ret = hls->on_publish(req)) != ERROR_SUCCESS) { | 590 | if ((ret = hls->on_publish(req)) != ERROR_SUCCESS) { |
| 591 | srs_error("hls publish failed. ret=%d", ret); | 591 | srs_error("hls publish failed. ret=%d", ret); |
| @@ -605,7 +605,7 @@ int SrsSource::on_reload_vhost_transcode(string vhost) | @@ -605,7 +605,7 @@ int SrsSource::on_reload_vhost_transcode(string vhost) | ||
| 605 | return ret; | 605 | return ret; |
| 606 | } | 606 | } |
| 607 | 607 | ||
| 608 | -#ifdef SRS_RTMP_TRANSCODE | 608 | +#ifdef SRS_AUTO_TRANSCODE |
| 609 | encoder->on_unpublish(); | 609 | encoder->on_unpublish(); |
| 610 | if ((ret = encoder->on_publish(req)) != ERROR_SUCCESS) { | 610 | if ((ret = encoder->on_publish(req)) != ERROR_SUCCESS) { |
| 611 | srs_error("start encoder failed. ret=%d", ret); | 611 | srs_error("start encoder failed. ret=%d", ret); |
| @@ -643,7 +643,7 @@ int SrsSource::on_hls_start() | @@ -643,7 +643,7 @@ int SrsSource::on_hls_start() | ||
| 643 | { | 643 | { |
| 644 | int ret = ERROR_SUCCESS; | 644 | int ret = ERROR_SUCCESS; |
| 645 | 645 | ||
| 646 | -#ifdef SRS_HLS | 646 | +#ifdef SRS_AUTO_HLS |
| 647 | 647 | ||
| 648 | // feed the hls the metadata/sequence header, | 648 | // feed the hls the metadata/sequence header, |
| 649 | // when reload to enable the hls. | 649 | // when reload to enable the hls. |
| @@ -671,7 +671,7 @@ int SrsSource::on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata | @@ -671,7 +671,7 @@ int SrsSource::on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata | ||
| 671 | { | 671 | { |
| 672 | int ret = ERROR_SUCCESS; | 672 | int ret = ERROR_SUCCESS; |
| 673 | 673 | ||
| 674 | -#ifdef SRS_HLS | 674 | +#ifdef SRS_AUTO_HLS |
| 675 | if (metadata && (ret = hls->on_meta_data(metadata->metadata)) != ERROR_SUCCESS) { | 675 | if (metadata && (ret = hls->on_meta_data(metadata->metadata)) != ERROR_SUCCESS) { |
| 676 | srs_error("hls process onMetaData message failed. ret=%d", ret); | 676 | srs_error("hls process onMetaData message failed. ret=%d", ret); |
| 677 | return ret; | 677 | return ret; |
| @@ -760,7 +760,7 @@ int SrsSource::on_audio(SrsCommonMessage* audio) | @@ -760,7 +760,7 @@ int SrsSource::on_audio(SrsCommonMessage* audio) | ||
| 760 | } | 760 | } |
| 761 | srs_verbose("initialize shared ptr audio success."); | 761 | srs_verbose("initialize shared ptr audio success."); |
| 762 | 762 | ||
| 763 | -#ifdef SRS_HLS | 763 | +#ifdef SRS_AUTO_HLS |
| 764 | if ((ret = hls->on_audio(msg->copy())) != ERROR_SUCCESS) { | 764 | if ((ret = hls->on_audio(msg->copy())) != ERROR_SUCCESS) { |
| 765 | srs_warn("hls process audio message failed, ignore and disable hls. ret=%d", ret); | 765 | srs_warn("hls process audio message failed, ignore and disable hls. ret=%d", ret); |
| 766 | 766 | ||
| @@ -837,7 +837,7 @@ int SrsSource::on_video(SrsCommonMessage* video) | @@ -837,7 +837,7 @@ int SrsSource::on_video(SrsCommonMessage* video) | ||
| 837 | } | 837 | } |
| 838 | srs_verbose("initialize shared ptr video success."); | 838 | srs_verbose("initialize shared ptr video success."); |
| 839 | 839 | ||
| 840 | -#ifdef SRS_HLS | 840 | +#ifdef SRS_AUTO_HLS |
| 841 | if ((ret = hls->on_video(msg->copy())) != ERROR_SUCCESS) { | 841 | if ((ret = hls->on_video(msg->copy())) != ERROR_SUCCESS) { |
| 842 | srs_warn("hls process video message failed, ignore and disable hls. ret=%d", ret); | 842 | srs_warn("hls process video message failed, ignore and disable hls. ret=%d", ret); |
| 843 | 843 | ||
| @@ -919,14 +919,14 @@ int SrsSource::on_publish(SrsRequest* _req) | @@ -919,14 +919,14 @@ int SrsSource::on_publish(SrsRequest* _req) | ||
| 919 | return ret; | 919 | return ret; |
| 920 | } | 920 | } |
| 921 | 921 | ||
| 922 | -#ifdef SRS_RTMP_TRANSCODE | 922 | +#ifdef SRS_AUTO_TRANSCODE |
| 923 | if ((ret = encoder->on_publish(req)) != ERROR_SUCCESS) { | 923 | if ((ret = encoder->on_publish(req)) != ERROR_SUCCESS) { |
| 924 | srs_error("start encoder failed. ret=%d", ret); | 924 | srs_error("start encoder failed. ret=%d", ret); |
| 925 | return ret; | 925 | return ret; |
| 926 | } | 926 | } |
| 927 | #endif | 927 | #endif |
| 928 | 928 | ||
| 929 | -#ifdef SRS_HLS | 929 | +#ifdef SRS_AUTO_HLS |
| 930 | if ((ret = hls->on_publish(req)) != ERROR_SUCCESS) { | 930 | if ((ret = hls->on_publish(req)) != ERROR_SUCCESS) { |
| 931 | srs_error("start hls failed. ret=%d", ret); | 931 | srs_error("start hls failed. ret=%d", ret); |
| 932 | return ret; | 932 | return ret; |
| @@ -941,12 +941,12 @@ void SrsSource::on_unpublish() | @@ -941,12 +941,12 @@ void SrsSource::on_unpublish() | ||
| 941 | // destroy all forwarders | 941 | // destroy all forwarders |
| 942 | destroy_forwarders(); | 942 | destroy_forwarders(); |
| 943 | 943 | ||
| 944 | -#ifdef SRS_RTMP_TRANSCODE | 944 | +#ifdef SRS_AUTO_TRANSCODE |
| 945 | encoder->on_unpublish(); | 945 | encoder->on_unpublish(); |
| 946 | #endif | 946 | #endif |
| 947 | 947 | ||
| 948 | // TODO: HLS should continue previous sequence and stream. | 948 | // TODO: HLS should continue previous sequence and stream. |
| 949 | -#ifdef SRS_HLS | 949 | +#ifdef SRS_AUTO_HLS |
| 950 | hls->on_unpublish(); | 950 | hls->on_unpublish(); |
| 951 | #endif | 951 | #endif |
| 952 | 952 |
| @@ -43,10 +43,10 @@ class SrsOnMetaDataPacket; | @@ -43,10 +43,10 @@ class SrsOnMetaDataPacket; | ||
| 43 | class SrsSharedPtrMessage; | 43 | class SrsSharedPtrMessage; |
| 44 | class SrsForwarder; | 44 | class SrsForwarder; |
| 45 | class SrsRequest; | 45 | class SrsRequest; |
| 46 | -#ifdef SRS_HLS | 46 | +#ifdef SRS_AUTO_HLS |
| 47 | class SrsHls; | 47 | class SrsHls; |
| 48 | #endif | 48 | #endif |
| 49 | -#ifdef SRS_RTMP_TRANSCODE | 49 | +#ifdef SRS_AUTO_TRANSCODE |
| 50 | class SrsEncoder; | 50 | class SrsEncoder; |
| 51 | #endif | 51 | #endif |
| 52 | 52 | ||
| @@ -220,11 +220,11 @@ private: | @@ -220,11 +220,11 @@ private: | ||
| 220 | // to delivery stream to clients. | 220 | // to delivery stream to clients. |
| 221 | std::vector<SrsConsumer*> consumers; | 221 | std::vector<SrsConsumer*> consumers; |
| 222 | // hls handler. | 222 | // hls handler. |
| 223 | -#ifdef SRS_HLS | 223 | +#ifdef SRS_AUTO_HLS |
| 224 | SrsHls* hls; | 224 | SrsHls* hls; |
| 225 | #endif | 225 | #endif |
| 226 | // transcoding handler. | 226 | // transcoding handler. |
| 227 | -#ifdef SRS_RTMP_TRANSCODE | 227 | +#ifdef SRS_AUTO_TRANSCODE |
| 228 | SrsEncoder* encoder; | 228 | SrsEncoder* encoder; |
| 229 | #endif | 229 | #endif |
| 230 | // gop cache for client fast startup. | 230 | // gop cache for client fast startup. |
| @@ -181,7 +181,7 @@ int srs_simple_handshake(srs_rtmp_t rtmp) | @@ -181,7 +181,7 @@ int srs_simple_handshake(srs_rtmp_t rtmp) | ||
| 181 | 181 | ||
| 182 | int srs_complex_handshake(srs_rtmp_t rtmp) | 182 | int srs_complex_handshake(srs_rtmp_t rtmp) |
| 183 | { | 183 | { |
| 184 | -#ifndef SRS_SSL | 184 | +#ifndef SRS_AUTO_SSL |
| 185 | return ERROR_RTMP_HS_SSL_REQUIRE; | 185 | return ERROR_RTMP_HS_SSL_REQUIRE; |
| 186 | #endif | 186 | #endif |
| 187 | 187 | ||
| @@ -378,7 +378,7 @@ int srs_write_packet(srs_rtmp_t rtmp, int type, u_int32_t timestamp, char* data, | @@ -378,7 +378,7 @@ int srs_write_packet(srs_rtmp_t rtmp, int type, u_int32_t timestamp, char* data, | ||
| 378 | 378 | ||
| 379 | int srs_ssl_enabled() | 379 | int srs_ssl_enabled() |
| 380 | { | 380 | { |
| 381 | -#ifndef SRS_SSL | 381 | +#ifndef SRS_AUTO_SSL |
| 382 | return false; | 382 | return false; |
| 383 | #endif | 383 | #endif |
| 384 | return true; | 384 | return true; |
| @@ -29,10 +29,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -29,10 +29,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 29 | #include <sys/types.h> | 29 | #include <sys/types.h> |
| 30 | #include <sys/wait.h> | 30 | #include <sys/wait.h> |
| 31 | 31 | ||
| 32 | -#ifdef SRS_GPERF_MP | 32 | +#ifdef SRS_AUTO_GPERF_MP |
| 33 | #include <gperftools/heap-profiler.h> | 33 | #include <gperftools/heap-profiler.h> |
| 34 | #endif | 34 | #endif |
| 35 | -#ifdef SRS_GPERF_CP | 35 | +#ifdef SRS_AUTO_GPERF_CP |
| 36 | #include <gperftools/profiler.h> | 36 | #include <gperftools/profiler.h> |
| 37 | #endif | 37 | #endif |
| 38 | 38 | ||
| @@ -71,15 +71,15 @@ int main(int argc, char** argv) | @@ -71,15 +71,15 @@ int main(int argc, char** argv) | ||
| 71 | // TODO: support both little and big endian. | 71 | // TODO: support both little and big endian. |
| 72 | srs_assert(srs_is_little_endian()); | 72 | srs_assert(srs_is_little_endian()); |
| 73 | 73 | ||
| 74 | -#ifdef SRS_GPERF_MP | 74 | +#ifdef SRS_AUTO_GPERF_MP |
| 75 | HeapProfilerStart("gperf.srs.gmp"); | 75 | HeapProfilerStart("gperf.srs.gmp"); |
| 76 | #endif | 76 | #endif |
| 77 | -#ifdef SRS_GPERF_CP | 77 | +#ifdef SRS_AUTO_GPERF_CP |
| 78 | ProfilerStart("gperf.srs.gcp"); | 78 | ProfilerStart("gperf.srs.gcp"); |
| 79 | #endif | 79 | #endif |
| 80 | 80 | ||
| 81 | -#ifdef SRS_GPERF_MC | ||
| 82 | - #ifdef SRS_GPERF_MP | 81 | +#ifdef SRS_AUTO_GPERF_MC |
| 82 | + #ifdef SRS_AUTO_GPERF_MP | ||
| 83 | srs_error("option --with-gmc confict with --with-gmp, " | 83 | srs_error("option --with-gmc confict with --with-gmp, " |
| 84 | "@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\n" | 84 | "@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html\n" |
| 85 | "Note that since the heap-checker uses the heap-profiling framework internally, " | 85 | "Note that since the heap-checker uses the heap-profiling framework internally, " |
| @@ -100,11 +100,11 @@ int main(int argc, char** argv) | @@ -100,11 +100,11 @@ int main(int argc, char** argv) | ||
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | srs_trace("srs(simple-rtmp-server) "RTMP_SIG_SRS_VERSION); | 102 | srs_trace("srs(simple-rtmp-server) "RTMP_SIG_SRS_VERSION); |
| 103 | - srs_trace("uname: "SRS_UNAME); | ||
| 104 | - srs_trace("build: %s, %s", SRS_BUILD_DATE, srs_is_little_endian()? "little-endian":"big-endian"); | ||
| 105 | - srs_trace("configure: "SRS_CONFIGURE); | ||
| 106 | -#ifdef SRS_ARM_UBUNTU12 | ||
| 107 | - srs_trace("arm tool chain: "SRS_ARM_TOOL_CHAIN); | 103 | + srs_trace("uname: "SRS_AUTO_UNAME); |
| 104 | + srs_trace("build: %s, %s", SRS_AUTO_BUILD_DATE, srs_is_little_endian()? "little-endian":"big-endian"); | ||
| 105 | + srs_trace("configure: "SRS_AUTO_CONFIGURE); | ||
| 106 | +#ifdef SRS_AUTO_ARM_UBUNTU12 | ||
| 107 | + srs_trace("arm tool chain: "SRS_AUTO_ARM_TOOL_CHAIN); | ||
| 108 | #endif | 108 | #endif |
| 109 | 109 | ||
| 110 | if ((ret = _srs_server->initialize()) != ERROR_SUCCESS) { | 110 | if ((ret = _srs_server->initialize()) != ERROR_SUCCESS) { |
| @@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 32 | #include <srs_protocol_utility.hpp> | 32 | #include <srs_protocol_utility.hpp> |
| 33 | #include <srs_protocol_rtmp.hpp> | 33 | #include <srs_protocol_rtmp.hpp> |
| 34 | 34 | ||
| 35 | -#ifdef SRS_SSL | 35 | +#ifdef SRS_AUTO_SSL |
| 36 | 36 | ||
| 37 | using namespace srs; | 37 | using namespace srs; |
| 38 | 38 | ||
| @@ -1070,7 +1070,7 @@ SrsComplexHandshake::~SrsComplexHandshake() | @@ -1070,7 +1070,7 @@ SrsComplexHandshake::~SrsComplexHandshake() | ||
| 1070 | { | 1070 | { |
| 1071 | } | 1071 | } |
| 1072 | 1072 | ||
| 1073 | -#ifndef SRS_SSL | 1073 | +#ifndef SRS_AUTO_SSL |
| 1074 | int SrsComplexHandshake::handshake_with_client(SrsHandshakeBytes* /*hs_bytes*/, ISrsProtocolReaderWriter* /*io*/) | 1074 | int SrsComplexHandshake::handshake_with_client(SrsHandshakeBytes* /*hs_bytes*/, ISrsProtocolReaderWriter* /*io*/) |
| 1075 | { | 1075 | { |
| 1076 | srs_trace("directly use simple handshake for ssl disabled."); | 1076 | srs_trace("directly use simple handshake for ssl disabled."); |
| @@ -1169,7 +1169,7 @@ int SrsComplexHandshake::handshake_with_client(SrsHandshakeBytes* hs_bytes, ISrs | @@ -1169,7 +1169,7 @@ int SrsComplexHandshake::handshake_with_client(SrsHandshakeBytes* hs_bytes, ISrs | ||
| 1169 | } | 1169 | } |
| 1170 | #endif | 1170 | #endif |
| 1171 | 1171 | ||
| 1172 | -#ifndef SRS_SSL | 1172 | +#ifndef SRS_AUTO_SSL |
| 1173 | int SrsComplexHandshake::handshake_with_server(SrsHandshakeBytes* /*hs_bytes*/, ISrsProtocolReaderWriter* /*io*/) | 1173 | int SrsComplexHandshake::handshake_with_server(SrsHandshakeBytes* /*hs_bytes*/, ISrsProtocolReaderWriter* /*io*/) |
| 1174 | { | 1174 | { |
| 1175 | return ERROR_RTMP_TRY_SIMPLE_HS; | 1175 | return ERROR_RTMP_TRY_SIMPLE_HS; |
| @@ -34,7 +34,7 @@ class ISrsProtocolReaderWriter; | @@ -34,7 +34,7 @@ class ISrsProtocolReaderWriter; | ||
| 34 | class SrsComplexHandshake; | 34 | class SrsComplexHandshake; |
| 35 | class SrsHandshakeBytes; | 35 | class SrsHandshakeBytes; |
| 36 | 36 | ||
| 37 | -#ifdef SRS_SSL | 37 | +#ifdef SRS_AUTO_SSL |
| 38 | 38 | ||
| 39 | namespace srs | 39 | namespace srs |
| 40 | { | 40 | { |
| @@ -51,6 +51,8 @@ file | @@ -51,6 +51,8 @@ file | ||
| 51 | ..\app\srs_app_encoder.cpp, | 51 | ..\app\srs_app_encoder.cpp, |
| 52 | ..\app\srs_app_ffmpeg.hpp, | 52 | ..\app\srs_app_ffmpeg.hpp, |
| 53 | ..\app\srs_app_ffmpeg.cpp, | 53 | ..\app\srs_app_ffmpeg.cpp, |
| 54 | + ..\app\srs_app_flv.hpp, | ||
| 55 | + ..\app\srs_app_flv.cpp, | ||
| 54 | ..\app\srs_app_forward.hpp, | 56 | ..\app\srs_app_forward.hpp, |
| 55 | ..\app\srs_app_forward.cpp, | 57 | ..\app\srs_app_forward.cpp, |
| 56 | ..\app\srs_app_hls.hpp, | 58 | ..\app\srs_app_hls.hpp, |
-
请 注册 或 登录 后发表评论