mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
For #299, refine code.
This commit is contained in:
parent
62b7204514
commit
f32aab3d92
175 changed files with 15529 additions and 15935 deletions
|
@ -1,40 +1,36 @@
|
|||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2017 SRS(ossrs)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013-2017 SRS(ossrs)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef SRS_APP_PITHY_PRINT_HPP
|
||||
#define SRS_APP_PITHY_PRINT_HPP
|
||||
|
||||
/*
|
||||
#include <srs_app_pithy_print.hpp>
|
||||
*/
|
||||
|
||||
#include <srs_core.hpp>
|
||||
|
||||
#include <srs_app_reload.hpp>
|
||||
|
||||
/**
|
||||
* the stage info to calc the age.
|
||||
*/
|
||||
* the stage info to calc the age.
|
||||
*/
|
||||
class SrsStageInfo : public ISrsReloadHandler
|
||||
{
|
||||
public:
|
||||
|
@ -63,16 +59,16 @@ public:
|
|||
* if there is 1client, it will print every 3s.
|
||||
* if there is 10clients, random select one to print every 3s.
|
||||
* Usage:
|
||||
SrsPithyPrint* pprint = SrsPithyPrint::create_rtmp_play();
|
||||
SrsAutoFree(SrsPithyPrint, pprint);
|
||||
while (true) {
|
||||
pprint->elapse();
|
||||
if (pprint->can_print()) {
|
||||
// print pithy message.
|
||||
// user can get the elapse time by: pprint->age()
|
||||
}
|
||||
// read and write RTMP messages.
|
||||
}
|
||||
* SrsPithyPrint* pprint = SrsPithyPrint::create_rtmp_play();
|
||||
* SrsAutoFree(SrsPithyPrint, pprint);
|
||||
* while (true) {
|
||||
* pprint->elapse();
|
||||
* if (pprint->can_print()) {
|
||||
* // print pithy message.
|
||||
* // user can get the elapse time by: pprint->age()
|
||||
* }
|
||||
* // read and write RTMP messages.
|
||||
* }
|
||||
*/
|
||||
class SrsPithyPrint
|
||||
{
|
||||
|
@ -99,25 +95,25 @@ public:
|
|||
virtual ~SrsPithyPrint();
|
||||
private:
|
||||
/**
|
||||
* enter the specified stage, return the client id.
|
||||
*/
|
||||
* enter the specified stage, return the client id.
|
||||
*/
|
||||
virtual int enter_stage();
|
||||
/**
|
||||
* leave the specified stage, release the client id.
|
||||
*/
|
||||
* leave the specified stage, release the client id.
|
||||
*/
|
||||
virtual void leave_stage();
|
||||
public:
|
||||
/**
|
||||
* auto calc the elapse time
|
||||
*/
|
||||
* auto calc the elapse time
|
||||
*/
|
||||
virtual void elapse();
|
||||
/**
|
||||
* whether current client can print.
|
||||
*/
|
||||
* whether current client can print.
|
||||
*/
|
||||
virtual bool can_print();
|
||||
/**
|
||||
* get the elapsed time in ms.
|
||||
*/
|
||||
* get the elapsed time in ms.
|
||||
*/
|
||||
virtual int64_t age();
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue