1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #299, write MPD file.

This commit is contained in:
winlin 2017-02-26 20:40:33 +08:00
parent e754ab7073
commit 8ab727f3c5
7 changed files with 307 additions and 6 deletions

View file

@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_core.hpp>
#include <string>
class SrsRequest;
class SrsOriginHub;
class SrsSharedPtrMessage;
@ -49,9 +51,27 @@ public:
*/
class SrsMpdWriter
{
private:
SrsRequest* req;
int64_t last_update_mpd;
private:
// The duration of fragment in ms.
int fragment;
// The period to update the mpd in ms.
int update_period;
// The timeshift buffer depth.
int timeshit;
// The base or home dir for dash to write files.
std::string home;
// The MPD path template, from which to build the file path.
std::string mpd_file;
public:
SrsMpdWriter();
virtual ~SrsMpdWriter();
public:
virtual int initialize(SrsRequest* r);
// Write MPD according to parsed format of stream.
virtual int write(SrsFormat* format);
};
/**
@ -59,9 +79,17 @@ public:
*/
class SrsDashController
{
private:
SrsMpdWriter* mpd;
public:
SrsDashController();
virtual ~SrsDashController();
public:
virtual int initialize(SrsRequest* r);
virtual int on_audio(SrsSharedPtrMessage* shared_audio, SrsFormat* format);
virtual int on_video(SrsSharedPtrMessage* shared_video, SrsFormat* format);
private:
virtual int refresh_mpd(SrsFormat* format);
};
/**