2022-08-26 15:44:59 +00:00
|
|
|
// Copyright 2017 Google LLC. All rights reserved.
|
2018-01-03 18:16:08 +00:00
|
|
|
//
|
|
|
|
// 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_APP_MUXER_FACTORY_H_
|
|
|
|
#define PACKAGER_APP_MUXER_FACTORY_H_
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
|
2023-10-10 23:51:11 +00:00
|
|
|
#include <packager/media/base/container_names.h>
|
2023-10-14 16:36:01 +00:00
|
|
|
#include <packager/mp4_output_params.h>
|
2023-10-10 23:51:11 +00:00
|
|
|
#include <packager/mpd/base/mpd_builder.h>
|
2018-01-03 18:16:08 +00:00
|
|
|
|
|
|
|
namespace shaka {
|
|
|
|
struct PackagingParams;
|
|
|
|
struct StreamDescriptor;
|
|
|
|
|
|
|
|
namespace media {
|
|
|
|
|
|
|
|
class Muxer;
|
|
|
|
class MuxerListener;
|
|
|
|
|
|
|
|
/// To make it easier to create muxers, this factory allows for all
|
|
|
|
/// configuration to be set at the factory level so that when a function
|
|
|
|
/// needs a muxer, it can easily create one with local information.
|
|
|
|
class MuxerFactory {
|
|
|
|
public:
|
|
|
|
MuxerFactory(const PackagingParams& packaging_params);
|
|
|
|
|
|
|
|
/// Create a new muxer using the factory's settings for the given
|
|
|
|
/// stream.
|
|
|
|
std::shared_ptr<Muxer> CreateMuxer(MediaContainerName output_format,
|
|
|
|
const StreamDescriptor& stream);
|
|
|
|
|
|
|
|
/// For testing, if you need to replace the clock that muxers work with
|
|
|
|
/// this will replace the clock for all muxers created after this call.
|
2023-09-09 00:44:17 +00:00
|
|
|
void OverrideClock(Clock* clock);
|
2018-01-03 18:16:08 +00:00
|
|
|
|
2021-08-04 18:56:44 +00:00
|
|
|
void SetTsStreamOffset(int32_t offset_ms) {
|
2020-07-30 21:26:45 +00:00
|
|
|
transport_stream_timestamp_offset_ms_ = offset_ms;
|
|
|
|
}
|
|
|
|
|
2018-01-03 18:16:08 +00:00
|
|
|
private:
|
|
|
|
MuxerFactory(const MuxerFactory&) = delete;
|
|
|
|
MuxerFactory& operator=(const MuxerFactory&) = delete;
|
|
|
|
|
2018-07-03 23:52:05 +00:00
|
|
|
const Mp4OutputParams mp4_params_;
|
|
|
|
const std::string temp_dir_;
|
2021-08-04 18:56:44 +00:00
|
|
|
int32_t transport_stream_timestamp_offset_ms_ = 0;
|
2023-09-09 00:44:17 +00:00
|
|
|
Clock* clock_ = nullptr;
|
2018-01-03 18:16:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace media
|
|
|
|
} // namespace shaka
|
|
|
|
|
|
|
|
#endif // PACKAGER_APP_MUXER_FACTORY_H_
|