mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
CI: Refine hls ts context writer
This commit is contained in:
parent
36c41715e7
commit
073d42ca7d
3 changed files with 1 additions and 44 deletions
|
@ -458,7 +458,7 @@ srs_error_t SrsHlsMuxer::segment_open()
|
||||||
|
|
||||||
// open temp ts file.
|
// open temp ts file.
|
||||||
std::string tmp_file = current->tmppath();
|
std::string tmp_file = current->tmppath();
|
||||||
if ((err = current->tscw->open(tmp_file.c_str())) != srs_success) {
|
if ((err = current->writer->open(tmp_file)) != srs_success) {
|
||||||
return srs_error_wrap(err, "open hls muxer");
|
return srs_error_wrap(err, "open hls muxer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2554,28 +2554,6 @@ SrsTsContextWriter::SrsTsContextWriter(ISrsStreamWriter* w, SrsTsContext* c, Srs
|
||||||
|
|
||||||
SrsTsContextWriter::~SrsTsContextWriter()
|
SrsTsContextWriter::~SrsTsContextWriter()
|
||||||
{
|
{
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
srs_error_t SrsTsContextWriter::open(string p)
|
|
||||||
{
|
|
||||||
srs_error_t err = srs_success;
|
|
||||||
|
|
||||||
path = p;
|
|
||||||
|
|
||||||
close();
|
|
||||||
|
|
||||||
// reset the context for a new ts start.
|
|
||||||
context->reset();
|
|
||||||
|
|
||||||
SrsFileWriter* fw = dynamic_cast<SrsFileWriter*>(writer);
|
|
||||||
srs_assert(fw);
|
|
||||||
|
|
||||||
if ((err = fw->open(path)) != srs_success) {
|
|
||||||
return srs_error_wrap(err, "ts: open writer");
|
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_error_t SrsTsContextWriter::write_audio(SrsTsMessage* audio)
|
srs_error_t SrsTsContextWriter::write_audio(SrsTsMessage* audio)
|
||||||
|
@ -2608,14 +2586,6 @@ srs_error_t SrsTsContextWriter::write_video(SrsTsMessage* video)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrsTsContextWriter::close()
|
|
||||||
{
|
|
||||||
SrsFileWriter* fw = dynamic_cast<SrsFileWriter*>(writer);
|
|
||||||
srs_assert(fw);
|
|
||||||
|
|
||||||
fw->close();
|
|
||||||
}
|
|
||||||
|
|
||||||
SrsVideoCodecId SrsTsContextWriter::video_codec()
|
SrsVideoCodecId SrsTsContextWriter::video_codec()
|
||||||
{
|
{
|
||||||
return vcodec;
|
return vcodec;
|
||||||
|
@ -3033,10 +3003,6 @@ srs_error_t SrsTsTransmuxer::initialize(ISrsStreamWriter* fw)
|
||||||
// TODO: FIXME: Support config the codec.
|
// TODO: FIXME: Support config the codec.
|
||||||
tscw = new SrsTsContextWriter(fw, context, SrsAudioCodecIdAAC, SrsVideoCodecIdAVC);
|
tscw = new SrsTsContextWriter(fw, context, SrsAudioCodecIdAAC, SrsVideoCodecIdAVC);
|
||||||
|
|
||||||
if ((err = tscw->open("")) != srs_success) {
|
|
||||||
return srs_error_wrap(err, "ts: open writer");
|
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1549,11 +1549,6 @@ public:
|
||||||
SrsTsContextWriter(ISrsStreamWriter* w, SrsTsContext* c, SrsAudioCodecId ac, SrsVideoCodecId vc);
|
SrsTsContextWriter(ISrsStreamWriter* w, SrsTsContext* c, SrsAudioCodecId ac, SrsVideoCodecId vc);
|
||||||
virtual ~SrsTsContextWriter();
|
virtual ~SrsTsContextWriter();
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* open the writer, donot write the PSI of ts.
|
|
||||||
* @param p a string indicates the path of ts file to mux to.
|
|
||||||
*/
|
|
||||||
virtual srs_error_t open(std::string p);
|
|
||||||
/**
|
/**
|
||||||
* write an audio frame to ts,
|
* write an audio frame to ts,
|
||||||
*/
|
*/
|
||||||
|
@ -1562,10 +1557,6 @@ public:
|
||||||
* write a video frame to ts,
|
* write a video frame to ts,
|
||||||
*/
|
*/
|
||||||
virtual srs_error_t write_video(SrsTsMessage* video);
|
virtual srs_error_t write_video(SrsTsMessage* video);
|
||||||
/**
|
|
||||||
* close the writer.
|
|
||||||
*/
|
|
||||||
virtual void close();
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* get the video codec of ts muxer.
|
* get the video codec of ts muxer.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue