Add TsMuxer class
- Simple implementation of MPEG2 TS muxer. - This does not take MuxerListener so a manifest cannot be generated. - Encryption is not supported. Issue #84 Change-Id: I117b772dbbce5437398defbd564883ad758916d5
This commit is contained in:
parent
49d1563965
commit
e92556658e
|
@ -26,6 +26,8 @@
|
||||||
'pes_packet.h',
|
'pes_packet.h',
|
||||||
'pes_packet_generator.cc',
|
'pes_packet_generator.cc',
|
||||||
'pes_packet_generator.h',
|
'pes_packet_generator.h',
|
||||||
|
'ts_muxer.cc',
|
||||||
|
'ts_muxer.h',
|
||||||
'ts_packet.cc',
|
'ts_packet.cc',
|
||||||
'ts_packet.h',
|
'ts_packet.h',
|
||||||
'ts_section_pat.cc',
|
'ts_section_pat.cc',
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
// Copyright 2016 Google Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file or at
|
||||||
|
// https://developers.google.com/open-source/licenses/bsd
|
||||||
|
|
||||||
|
#include "packager/media/formats/mp2t/ts_muxer.h"
|
||||||
|
|
||||||
|
namespace edash_packager {
|
||||||
|
namespace media {
|
||||||
|
namespace mp2t {
|
||||||
|
|
||||||
|
TsMuxer::TsMuxer(const MuxerOptions& muxer_options)
|
||||||
|
: Muxer(muxer_options), segmenter_(options()) {}
|
||||||
|
TsMuxer::~TsMuxer() {}
|
||||||
|
|
||||||
|
Status TsMuxer::Initialize() {
|
||||||
|
if (streams().size() > 1u)
|
||||||
|
return Status(error::MUXER_FAILURE, "Cannot handle more than one streams.");
|
||||||
|
return segmenter_.Initialize(*streams()[0]->info());
|
||||||
|
}
|
||||||
|
|
||||||
|
Status TsMuxer::Finalize() {
|
||||||
|
return segmenter_.Finalize();
|
||||||
|
}
|
||||||
|
|
||||||
|
Status TsMuxer::DoAddSample(const MediaStream* stream,
|
||||||
|
scoped_refptr<MediaSample> sample) {
|
||||||
|
return segmenter_.AddSample(sample);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace mp2t
|
||||||
|
} // namespace media
|
||||||
|
} // namespace edash_packager
|
|
@ -0,0 +1,41 @@
|
||||||
|
// Copyright 2016 Google Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file or at
|
||||||
|
// https://developers.google.com/open-source/licenses/bsd
|
||||||
|
|
||||||
|
#ifndef PACKAGER_MEDIA_FORMATS_MP2T_TS_MUXER_H_
|
||||||
|
#define PACKAGER_MEDIA_FORMATS_MP2T_TS_MUXER_H_
|
||||||
|
|
||||||
|
#include "packager/base/macros.h"
|
||||||
|
#include "packager/media/base/muxer.h"
|
||||||
|
#include "packager/media/formats/mp2t/ts_segmenter.h"
|
||||||
|
|
||||||
|
namespace edash_packager {
|
||||||
|
namespace media {
|
||||||
|
namespace mp2t {
|
||||||
|
|
||||||
|
/// MPEG2 TS muxer.
|
||||||
|
/// This is a single program, single elementary stream TS muxer.
|
||||||
|
class TsMuxer : public Muxer {
|
||||||
|
public:
|
||||||
|
explicit TsMuxer(const MuxerOptions& muxer_options);
|
||||||
|
~TsMuxer() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Muxer implementation.
|
||||||
|
Status Initialize() override;
|
||||||
|
Status Finalize() override;
|
||||||
|
Status DoAddSample(const MediaStream* stream,
|
||||||
|
scoped_refptr<MediaSample> sample) override;
|
||||||
|
|
||||||
|
TsSegmenter segmenter_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(TsMuxer);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace mp2t
|
||||||
|
} // namespace media
|
||||||
|
} // namespace edash_packager
|
||||||
|
|
||||||
|
#endif // PACKAGER_MEDIA_FORMATS_MP2T_TS_MUXER_H_
|
Loading…
Reference in New Issue