正在显示
12 个修改的文件
包含
185 行增加
和
2 行删除
| @@ -94,6 +94,12 @@ else | @@ -94,6 +94,12 @@ else | ||
| 94 | echo "#undef SRS_AUTO_STREAM_CASTER" >> $SRS_AUTO_HEADERS_H | 94 | echo "#undef SRS_AUTO_STREAM_CASTER" >> $SRS_AUTO_HEADERS_H |
| 95 | fi | 95 | fi |
| 96 | 96 | ||
| 97 | +if [ $SRS_KAFKA = YES ]; then | ||
| 98 | + echo "#define SRS_AUTO_KAFKA" >> $SRS_AUTO_HEADERS_H | ||
| 99 | +else | ||
| 100 | + echo "#undef SRS_AUTO_KAFKA" >> $SRS_AUTO_HEADERS_H | ||
| 101 | +fi | ||
| 102 | + | ||
| 97 | if [ $SRS_HTTP_API = YES ]; then | 103 | if [ $SRS_HTTP_API = YES ]; then |
| 98 | echo "#define SRS_AUTO_HTTP_API" >> $SRS_AUTO_HEADERS_H | 104 | echo "#define SRS_AUTO_HTTP_API" >> $SRS_AUTO_HEADERS_H |
| 99 | else | 105 | else |
| @@ -27,6 +27,7 @@ SRS_STAT=RESERVED | @@ -27,6 +27,7 @@ SRS_STAT=RESERVED | ||
| 27 | SRS_HTTP_CALLBACK=RESERVED | 27 | SRS_HTTP_CALLBACK=RESERVED |
| 28 | SRS_HTTP_SERVER=RESERVED | 28 | SRS_HTTP_SERVER=RESERVED |
| 29 | SRS_STREAM_CASTER=RESERVED | 29 | SRS_STREAM_CASTER=RESERVED |
| 30 | +SRS_KAFKA=RESERVED | ||
| 30 | SRS_HTTP_API=RESERVED | 31 | SRS_HTTP_API=RESERVED |
| 31 | SRS_LIBRTMP=RESERVED | 32 | SRS_LIBRTMP=RESERVED |
| 32 | SRS_RESEARCH=RESERVED | 33 | SRS_RESEARCH=RESERVED |
| @@ -121,6 +122,7 @@ Options: | @@ -121,6 +122,7 @@ Options: | ||
| 121 | --with-http-callback enable http hooks, build cherrypy as demo api server. | 122 | --with-http-callback enable http hooks, build cherrypy as demo api server. |
| 122 | --with-http-server enable http server to delivery http stream. | 123 | --with-http-server enable http server to delivery http stream. |
| 123 | --with-stream-caster enable stream caster to serve other stream over other protocol. | 124 | --with-stream-caster enable stream caster to serve other stream over other protocol. |
| 125 | + --with-kafka enable srs kafka producer to report to kafka. | ||
| 124 | --with-http-api enable http api, to manage SRS by http api. | 126 | --with-http-api enable http api, to manage SRS by http api. |
| 125 | --with-ffmpeg enable transcoding tool ffmpeg. | 127 | --with-ffmpeg enable transcoding tool ffmpeg. |
| 126 | --with-transcode enable transcoding features. | 128 | --with-transcode enable transcoding features. |
| @@ -145,6 +147,7 @@ Options: | @@ -145,6 +147,7 @@ Options: | ||
| 145 | --without-http-callback disable http, http hooks callback. | 147 | --without-http-callback disable http, http hooks callback. |
| 146 | --without-http-server disable http server, use external server to delivery http stream. | 148 | --without-http-server disable http server, use external server to delivery http stream. |
| 147 | --without-stream-caster disable stream caster, only listen and serve RTMP/HTTP. | 149 | --without-stream-caster disable stream caster, only listen and serve RTMP/HTTP. |
| 150 | + --without-kafka disable the srs kafka producer. | ||
| 148 | --without-http-api disable http api, only use console to manage SRS process. | 151 | --without-http-api disable http api, only use console to manage SRS process. |
| 149 | --without-ffmpeg disable the ffmpeg transcode tool feature. | 152 | --without-ffmpeg disable the ffmpeg transcode tool feature. |
| 150 | --without-transcode disable the transcoding feature. | 153 | --without-transcode disable the transcoding feature. |
| @@ -232,6 +235,7 @@ function parse_user_option() { | @@ -232,6 +235,7 @@ function parse_user_option() { | ||
| 232 | --with-http-callback) SRS_HTTP_CALLBACK=YES ;; | 235 | --with-http-callback) SRS_HTTP_CALLBACK=YES ;; |
| 233 | --with-http-server) SRS_HTTP_SERVER=YES ;; | 236 | --with-http-server) SRS_HTTP_SERVER=YES ;; |
| 234 | --with-stream-caster) SRS_STREAM_CASTER=YES ;; | 237 | --with-stream-caster) SRS_STREAM_CASTER=YES ;; |
| 238 | + --with-kafka) SRS_KAFKA=YES ;; | ||
| 235 | --with-http-api) SRS_HTTP_API=YES ;; | 239 | --with-http-api) SRS_HTTP_API=YES ;; |
| 236 | --with-librtmp) SRS_LIBRTMP=YES ;; | 240 | --with-librtmp) SRS_LIBRTMP=YES ;; |
| 237 | --with-research) SRS_RESEARCH=YES ;; | 241 | --with-research) SRS_RESEARCH=YES ;; |
| @@ -256,6 +260,7 @@ function parse_user_option() { | @@ -256,6 +260,7 @@ function parse_user_option() { | ||
| 256 | --without-http-callback) SRS_HTTP_CALLBACK=NO ;; | 260 | --without-http-callback) SRS_HTTP_CALLBACK=NO ;; |
| 257 | --without-http-server) SRS_HTTP_SERVER=NO ;; | 261 | --without-http-server) SRS_HTTP_SERVER=NO ;; |
| 258 | --without-stream-caster) SRS_STREAM_CASTER=NO ;; | 262 | --without-stream-caster) SRS_STREAM_CASTER=NO ;; |
| 263 | + --without-kafka) SRS_KAFKA=NO ;; | ||
| 259 | --without-http-api) SRS_HTTP_API=NO ;; | 264 | --without-http-api) SRS_HTTP_API=NO ;; |
| 260 | --without-librtmp) SRS_LIBRTMP=NO ;; | 265 | --without-librtmp) SRS_LIBRTMP=NO ;; |
| 261 | --without-research) SRS_RESEARCH=NO ;; | 266 | --without-research) SRS_RESEARCH=NO ;; |
| @@ -390,6 +395,7 @@ function apply_user_presets() { | @@ -390,6 +395,7 @@ function apply_user_presets() { | ||
| 390 | SRS_HTTP_CALLBACK=NO | 395 | SRS_HTTP_CALLBACK=NO |
| 391 | SRS_HTTP_SERVER=NO | 396 | SRS_HTTP_SERVER=NO |
| 392 | SRS_STREAM_CASTER=NO | 397 | SRS_STREAM_CASTER=NO |
| 398 | + SRS_KAFKA=NO | ||
| 393 | SRS_HTTP_API=NO | 399 | SRS_HTTP_API=NO |
| 394 | SRS_LIBRTMP=NO | 400 | SRS_LIBRTMP=NO |
| 395 | SRS_RESEARCH=NO | 401 | SRS_RESEARCH=NO |
| @@ -417,6 +423,7 @@ function apply_user_presets() { | @@ -417,6 +423,7 @@ function apply_user_presets() { | ||
| 417 | SRS_HTTP_CALLBACK=YES | 423 | SRS_HTTP_CALLBACK=YES |
| 418 | SRS_HTTP_SERVER=YES | 424 | SRS_HTTP_SERVER=YES |
| 419 | SRS_STREAM_CASTER=YES | 425 | SRS_STREAM_CASTER=YES |
| 426 | + SRS_KAFKA=YES | ||
| 420 | SRS_HTTP_API=YES | 427 | SRS_HTTP_API=YES |
| 421 | SRS_LIBRTMP=YES | 428 | SRS_LIBRTMP=YES |
| 422 | SRS_RESEARCH=YES | 429 | SRS_RESEARCH=YES |
| @@ -444,6 +451,7 @@ function apply_user_presets() { | @@ -444,6 +451,7 @@ function apply_user_presets() { | ||
| 444 | SRS_HTTP_CALLBACK=NO | 451 | SRS_HTTP_CALLBACK=NO |
| 445 | SRS_HTTP_SERVER=NO | 452 | SRS_HTTP_SERVER=NO |
| 446 | SRS_STREAM_CASTER=NO | 453 | SRS_STREAM_CASTER=NO |
| 454 | + SRS_KAFKA=NO | ||
| 447 | SRS_HTTP_API=NO | 455 | SRS_HTTP_API=NO |
| 448 | SRS_LIBRTMP=NO | 456 | SRS_LIBRTMP=NO |
| 449 | SRS_RESEARCH=NO | 457 | SRS_RESEARCH=NO |
| @@ -471,6 +479,7 @@ function apply_user_presets() { | @@ -471,6 +479,7 @@ function apply_user_presets() { | ||
| 471 | SRS_HTTP_CALLBACK=NO | 479 | SRS_HTTP_CALLBACK=NO |
| 472 | SRS_HTTP_SERVER=NO | 480 | SRS_HTTP_SERVER=NO |
| 473 | SRS_STREAM_CASTER=NO | 481 | SRS_STREAM_CASTER=NO |
| 482 | + SRS_KAFKA=NO | ||
| 474 | SRS_HTTP_API=NO | 483 | SRS_HTTP_API=NO |
| 475 | SRS_LIBRTMP=NO | 484 | SRS_LIBRTMP=NO |
| 476 | SRS_RESEARCH=NO | 485 | SRS_RESEARCH=NO |
| @@ -498,6 +507,7 @@ function apply_user_presets() { | @@ -498,6 +507,7 @@ function apply_user_presets() { | ||
| 498 | SRS_HTTP_CALLBACK=NO | 507 | SRS_HTTP_CALLBACK=NO |
| 499 | SRS_HTTP_SERVER=NO | 508 | SRS_HTTP_SERVER=NO |
| 500 | SRS_STREAM_CASTER=NO | 509 | SRS_STREAM_CASTER=NO |
| 510 | + SRS_KAFKA=NO | ||
| 501 | SRS_HTTP_API=NO | 511 | SRS_HTTP_API=NO |
| 502 | SRS_LIBRTMP=NO | 512 | SRS_LIBRTMP=NO |
| 503 | SRS_RESEARCH=NO | 513 | SRS_RESEARCH=NO |
| @@ -525,6 +535,7 @@ function apply_user_presets() { | @@ -525,6 +535,7 @@ function apply_user_presets() { | ||
| 525 | SRS_HTTP_CALLBACK=YES | 535 | SRS_HTTP_CALLBACK=YES |
| 526 | SRS_HTTP_SERVER=YES | 536 | SRS_HTTP_SERVER=YES |
| 527 | SRS_STREAM_CASTER=NO | 537 | SRS_STREAM_CASTER=NO |
| 538 | + SRS_KAFKA=YES | ||
| 528 | SRS_HTTP_API=YES | 539 | SRS_HTTP_API=YES |
| 529 | SRS_LIBRTMP=YES | 540 | SRS_LIBRTMP=YES |
| 530 | SRS_RESEARCH=NO | 541 | SRS_RESEARCH=NO |
| @@ -553,6 +564,7 @@ function apply_user_presets() { | @@ -553,6 +564,7 @@ function apply_user_presets() { | ||
| 553 | SRS_HTTP_CALLBACK=YES | 564 | SRS_HTTP_CALLBACK=YES |
| 554 | SRS_HTTP_SERVER=YES | 565 | SRS_HTTP_SERVER=YES |
| 555 | SRS_STREAM_CASTER=NO | 566 | SRS_STREAM_CASTER=NO |
| 567 | + SRS_KAFKA=YES | ||
| 556 | SRS_HTTP_API=YES | 568 | SRS_HTTP_API=YES |
| 557 | SRS_LIBRTMP=YES | 569 | SRS_LIBRTMP=YES |
| 558 | SRS_RESEARCH=NO | 570 | SRS_RESEARCH=NO |
| @@ -580,6 +592,7 @@ function apply_user_presets() { | @@ -580,6 +592,7 @@ function apply_user_presets() { | ||
| 580 | SRS_HTTP_CALLBACK=YES | 592 | SRS_HTTP_CALLBACK=YES |
| 581 | SRS_HTTP_SERVER=YES | 593 | SRS_HTTP_SERVER=YES |
| 582 | SRS_STREAM_CASTER=NO | 594 | SRS_STREAM_CASTER=NO |
| 595 | + SRS_KAFKA=YES | ||
| 583 | SRS_HTTP_API=YES | 596 | SRS_HTTP_API=YES |
| 584 | SRS_LIBRTMP=YES | 597 | SRS_LIBRTMP=YES |
| 585 | SRS_RESEARCH=NO | 598 | SRS_RESEARCH=NO |
| @@ -607,6 +620,7 @@ function apply_user_presets() { | @@ -607,6 +620,7 @@ function apply_user_presets() { | ||
| 607 | SRS_HTTP_CALLBACK=YES | 620 | SRS_HTTP_CALLBACK=YES |
| 608 | SRS_HTTP_SERVER=YES | 621 | SRS_HTTP_SERVER=YES |
| 609 | SRS_STREAM_CASTER=NO | 622 | SRS_STREAM_CASTER=NO |
| 623 | + SRS_KAFKA=YES | ||
| 610 | SRS_HTTP_API=YES | 624 | SRS_HTTP_API=YES |
| 611 | SRS_LIBRTMP=YES | 625 | SRS_LIBRTMP=YES |
| 612 | SRS_RESEARCH=NO | 626 | SRS_RESEARCH=NO |
| @@ -634,6 +648,7 @@ function apply_user_presets() { | @@ -634,6 +648,7 @@ function apply_user_presets() { | ||
| 634 | SRS_HTTP_CALLBACK=YES | 648 | SRS_HTTP_CALLBACK=YES |
| 635 | SRS_HTTP_SERVER=YES | 649 | SRS_HTTP_SERVER=YES |
| 636 | SRS_STREAM_CASTER=NO | 650 | SRS_STREAM_CASTER=NO |
| 651 | + SRS_KAFKA=YES | ||
| 637 | SRS_HTTP_API=YES | 652 | SRS_HTTP_API=YES |
| 638 | SRS_LIBRTMP=YES | 653 | SRS_LIBRTMP=YES |
| 639 | SRS_RESEARCH=YES | 654 | SRS_RESEARCH=YES |
| @@ -661,6 +676,7 @@ function apply_user_presets() { | @@ -661,6 +676,7 @@ function apply_user_presets() { | ||
| 661 | SRS_HTTP_CALLBACK=YES | 676 | SRS_HTTP_CALLBACK=YES |
| 662 | SRS_HTTP_SERVER=YES | 677 | SRS_HTTP_SERVER=YES |
| 663 | SRS_STREAM_CASTER=NO | 678 | SRS_STREAM_CASTER=NO |
| 679 | + SRS_KAFKA=YES | ||
| 664 | SRS_HTTP_API=YES | 680 | SRS_HTTP_API=YES |
| 665 | SRS_LIBRTMP=NO | 681 | SRS_LIBRTMP=NO |
| 666 | SRS_RESEARCH=NO | 682 | SRS_RESEARCH=NO |
| @@ -688,6 +704,7 @@ function apply_user_presets() { | @@ -688,6 +704,7 @@ function apply_user_presets() { | ||
| 688 | SRS_HTTP_CALLBACK=YES | 704 | SRS_HTTP_CALLBACK=YES |
| 689 | SRS_HTTP_SERVER=YES | 705 | SRS_HTTP_SERVER=YES |
| 690 | SRS_STREAM_CASTER=NO | 706 | SRS_STREAM_CASTER=NO |
| 707 | + SRS_KAFKA=YES | ||
| 691 | SRS_HTTP_API=YES | 708 | SRS_HTTP_API=YES |
| 692 | SRS_LIBRTMP=YES | 709 | SRS_LIBRTMP=YES |
| 693 | SRS_RESEARCH=NO | 710 | SRS_RESEARCH=NO |
| @@ -715,6 +732,7 @@ function apply_user_presets() { | @@ -715,6 +732,7 @@ function apply_user_presets() { | ||
| 715 | SRS_HTTP_CALLBACK=YES | 732 | SRS_HTTP_CALLBACK=YES |
| 716 | SRS_HTTP_SERVER=YES | 733 | SRS_HTTP_SERVER=YES |
| 717 | SRS_STREAM_CASTER=NO | 734 | SRS_STREAM_CASTER=NO |
| 735 | + SRS_KAFKA=YES | ||
| 718 | SRS_HTTP_API=YES | 736 | SRS_HTTP_API=YES |
| 719 | SRS_LIBRTMP=YES | 737 | SRS_LIBRTMP=YES |
| 720 | SRS_RESEARCH=NO | 738 | SRS_RESEARCH=NO |
| @@ -742,6 +760,7 @@ function apply_user_presets() { | @@ -742,6 +760,7 @@ function apply_user_presets() { | ||
| 742 | SRS_HTTP_CALLBACK=YES | 760 | SRS_HTTP_CALLBACK=YES |
| 743 | SRS_HTTP_SERVER=YES | 761 | SRS_HTTP_SERVER=YES |
| 744 | SRS_STREAM_CASTER=NO | 762 | SRS_STREAM_CASTER=NO |
| 763 | + SRS_KAFKA=YES | ||
| 745 | SRS_HTTP_API=YES | 764 | SRS_HTTP_API=YES |
| 746 | SRS_LIBRTMP=YES | 765 | SRS_LIBRTMP=YES |
| 747 | SRS_RESEARCH=NO | 766 | SRS_RESEARCH=NO |
| @@ -804,6 +823,7 @@ function apply_user_detail_options() { | @@ -804,6 +823,7 @@ function apply_user_detail_options() { | ||
| 804 | SRS_HTTP_CALLBACK=NO | 823 | SRS_HTTP_CALLBACK=NO |
| 805 | SRS_HTTP_SERVER=NO | 824 | SRS_HTTP_SERVER=NO |
| 806 | SRS_STREAM_CASTER=NO | 825 | SRS_STREAM_CASTER=NO |
| 826 | + SRS_KAFKA=NO | ||
| 807 | SRS_HTTP_API=NO | 827 | SRS_HTTP_API=NO |
| 808 | SRS_LIBRTMP=YES | 828 | SRS_LIBRTMP=YES |
| 809 | SRS_RESEARCH=YES | 829 | SRS_RESEARCH=YES |
| @@ -835,6 +855,7 @@ SRS_AUTO_CONFIGURE="--prefix=${SRS_PREFIX}" | @@ -835,6 +855,7 @@ SRS_AUTO_CONFIGURE="--prefix=${SRS_PREFIX}" | ||
| 835 | if [ $SRS_HTTP_CALLBACK = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-callback"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-callback"; fi | 855 | if [ $SRS_HTTP_CALLBACK = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-callback"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-callback"; fi |
| 836 | if [ $SRS_HTTP_SERVER = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-server"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-server"; fi | 856 | if [ $SRS_HTTP_SERVER = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-server"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-server"; fi |
| 837 | if [ $SRS_STREAM_CASTER = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-stream-caster"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-stream-caster"; fi | 857 | if [ $SRS_STREAM_CASTER = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-stream-caster"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-stream-caster"; fi |
| 858 | + if [ $SRS_KAFKA = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-kafka"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-kafka"; fi | ||
| 838 | if [ $SRS_HTTP_API = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-api"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-api"; fi | 859 | if [ $SRS_HTTP_API = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-api"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-api"; fi |
| 839 | if [ $SRS_LIBRTMP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-librtmp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-librtmp"; fi | 860 | if [ $SRS_LIBRTMP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-librtmp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-librtmp"; fi |
| 840 | if [ $SRS_RESEARCH = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-research"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-research"; fi | 861 | if [ $SRS_RESEARCH = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-research"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-research"; fi |
| @@ -912,6 +933,7 @@ function check_option_conflicts() { | @@ -912,6 +933,7 @@ function check_option_conflicts() { | ||
| 912 | if [ $SRS_HTTP_CALLBACK = RESERVED ]; then echo "you must specifies the http-callback, see: ./configure --help"; __check_ok=NO; fi | 933 | if [ $SRS_HTTP_CALLBACK = RESERVED ]; then echo "you must specifies the http-callback, see: ./configure --help"; __check_ok=NO; fi |
| 913 | if [ $SRS_HTTP_SERVER = RESERVED ]; then echo "you must specifies the http-server, see: ./configure --help"; __check_ok=NO; fi | 934 | if [ $SRS_HTTP_SERVER = RESERVED ]; then echo "you must specifies the http-server, see: ./configure --help"; __check_ok=NO; fi |
| 914 | if [ $SRS_STREAM_CASTER = RESERVED ]; then echo "you must specifies the stream-caster, see: ./configure --help"; __check_ok=NO; fi | 935 | if [ $SRS_STREAM_CASTER = RESERVED ]; then echo "you must specifies the stream-caster, see: ./configure --help"; __check_ok=NO; fi |
| 936 | + if [ $SRS_KAFKA = RESERVED ]; then echo "you must specifies the kafka, see: ./configure --help"; __check_ok=NO; fi | ||
| 915 | if [ $SRS_HTTP_API = RESERVED ]; then echo "you must specifies the http-api, see: ./configure --help"; __check_ok=NO; fi | 937 | if [ $SRS_HTTP_API = RESERVED ]; then echo "you must specifies the http-api, see: ./configure --help"; __check_ok=NO; fi |
| 916 | if [ $SRS_LIBRTMP = RESERVED ]; then echo "you must specifies the librtmp, see: ./configure --help"; __check_ok=NO; fi | 938 | if [ $SRS_LIBRTMP = RESERVED ]; then echo "you must specifies the librtmp, see: ./configure --help"; __check_ok=NO; fi |
| 917 | if [ $SRS_RESEARCH = RESERVED ]; then echo "you must specifies the research, see: ./configure --help"; __check_ok=NO; fi | 939 | if [ $SRS_RESEARCH = RESERVED ]; then echo "you must specifies the research, see: ./configure --help"; __check_ok=NO; fi |
| @@ -12,6 +12,7 @@ SrsHttpCallbackSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_CALLBACK = Y | @@ -12,6 +12,7 @@ SrsHttpCallbackSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_CALLBACK = Y | ||
| 12 | SrsHttpServerSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_SERVER = YES ]; then SrsHttpServerSummaryColor="\${GREEN}"; fi | 12 | SrsHttpServerSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_SERVER = YES ]; then SrsHttpServerSummaryColor="\${GREEN}"; fi |
| 13 | SrsHttpApiSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_API = YES ]; then SrsHttpApiSummaryColor="\${GREEN}"; fi | 13 | SrsHttpApiSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_API = YES ]; then SrsHttpApiSummaryColor="\${GREEN}"; fi |
| 14 | SrsStreamCasterSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_STREAM_CASTER = YES ]; then SrsStreamCasterSummaryColor="\${GREEN}"; fi | 14 | SrsStreamCasterSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_STREAM_CASTER = YES ]; then SrsStreamCasterSummaryColor="\${GREEN}"; fi |
| 15 | +SrsKafkaSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_KAFKA = YES ]; then SrsKafkaSummaryColor="\${GREEN}"; fi | ||
| 15 | SrsLibrtmpSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then SrsLibrtmpSummaryColor="\${GREEN}"; fi | 16 | SrsLibrtmpSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then SrsLibrtmpSummaryColor="\${GREEN}"; fi |
| 16 | SrsLibrtmpSSLSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_SSL = YES ]; then SrsLibrtmpSSLSummaryColor="\${GREEN}"; fi fi | 17 | SrsLibrtmpSSLSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_LIBRTMP = YES ]; then if [ $SRS_SSL = YES ]; then SrsLibrtmpSSLSummaryColor="\${GREEN}"; fi fi |
| 17 | SrsResearchSummaryColor="\${GREEN}{disabled} "; if [ $SRS_RESEARCH = YES ]; then SrsResearchSummaryColor="\${GREEN}"; fi | 18 | SrsResearchSummaryColor="\${GREEN}{disabled} "; if [ $SRS_RESEARCH = YES ]; then SrsResearchSummaryColor="\${GREEN}"; fi |
| @@ -101,6 +102,8 @@ echo -e " | ${SrsHttpApiSummaryColor}http-api @see: https://github.com/s | @@ -101,6 +102,8 @@ echo -e " | ${SrsHttpApiSummaryColor}http-api @see: https://github.com/s | ||
| 101 | echo -e " | ${SrsHttpApiSummaryColor}http-api: support http api to manage server\${BLACK}" | 102 | echo -e " | ${SrsHttpApiSummaryColor}http-api: support http api to manage server\${BLACK}" |
| 102 | echo -e " | ${SrsStreamCasterSummaryColor}stream-caster @see: https://github.com/simple-rtmp-server/srs/wiki/v2_CN_Streamer\${BLACK}" | 103 | echo -e " | ${SrsStreamCasterSummaryColor}stream-caster @see: https://github.com/simple-rtmp-server/srs/wiki/v2_CN_Streamer\${BLACK}" |
| 103 | echo -e " | ${SrsStreamCasterSummaryColor}stream-caster: start server to cast stream over other protocols.\${BLACK}" | 104 | echo -e " | ${SrsStreamCasterSummaryColor}stream-caster: start server to cast stream over other protocols.\${BLACK}" |
| 105 | +echo -e " | ${SrsKafkaSummaryColor}kafka @see: https://github.com/simple-rtmp-server/srs/wiki/v3_CN_Kafka\${BLACK}" | ||
| 106 | +echo -e " | ${SrsKafkaSummaryColor}kafka: start srs kafka producer to report to kafka.\${BLACK}" | ||
| 104 | echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}" | 107 | echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}" |
| 105 | echo -e "\${GREEN}binaries @see: https://github.com/simple-rtmp-server/srs/wiki/v2_CN_Build\${BLACK}" | 108 | echo -e "\${GREEN}binaries @see: https://github.com/simple-rtmp-server/srs/wiki/v2_CN_Build\${BLACK}" |
| 106 | 109 |
| @@ -177,7 +177,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | @@ -177,7 +177,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | ||
| 177 | "srs_app_heartbeat" "srs_app_empty" "srs_app_http_client" "srs_app_http_static" | 177 | "srs_app_heartbeat" "srs_app_empty" "srs_app_http_client" "srs_app_http_static" |
| 178 | "srs_app_recv_thread" "srs_app_security" "srs_app_statistic" "srs_app_hds" | 178 | "srs_app_recv_thread" "srs_app_security" "srs_app_statistic" "srs_app_hds" |
| 179 | "srs_app_mpegts_udp" "srs_app_rtsp" "srs_app_listener" "srs_app_async_call" | 179 | "srs_app_mpegts_udp" "srs_app_rtsp" "srs_app_listener" "srs_app_async_call" |
| 180 | - "srs_app_caster_flv" "srs_app_process" "srs_app_ng_exec") | 180 | + "srs_app_caster_flv" "srs_app_process" "srs_app_ng_exec" "srs_app_kafka") |
| 181 | DEFINES="" | 181 | DEFINES="" |
| 182 | # add each modules for app | 182 | # add each modules for app |
| 183 | for SRS_MODULE in ${SRS_MODULES[*]}; do | 183 | for SRS_MODULE in ${SRS_MODULES[*]}; do |
| @@ -514,6 +514,11 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | @@ -514,6 +514,11 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | ||
| 514 | else | 514 | else |
| 515 | echo -e "${GREEN}note: without StreamCaster support${BLACK}" | 515 | echo -e "${GREEN}note: without StreamCaster support${BLACK}" |
| 516 | fi | 516 | fi |
| 517 | + if [ $SRS_KAFKA = YES ]; then | ||
| 518 | + echo -e "${GREEN}Kafka is enabled${BLACK}" | ||
| 519 | + else | ||
| 520 | + echo -e "${YELLOW}warning: without Kafka support${BLACK}" | ||
| 521 | + fi | ||
| 517 | if [ $SRS_HDS = YES ]; then | 522 | if [ $SRS_HDS = YES ]; then |
| 518 | echo -e "${YELLOW}Experiment: HDS is enabled${BLACK}" | 523 | echo -e "${YELLOW}Experiment: HDS is enabled${BLACK}" |
| 519 | else | 524 | else |
| @@ -75,6 +75,7 @@ | @@ -75,6 +75,7 @@ | ||
| 75 | 3C1232ED1AAEA70F00CE8F6C /* libhttp_parser.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C1232EC1AAEA70F00CE8F6C /* libhttp_parser.a */; }; | 75 | 3C1232ED1AAEA70F00CE8F6C /* libhttp_parser.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C1232EC1AAEA70F00CE8F6C /* libhttp_parser.a */; }; |
| 76 | 3C1EE6AE1AB1055800576EE9 /* srs_app_hds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C1EE6AC1AB1055800576EE9 /* srs_app_hds.cpp */; }; | 76 | 3C1EE6AE1AB1055800576EE9 /* srs_app_hds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C1EE6AC1AB1055800576EE9 /* srs_app_hds.cpp */; }; |
| 77 | 3C1EE6D71AB1367D00576EE9 /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = 3C1EE6D61AB1367D00576EE9 /* README.md */; }; | 77 | 3C1EE6D71AB1367D00576EE9 /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = 3C1EE6D61AB1367D00576EE9 /* README.md */; }; |
| 78 | + 3C26E3C61BB146FF00D0F9DB /* srs_app_kafka.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C26E3C41BB146FF00D0F9DB /* srs_app_kafka.cpp */; }; | ||
| 78 | 3C28EDDF1AF5C43F00A3AEAC /* srs_app_caster_flv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C28EDDD1AF5C43F00A3AEAC /* srs_app_caster_flv.cpp */; }; | 79 | 3C28EDDF1AF5C43F00A3AEAC /* srs_app_caster_flv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C28EDDD1AF5C43F00A3AEAC /* srs_app_caster_flv.cpp */; }; |
| 79 | 3C36DB5B1ABD1CB90066CCAF /* srs_lib_bandwidth.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C36DB551ABD1CB90066CCAF /* srs_lib_bandwidth.cpp */; }; | 80 | 3C36DB5B1ABD1CB90066CCAF /* srs_lib_bandwidth.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C36DB551ABD1CB90066CCAF /* srs_lib_bandwidth.cpp */; }; |
| 80 | 3C36DB5C1ABD1CB90066CCAF /* srs_lib_simple_socket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C36DB571ABD1CB90066CCAF /* srs_lib_simple_socket.cpp */; }; | 81 | 3C36DB5C1ABD1CB90066CCAF /* srs_lib_simple_socket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C36DB571ABD1CB90066CCAF /* srs_lib_simple_socket.cpp */; }; |
| @@ -323,6 +324,8 @@ | @@ -323,6 +324,8 @@ | ||
| 323 | 3C1EE6D41AB1367D00576EE9 /* DONATIONS.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DONATIONS.txt; path = ../../../DONATIONS.txt; sourceTree = "<group>"; }; | 324 | 3C1EE6D41AB1367D00576EE9 /* DONATIONS.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DONATIONS.txt; path = ../../../DONATIONS.txt; sourceTree = "<group>"; }; |
| 324 | 3C1EE6D51AB1367D00576EE9 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../../../LICENSE; sourceTree = "<group>"; }; | 325 | 3C1EE6D51AB1367D00576EE9 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../../../LICENSE; sourceTree = "<group>"; }; |
| 325 | 3C1EE6D61AB1367D00576EE9 /* README.md */ = {isa = PBXFileReference; explicitFileType = net.daringfireball.markdown; fileEncoding = 4; name = README.md; path = ../../../README.md; sourceTree = "<group>"; wrapsLines = 0; }; | 326 | 3C1EE6D61AB1367D00576EE9 /* README.md */ = {isa = PBXFileReference; explicitFileType = net.daringfireball.markdown; fileEncoding = 4; name = README.md; path = ../../../README.md; sourceTree = "<group>"; wrapsLines = 0; }; |
| 327 | + 3C26E3C41BB146FF00D0F9DB /* srs_app_kafka.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_kafka.cpp; path = ../../../src/app/srs_app_kafka.cpp; sourceTree = "<group>"; }; | ||
| 328 | + 3C26E3C51BB146FF00D0F9DB /* srs_app_kafka.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_kafka.hpp; path = ../../../src/app/srs_app_kafka.hpp; sourceTree = "<group>"; }; | ||
| 326 | 3C28EDDD1AF5C43F00A3AEAC /* srs_app_caster_flv.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_caster_flv.cpp; path = ../../../src/app/srs_app_caster_flv.cpp; sourceTree = "<group>"; }; | 329 | 3C28EDDD1AF5C43F00A3AEAC /* srs_app_caster_flv.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_caster_flv.cpp; path = ../../../src/app/srs_app_caster_flv.cpp; sourceTree = "<group>"; }; |
| 327 | 3C28EDDE1AF5C43F00A3AEAC /* srs_app_caster_flv.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_caster_flv.hpp; path = ../../../src/app/srs_app_caster_flv.hpp; sourceTree = "<group>"; }; | 330 | 3C28EDDE1AF5C43F00A3AEAC /* srs_app_caster_flv.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_caster_flv.hpp; path = ../../../src/app/srs_app_caster_flv.hpp; sourceTree = "<group>"; }; |
| 328 | 3C36DB551ABD1CB90066CCAF /* srs_lib_bandwidth.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_lib_bandwidth.cpp; path = ../../../src/libs/srs_lib_bandwidth.cpp; sourceTree = "<group>"; }; | 331 | 3C36DB551ABD1CB90066CCAF /* srs_lib_bandwidth.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_lib_bandwidth.cpp; path = ../../../src/libs/srs_lib_bandwidth.cpp; sourceTree = "<group>"; }; |
| @@ -584,6 +587,8 @@ | @@ -584,6 +587,8 @@ | ||
| 584 | 3C036B541B2D0AC10078E2E0 /* srs_app_http_stream.hpp */, | 587 | 3C036B541B2D0AC10078E2E0 /* srs_app_http_stream.hpp */, |
| 585 | 3C12326C1AAE81D900CE8F6C /* srs_app_ingest.cpp */, | 588 | 3C12326C1AAE81D900CE8F6C /* srs_app_ingest.cpp */, |
| 586 | 3C12326D1AAE81D900CE8F6C /* srs_app_ingest.hpp */, | 589 | 3C12326D1AAE81D900CE8F6C /* srs_app_ingest.hpp */, |
| 590 | + 3C26E3C41BB146FF00D0F9DB /* srs_app_kafka.cpp */, | ||
| 591 | + 3C26E3C51BB146FF00D0F9DB /* srs_app_kafka.hpp */, | ||
| 587 | 3C1232721AAE81D900CE8F6C /* srs_app_listener.cpp */, | 592 | 3C1232721AAE81D900CE8F6C /* srs_app_listener.cpp */, |
| 588 | 3C1232731AAE81D900CE8F6C /* srs_app_listener.hpp */, | 593 | 3C1232731AAE81D900CE8F6C /* srs_app_listener.hpp */, |
| 589 | 3C1232741AAE81D900CE8F6C /* srs_app_log.cpp */, | 594 | 3C1232741AAE81D900CE8F6C /* srs_app_log.cpp */, |
| @@ -887,6 +892,7 @@ | @@ -887,6 +892,7 @@ | ||
| 887 | 3C12329E1AAE81D900CE8F6C /* srs_app_hls.cpp in Sources */, | 892 | 3C12329E1AAE81D900CE8F6C /* srs_app_hls.cpp in Sources */, |
| 888 | 3CC52DD91ACE4023006FEB01 /* srs_utest_config.cpp in Sources */, | 893 | 3CC52DD91ACE4023006FEB01 /* srs_utest_config.cpp in Sources */, |
| 889 | 3C663F171AB0155100286D8B /* srs_ingest_rtmp.c in Sources */, | 894 | 3C663F171AB0155100286D8B /* srs_ingest_rtmp.c in Sources */, |
| 895 | + 3C26E3C61BB146FF00D0F9DB /* srs_app_kafka.cpp in Sources */, | ||
| 890 | 3C663F131AB0155100286D8B /* srs_flv_injecter.c in Sources */, | 896 | 3C663F131AB0155100286D8B /* srs_flv_injecter.c in Sources */, |
| 891 | 3C1232971AAE81D900CE8F6C /* srs_app_dvr.cpp in Sources */, | 897 | 3C1232971AAE81D900CE8F6C /* srs_app_dvr.cpp in Sources */, |
| 892 | 3C1232271AAE814D00CE8F6C /* srs_kernel_log.cpp in Sources */, | 898 | 3C1232271AAE814D00CE8F6C /* srs_kernel_log.cpp in Sources */, |
| @@ -62,7 +62,7 @@ public: | @@ -62,7 +62,7 @@ public: | ||
| 62 | }; | 62 | }; |
| 63 | 63 | ||
| 64 | /** | 64 | /** |
| 65 | - * the async callback for dvr. | 65 | + * the async callback for dvr, callback and other async worker. |
| 66 | * when worker call with the task, the worker will do it in isolate thread. | 66 | * when worker call with the task, the worker will do it in isolate thread. |
| 67 | * that is, the task is execute/call in async mode. | 67 | * that is, the task is execute/call in async mode. |
| 68 | */ | 68 | */ |
| @@ -1539,6 +1539,7 @@ int SrsConfig::reload_conf(SrsConfig* conf) | @@ -1539,6 +1539,7 @@ int SrsConfig::reload_conf(SrsConfig* conf) | ||
| 1539 | } | 1539 | } |
| 1540 | 1540 | ||
| 1541 | // TODO: FIXME: support reload stream_caster. | 1541 | // TODO: FIXME: support reload stream_caster. |
| 1542 | + // TODO: FIXME: support reload kafka. | ||
| 1542 | 1543 | ||
| 1543 | // merge config: vhost | 1544 | // merge config: vhost |
| 1544 | if ((ret = reload_vhost(old_root)) != ERROR_SUCCESS) { | 1545 | if ((ret = reload_vhost(old_root)) != ERROR_SUCCESS) { |
trunk/src/app/srs_app_kafka.cpp
0 → 100644
| 1 | +/* | ||
| 2 | + The MIT License (MIT) | ||
| 3 | + | ||
| 4 | + Copyright (c) 2013-2015 SRS(simple-rtmp-server) | ||
| 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_kafka.hpp> | ||
| 25 | + | ||
| 26 | +#include <srs_kernel_error.hpp> | ||
| 27 | +#include <srs_kernel_log.hpp> | ||
| 28 | +#include <srs_app_config.hpp> | ||
| 29 | +#include <srs_app_async_call.hpp> | ||
| 30 | + | ||
| 31 | +SrsKafkaProducer::SrsKafkaProducer() | ||
| 32 | +{ | ||
| 33 | + worker = new SrsAsyncCallWorker(); | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | +SrsKafkaProducer::~SrsKafkaProducer() | ||
| 37 | +{ | ||
| 38 | + srs_freep(worker); | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +int SrsKafkaProducer::initialize() | ||
| 42 | +{ | ||
| 43 | + int ret = ERROR_SUCCESS; | ||
| 44 | + | ||
| 45 | + srs_trace("initialize kafka producer ok."); | ||
| 46 | + | ||
| 47 | + return ret; | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | +int SrsKafkaProducer::start() | ||
| 51 | +{ | ||
| 52 | + int ret = ERROR_SUCCESS; | ||
| 53 | + | ||
| 54 | + if ((ret = worker->start()) != ERROR_SUCCESS) { | ||
| 55 | + srs_error("start kafka failed. ret=%d", ret); | ||
| 56 | + return ret; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + srs_trace("start kafka async worker ok."); | ||
| 60 | + | ||
| 61 | + return ret; | ||
| 62 | +} | ||
| 63 | + | ||
| 64 | +void SrsKafkaProducer::stop() | ||
| 65 | +{ | ||
| 66 | + worker->stop(); | ||
| 67 | +} | ||
| 68 | + |
trunk/src/app/srs_app_kafka.hpp
0 → 100644
| 1 | +/* | ||
| 2 | + The MIT License (MIT) | ||
| 3 | + | ||
| 4 | + Copyright (c) 2013-2015 SRS(simple-rtmp-server) | ||
| 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_KAFKA_HPP | ||
| 25 | +#define SRS_APP_KAFKA_HPP | ||
| 26 | + | ||
| 27 | +/* | ||
| 28 | +#include <srs_app_kafka.hpp> | ||
| 29 | +*/ | ||
| 30 | +#include <srs_core.hpp> | ||
| 31 | + | ||
| 32 | +class SrsAsyncCallWorker; | ||
| 33 | + | ||
| 34 | +class SrsKafkaProducer | ||
| 35 | +{ | ||
| 36 | +private: | ||
| 37 | + SrsAsyncCallWorker* worker; | ||
| 38 | +public: | ||
| 39 | + SrsKafkaProducer(); | ||
| 40 | + virtual ~SrsKafkaProducer(); | ||
| 41 | +public: | ||
| 42 | + virtual int initialize(); | ||
| 43 | + virtual int start(); | ||
| 44 | + virtual void stop(); | ||
| 45 | +}; | ||
| 46 | + | ||
| 47 | +#endif |
| @@ -49,6 +49,7 @@ using namespace std; | @@ -49,6 +49,7 @@ using namespace std; | ||
| 49 | #include <srs_app_caster_flv.hpp> | 49 | #include <srs_app_caster_flv.hpp> |
| 50 | #include <srs_core_mem_watch.hpp> | 50 | #include <srs_core_mem_watch.hpp> |
| 51 | #include <srs_kernel_consts.hpp> | 51 | #include <srs_kernel_consts.hpp> |
| 52 | +#include <srs_app_kafka.hpp> | ||
| 52 | 53 | ||
| 53 | // system interval in ms, | 54 | // system interval in ms, |
| 54 | // all resolution times should be times togother, | 55 | // all resolution times should be times togother, |
| @@ -508,6 +509,7 @@ SrsServer::SrsServer() | @@ -508,6 +509,7 @@ SrsServer::SrsServer() | ||
| 508 | #ifdef SRS_AUTO_INGEST | 509 | #ifdef SRS_AUTO_INGEST |
| 509 | ingester = NULL; | 510 | ingester = NULL; |
| 510 | #endif | 511 | #endif |
| 512 | + kafka = new SrsKafkaProducer(); | ||
| 511 | } | 513 | } |
| 512 | 514 | ||
| 513 | SrsServer::~SrsServer() | 515 | SrsServer::~SrsServer() |
| @@ -537,6 +539,8 @@ void SrsServer::destroy() | @@ -537,6 +539,8 @@ void SrsServer::destroy() | ||
| 537 | srs_freep(ingester); | 539 | srs_freep(ingester); |
| 538 | #endif | 540 | #endif |
| 539 | 541 | ||
| 542 | + srs_freep(kafka); | ||
| 543 | + | ||
| 540 | if (pid_fd > 0) { | 544 | if (pid_fd > 0) { |
| 541 | ::close(pid_fd); | 545 | ::close(pid_fd); |
| 542 | pid_fd = -1; | 546 | pid_fd = -1; |
| @@ -561,6 +565,8 @@ void SrsServer::dispose() | @@ -561,6 +565,8 @@ void SrsServer::dispose() | ||
| 561 | ingester->dispose(); | 565 | ingester->dispose(); |
| 562 | #endif | 566 | #endif |
| 563 | 567 | ||
| 568 | + kafka->stop(); | ||
| 569 | + | ||
| 564 | SrsSource::dispose_all(); | 570 | SrsSource::dispose_all(); |
| 565 | 571 | ||
| 566 | while (!conns.empty()) { | 572 | while (!conns.empty()) { |
| @@ -864,6 +870,18 @@ int SrsServer::ingest() | @@ -864,6 +870,18 @@ int SrsServer::ingest() | ||
| 864 | return ret; | 870 | return ret; |
| 865 | } | 871 | } |
| 866 | 872 | ||
| 873 | +int SrsServer::start_kafka() | ||
| 874 | +{ | ||
| 875 | + int ret = ERROR_SUCCESS; | ||
| 876 | + | ||
| 877 | + if ((ret = kafka->initialize()) != ERROR_SUCCESS) { | ||
| 878 | + srs_error("initialize the kafka producer failed. ret=%d", ret); | ||
| 879 | + return ret; | ||
| 880 | + } | ||
| 881 | + | ||
| 882 | + return kafka->start(); | ||
| 883 | +} | ||
| 884 | + | ||
| 867 | int SrsServer::cycle() | 885 | int SrsServer::cycle() |
| 868 | { | 886 | { |
| 869 | int ret = ERROR_SUCCESS; | 887 | int ret = ERROR_SUCCESS; |
| @@ -55,6 +55,7 @@ class SrsTcpListener; | @@ -55,6 +55,7 @@ class SrsTcpListener; | ||
| 55 | #ifdef SRS_AUTO_STREAM_CASTER | 55 | #ifdef SRS_AUTO_STREAM_CASTER |
| 56 | class SrsAppCasterFlv; | 56 | class SrsAppCasterFlv; |
| 57 | #endif | 57 | #endif |
| 58 | +class SrsKafkaProducer; | ||
| 58 | 59 | ||
| 59 | // listener type for server to identify the connection, | 60 | // listener type for server to identify the connection, |
| 60 | // that is, use different type to process the connection. | 61 | // that is, use different type to process the connection. |
| @@ -247,6 +248,7 @@ private: | @@ -247,6 +248,7 @@ private: | ||
| 247 | #ifdef SRS_AUTO_INGEST | 248 | #ifdef SRS_AUTO_INGEST |
| 248 | SrsIngester* ingester; | 249 | SrsIngester* ingester; |
| 249 | #endif | 250 | #endif |
| 251 | + SrsKafkaProducer* kafka; | ||
| 250 | private: | 252 | private: |
| 251 | /** | 253 | /** |
| 252 | * the pid file fd, lock the file write when server is running. | 254 | * the pid file fd, lock the file write when server is running. |
| @@ -307,6 +309,7 @@ public: | @@ -307,6 +309,7 @@ public: | ||
| 307 | virtual int register_signal(); | 309 | virtual int register_signal(); |
| 308 | virtual int http_handle(); | 310 | virtual int http_handle(); |
| 309 | virtual int ingest(); | 311 | virtual int ingest(); |
| 312 | + virtual int start_kafka(); | ||
| 310 | virtual int cycle(); | 313 | virtual int cycle(); |
| 311 | // IConnectionManager | 314 | // IConnectionManager |
| 312 | public: | 315 | public: |
| @@ -382,6 +382,10 @@ int run_master() | @@ -382,6 +382,10 @@ int run_master() | ||
| 382 | return ret; | 382 | return ret; |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | + if ((ret = _srs_server->start_kafka()) != ERROR_SUCCESS) { | ||
| 386 | + return ret; | ||
| 387 | + } | ||
| 388 | + | ||
| 385 | if ((ret = _srs_server->cycle()) != ERROR_SUCCESS) { | 389 | if ((ret = _srs_server->cycle()) != ERROR_SUCCESS) { |
| 386 | return ret; | 390 | return ret; |
| 387 | } | 391 | } |
-
请 注册 或 登录 后发表评论