7 #include <packager/app/muxer_factory.h>
9 #include <packager/media/base/muxer.h>
10 #include <packager/media/formats/mp2t/ts_muxer.h>
11 #include <packager/media/formats/mp4/mp4_muxer.h>
12 #include <packager/media/formats/packed_audio/packed_audio_writer.h>
13 #include <packager/media/formats/ttml/ttml_muxer.h>
14 #include <packager/media/formats/webm/webm_muxer.h>
15 #include <packager/media/formats/webvtt/webvtt_muxer.h>
16 #include <packager/packager.h>
21 MuxerFactory::MuxerFactory(
const PackagingParams& packaging_params)
22 : mp4_params_(packaging_params.mp4_output_params),
23 temp_dir_(packaging_params.temp_dir),
24 transport_stream_timestamp_offset_ms_(
25 packaging_params.transport_stream_timestamp_offset_ms) {}
27 std::shared_ptr<Muxer> MuxerFactory::CreateMuxer(
28 MediaContainerName output_format,
29 const StreamDescriptor& stream) {
32 options.transport_stream_timestamp_offset_ms =
33 transport_stream_timestamp_offset_ms_;
39 std::shared_ptr<Muxer> muxer;
41 switch (output_format) {
46 muxer = std::make_shared<PackedAudioWriter>(options);
49 muxer = std::make_shared<webm::WebMMuxer>(options);
52 muxer = std::make_shared<ttml::TtmlMuxer>(options);
54 case CONTAINER_WEBVTT:
55 muxer = std::make_shared<webvtt::WebVttMuxer>(options);
57 case CONTAINER_MPEG2TS:
58 muxer = std::make_shared<mp2t::TsMuxer>(options);
61 muxer = std::make_shared<mp4::MP4Muxer>(options);
64 LOG(ERROR) <<
"Cannot support muxing to " << output_format;
75 muxer->set_clock(clock_);
81 void MuxerFactory::OverrideClock(std::shared_ptr<Clock> clock) {
All the methods that are virtual are virtual for mocking.