mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add options --with/without -hls/ssl
This commit is contained in:
parent
f8855cfcbb
commit
ec5cb39b96
14 changed files with 260 additions and 93 deletions
|
@ -46,6 +46,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
// generated by configure.
|
||||
#include <srs_auto_headers.hpp>
|
||||
|
||||
// free the p and set to NULL.
|
||||
// p must be a T*.
|
||||
#define srs_freep(p) \
|
||||
|
|
|
@ -703,6 +703,8 @@ int SrsConfig::parse_file(const char* filename)
|
|||
}
|
||||
// TODO: check the hls.
|
||||
// TODO: check other config.
|
||||
// TODO: check hls.
|
||||
// TODO: check ssl.
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -756,6 +758,7 @@ void SrsConfig::print_help(char** argv)
|
|||
{
|
||||
printf(RTMP_SIG_SRS_NAME" "RTMP_SIG_SRS_VERSION
|
||||
" Copyright (c) 2013 winlin\n"
|
||||
"configuration: "SRS_CONFIGURE"\n"
|
||||
"Usage: %s [-h?vV] [-c <filename>]\n"
|
||||
"\n"
|
||||
"Options:\n"
|
||||
|
@ -765,7 +768,8 @@ void SrsConfig::print_help(char** argv)
|
|||
"\n"
|
||||
RTMP_SIG_SRS_WEB"\n"
|
||||
RTMP_SIG_SRS_URL"\n"
|
||||
"Email: "RTMP_SIG_SRS_EMAIL"\n",
|
||||
"Email: "RTMP_SIG_SRS_EMAIL"\n"
|
||||
"\n",
|
||||
argv[0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@ void srs_random_generate(char* bytes, int size)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef SRS_SSL
|
||||
|
||||
// 68bytes FMS key which is used to sign the sever packet.
|
||||
u_int8_t SrsGenuineFMSKey[] = {
|
||||
0x47, 0x65, 0x6e, 0x75, 0x69, 0x6e, 0x65, 0x20,
|
||||
|
@ -1055,6 +1057,8 @@ void c1s1::destroy_blocks()
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
SrsSimpleHandshake::SrsSimpleHandshake()
|
||||
{
|
||||
}
|
||||
|
@ -1129,10 +1133,16 @@ SrsComplexHandshake::~SrsComplexHandshake()
|
|||
{
|
||||
}
|
||||
|
||||
#ifndef SRS_SSL
|
||||
int SrsComplexHandshake::handshake(SrsSocket& /*skt*/, char* /*_c1*/)
|
||||
{
|
||||
return ERROR_RTMP_TRY_SIMPLE_HS;
|
||||
}
|
||||
#else
|
||||
int SrsComplexHandshake::handshake(SrsSocket& skt, char* _c1)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
||||
ssize_t nsize;
|
||||
|
||||
static bool _random_initialized = false;
|
||||
|
@ -1204,4 +1214,5 @@ int SrsComplexHandshake::handshake(SrsSocket& skt, char* _c1)
|
|||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include <srs_core_hls.hpp>
|
||||
|
||||
#ifdef SRS_HLS
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -731,11 +733,11 @@ int SrsHls::reopen()
|
|||
}
|
||||
if (!segment_to_remove.empty()) {
|
||||
segments.erase(segments.begin(), segments.begin() + segment_to_remove.size());
|
||||
}
|
||||
|
||||
// refresh the m3u8, donot contains the removed ts
|
||||
if ((ret = refresh_m3u8()) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
// refresh the m3u8, donot contains the removed ts
|
||||
if ((ret = refresh_m3u8()) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
// remove the ts file.
|
||||
|
@ -1152,3 +1154,5 @@ bool SrsTSMuxer::fresh()
|
|||
return _fresh;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
*/
|
||||
#include <srs_core.hpp>
|
||||
|
||||
#ifdef SRS_HLS
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -173,4 +175,6 @@ public:
|
|||
virtual bool fresh();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -257,7 +257,10 @@ SrsSource* SrsSource::find(std::string stream_url)
|
|||
SrsSource::SrsSource(std::string _stream_url)
|
||||
{
|
||||
stream_url = _stream_url;
|
||||
|
||||
#ifdef SRS_HLS
|
||||
hls = new SrsHls();
|
||||
#endif
|
||||
|
||||
cache_metadata = cache_sh_video = cache_sh_audio = NULL;
|
||||
|
||||
|
@ -282,17 +285,21 @@ SrsSource::~SrsSource()
|
|||
srs_freep(cache_sh_video);
|
||||
srs_freep(cache_sh_audio);
|
||||
|
||||
#ifdef SRS_HLS
|
||||
srs_freep(hls);
|
||||
#endif
|
||||
}
|
||||
|
||||
int SrsSource::on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
#ifdef SRS_HLS
|
||||
if ((ret = hls->on_meta_data(metadata)) != ERROR_SUCCESS) {
|
||||
srs_error("hls process onMetaData message failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
metadata->metadata->set("server", new SrsAmf0String(
|
||||
RTMP_SIG_SRS_KEY" "RTMP_SIG_SRS_VERSION" ("RTMP_SIG_SRS_URL_SHORT")"));
|
||||
|
@ -363,10 +370,12 @@ int SrsSource::on_audio(SrsCommonMessage* audio)
|
|||
}
|
||||
srs_verbose("initialize shared ptr audio success.");
|
||||
|
||||
#ifdef SRS_HLS
|
||||
if ((ret = hls->on_audio(msg->copy())) != ERROR_SUCCESS) {
|
||||
srs_error("hls process audio message failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
// detach the original audio
|
||||
audio->payload = NULL;
|
||||
|
@ -413,11 +422,12 @@ int SrsSource::on_video(SrsCommonMessage* video)
|
|||
}
|
||||
srs_verbose("initialize shared ptr video success.");
|
||||
|
||||
// TODO: when return error, crash.
|
||||
#ifdef SRS_HLS
|
||||
if ((ret = hls->on_video(msg->copy())) != ERROR_SUCCESS) {
|
||||
srs_error("hls process video message failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
// detach the original audio
|
||||
video->payload = NULL;
|
||||
|
@ -452,15 +462,24 @@ int SrsSource::on_video(SrsCommonMessage* video)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef SRS_HLS
|
||||
int SrsSource::on_publish(std::string vhost, std::string app, std::string stream)
|
||||
{
|
||||
return hls->on_publish(vhost, app, stream);
|
||||
}
|
||||
#else
|
||||
int SrsSource::on_publish(std::string /*vhost*/, std::string /*app*/, std::string /*stream*/)
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
void SrsSource::on_unpublish()
|
||||
{
|
||||
#ifdef SRS_HLS
|
||||
hls->on_unpublish();
|
||||
|
||||
#endif
|
||||
|
||||
clear_gop_cache();
|
||||
|
||||
srs_freep(cache_metadata);
|
||||
|
|
|
@ -38,7 +38,9 @@ class SrsSource;
|
|||
class SrsCommonMessage;
|
||||
class SrsOnMetaDataPacket;
|
||||
class SrsSharedPtrMessage;
|
||||
#ifdef SRS_HLS
|
||||
class SrsHls;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* time jitter detect and correct,
|
||||
|
@ -125,7 +127,9 @@ public:
|
|||
*/
|
||||
static SrsSource* find(std::string stream_url);
|
||||
private:
|
||||
#ifdef SRS_HLS
|
||||
SrsHls* hls;
|
||||
#endif
|
||||
std::string stream_url;
|
||||
std::vector<SrsConsumer*> consumers;
|
||||
// gop cache for client fast startup.
|
||||
|
|
2
trunk/src/srs/srs.upp
Normal file → Executable file
2
trunk/src/srs/srs.upp
Normal file → Executable file
|
@ -1,6 +1,8 @@
|
|||
file
|
||||
main readonly separator,
|
||||
..\main\srs_main_server.cpp,
|
||||
auto readonly separator,
|
||||
..\..\objs\srs_auto_headers.hpp,
|
||||
core readonly separator,
|
||||
..\core\srs_core.hpp,
|
||||
..\core\srs_core.cpp,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue