winlin

merge from srs2

@@ -1100,6 +1100,7 @@ Winlin @@ -1100,6 +1100,7 @@ Winlin
1100 [bug #474]: https://github.com/simple-rtmp-server/srs/issues/474 1100 [bug #474]: https://github.com/simple-rtmp-server/srs/issues/474
1101 [bug #484]: https://github.com/simple-rtmp-server/srs/issues/484 1101 [bug #484]: https://github.com/simple-rtmp-server/srs/issues/484
1102 [bug #485]: https://github.com/simple-rtmp-server/srs/issues/485 1102 [bug #485]: https://github.com/simple-rtmp-server/srs/issues/485
  1103 +[bug #495]: https://github.com/simple-rtmp-server/srs/issues/495
1103 [bug #475]: https://github.com/simple-rtmp-server/srs/issues/475 1104 [bug #475]: https://github.com/simple-rtmp-server/srs/issues/475
1104 [bug #458]: https://github.com/simple-rtmp-server/srs/issues/458 1105 [bug #458]: https://github.com/simple-rtmp-server/srs/issues/458
1105 [bug #454]: https://github.com/simple-rtmp-server/srs/issues/454 1106 [bug #454]: https://github.com/simple-rtmp-server/srs/issues/454
@@ -58,6 +58,11 @@ fi @@ -58,6 +58,11 @@ fi
58 if [ $SRS_CUBIE = YES ]; then 58 if [ $SRS_CUBIE = YES ]; then
59 srs_define_macro "SRS_CUBIE" $SRS_AUTO_HEADERS_H 59 srs_define_macro "SRS_CUBIE" $SRS_AUTO_HEADERS_H
60 fi 60 fi
  61 +if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
  62 + echo "#define SRS_EXPORT_LIBRTMP" >> $SRS_AUTO_HEADERS_H
  63 +else
  64 + echo "#undef SRS_EXPORT_LIBRTMP" >> $SRS_AUTO_HEADERS_H
  65 +fi
61 66
62 echo "" >> $SRS_AUTO_HEADERS_H 67 echo "" >> $SRS_AUTO_HEADERS_H
63 68
@@ -23,6 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -23,6 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 23
24 #include <srs_kernel_aac.hpp> 24 #include <srs_kernel_aac.hpp>
25 25
  26 +#if !defined(SRS_EXPORT_LIBRTMP)
  27 +
26 // for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213 28 // for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213
27 #ifndef _WIN32 29 #ifndef _WIN32
28 #include <unistd.h> 30 #include <unistd.h>
@@ -218,3 +220,5 @@ int SrsAacEncoder::write_audio(int64_t timestamp, char* data, int size) @@ -218,3 +220,5 @@ int SrsAacEncoder::write_audio(int64_t timestamp, char* data, int size)
218 return ret; 220 return ret;
219 } 221 }
220 222
  223 +#endif
  224 +
@@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -29,6 +29,8 @@ 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 +#if !defined(SRS_EXPORT_LIBRTMP)
  33 +
32 #include <string> 34 #include <string>
33 35
34 #include <srs_kernel_codec.hpp> 36 #include <srs_kernel_codec.hpp>
@@ -71,3 +73,5 @@ public: @@ -71,3 +73,5 @@ public:
71 73
72 #endif 74 #endif
73 75
  76 +#endif
  77 +
@@ -380,6 +380,8 @@ int SrsCodecSample::add_sample_unit(char* bytes, int size) @@ -380,6 +380,8 @@ int SrsCodecSample::add_sample_unit(char* bytes, int size)
380 return ret; 380 return ret;
381 } 381 }
382 382
  383 +#if !defined(SRS_EXPORT_LIBRTMP)
  384 +
383 SrsAvcAacCodec::SrsAvcAacCodec() 385 SrsAvcAacCodec::SrsAvcAacCodec()
384 { 386 {
385 avc_parse_sps = true; 387 avc_parse_sps = true;
@@ -1225,3 +1227,5 @@ int SrsAvcAacCodec::avc_demux_ibmf_format(SrsBuffer* stream, SrsCodecSample* sam @@ -1225,3 +1227,5 @@ int SrsAvcAacCodec::avc_demux_ibmf_format(SrsBuffer* stream, SrsCodecSample* sam
1225 return ret; 1227 return ret;
1226 } 1228 }
1227 1229
  1230 +#endif
  1231 +
@@ -525,6 +525,8 @@ enum SrsAvcLevel @@ -525,6 +525,8 @@ enum SrsAvcLevel
525 }; 525 };
526 std::string srs_codec_avc_level2str(SrsAvcLevel level); 526 std::string srs_codec_avc_level2str(SrsAvcLevel level);
527 527
  528 +#if !defined(SRS_EXPORT_LIBRTMP)
  529 +
528 /** 530 /**
529 * the h264/avc and aac codec, for media stream. 531 * the h264/avc and aac codec, for media stream.
530 * 532 *
@@ -663,3 +665,6 @@ private: @@ -663,3 +665,6 @@ private:
663 }; 665 };
664 666
665 #endif 667 #endif
  668 +
  669 +#endif
  670 +
@@ -23,6 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -23,6 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 23
24 #include <srs_kernel_mp3.hpp> 24 #include <srs_kernel_mp3.hpp>
25 25
  26 +#if !defined(SRS_EXPORT_LIBRTMP)
  27 +
26 // for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213 28 // for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213
27 #ifndef _WIN32 29 #ifndef _WIN32
28 #include <unistd.h> 30 #include <unistd.h>
@@ -125,3 +127,5 @@ int SrsMp3Encoder::write_audio(int64_t timestamp, char* data, int size) @@ -125,3 +127,5 @@ int SrsMp3Encoder::write_audio(int64_t timestamp, char* data, int size)
125 return writer->write(data + stream->pos(), size - stream->pos(), NULL); 127 return writer->write(data + stream->pos(), size - stream->pos(), NULL);
126 } 128 }
127 129
  130 +#endif
  131 +
@@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -29,6 +29,8 @@ 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 +#if !defined(SRS_EXPORT_LIBRTMP)
  33 +
32 #include <string> 34 #include <string>
33 35
34 class SrsBuffer; 36 class SrsBuffer;
@@ -68,3 +70,5 @@ public: @@ -68,3 +70,5 @@ public:
68 70
69 #endif 71 #endif
70 72
  73 +#endif
  74 +
@@ -23,6 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -23,6 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 23
24 #include <srs_kernel_ts.hpp> 24 #include <srs_kernel_ts.hpp>
25 25
  26 +#if !defined(SRS_EXPORT_LIBRTMP)
  27 +
26 // for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213 28 // for srs-librtmp, @see https://github.com/simple-rtmp-server/srs/issues/213
27 #ifndef _WIN32 29 #ifndef _WIN32
28 #include <unistd.h> 30 #include <unistd.h>
@@ -3224,4 +3226,5 @@ int SrsTsEncoder::flush_video() @@ -3224,4 +3226,5 @@ int SrsTsEncoder::flush_video()
3224 return ret; 3226 return ret;
3225 } 3227 }
3226 3228
  3229 +#endif
3227 3230
@@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -29,6 +29,8 @@ 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 +#if !defined(SRS_EXPORT_LIBRTMP)
  33 +
32 #include <string> 34 #include <string>
33 #include <map> 35 #include <map>
34 #include <vector> 36 #include <vector>
@@ -1664,3 +1666,5 @@ private: @@ -1664,3 +1666,5 @@ private:
1664 1666
1665 #endif 1667 #endif
1666 1668
  1669 +#endif
  1670 +
@@ -23,6 +23,8 @@ @@ -23,6 +23,8 @@
23 23
24 #include <srs_http_stack.hpp> 24 #include <srs_http_stack.hpp>
25 25
  26 +#if !defined(SRS_EXPORT_LIBRTMP)
  27 +
26 #include <stdlib.h> 28 #include <stdlib.h>
27 #include <sstream> 29 #include <sstream>
28 #include <algorithm> 30 #include <algorithm>
@@ -777,3 +779,6 @@ char* ISrsHttpMessage::http_ts_send_buffer() @@ -777,3 +779,6 @@ char* ISrsHttpMessage::http_ts_send_buffer()
777 { 779 {
778 return _http_ts_send_buffer; 780 return _http_ts_send_buffer;
779 } 781 }
  782 +
  783 +#endif
  784 +
@@ -29,6 +29,8 @@ @@ -29,6 +29,8 @@
29 */ 29 */
30 #include <srs_core.hpp> 30 #include <srs_core.hpp>
31 31
  32 +#if !defined(SRS_EXPORT_LIBRTMP)
  33 +
32 #include <map> 34 #include <map>
33 #include <string> 35 #include <string>
34 #include <vector> 36 #include <vector>
@@ -536,3 +538,6 @@ public: @@ -536,3 +538,6 @@ public:
536 }; 538 };
537 539
538 #endif 540 #endif
  541 +
  542 +#endif
  543 +
@@ -23,6 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -23,6 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 23
24 #include <srs_rtsp_stack.hpp> 24 #include <srs_rtsp_stack.hpp>
25 25
  26 +#if !defined(SRS_EXPORT_LIBRTMP)
  27 +
26 #include <stdlib.h> 28 #include <stdlib.h>
27 #include <map> 29 #include <map>
28 using namespace std; 30 using namespace std;
@@ -1182,3 +1184,5 @@ int SrsRtspStack::recv_token(std::string& token, SrsRtspTokenState& state, char @@ -1182,3 +1184,5 @@ int SrsRtspStack::recv_token(std::string& token, SrsRtspTokenState& state, char
1182 1184
1183 #endif 1185 #endif
1184 1186
  1187 +#endif
  1188 +
@@ -30,6 +30,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -30,6 +30,8 @@ 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 +#if !defined(SRS_EXPORT_LIBRTMP)
  34 +
33 #include <string> 35 #include <string>
34 #include <sstream> 36 #include <sstream>
35 37
@@ -714,3 +716,5 @@ private: @@ -714,3 +716,5 @@ private:
714 716
715 #endif 717 #endif
716 718
  719 +#endif
  720 +