Skip to content

Commit

Permalink
Integrated HLS/LLHLS common settings
Browse files Browse the repository at this point in the history
  • Loading branch information
getroot committed Oct 2, 2024
1 parent 1e23345 commit 0bca6d1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
#pragma once

#include "../../../common/cross_domain_support.h"
#include "dumps/dumps.h"
#include "hls_options/dvr.h"
#include "hls_options/default_query_string.h"
#include "hls_options/cache_control.h"
#include "publisher.h"

namespace cfg
Expand All @@ -24,20 +26,31 @@ namespace cfg
struct HlsPublisher : public Publisher, public cmn::CrossDomainSupport
{
protected:
bool _origin_mode = false;

int _segment_count = 5;
double _segment_duration = 10;

Dvr _dvr;
DefaultQueryString _default_query_string;
bool _create_default_playlist = true;

CacheControl _cache_control;
Dumps _dumps;
bool _server_time_based_segment_numbering = false;

public:
virtual PublisherType GetType() const override
{
return PublisherType::Hls;
}

CFG_DECLARE_CONST_REF_GETTER_OF(IsOriginMode, _origin_mode)
CFG_DECLARE_CONST_REF_GETTER_OF(IsServerTimeBasedSegmentNumbering, _server_time_based_segment_numbering)
CFG_DECLARE_CONST_REF_GETTER_OF(GetSegmentCount, _segment_count)
CFG_DECLARE_CONST_REF_GETTER_OF(GetSegmentDuration, _segment_duration)
CFG_DECLARE_CONST_REF_GETTER_OF(GetDumps, _dumps)
CFG_DECLARE_CONST_REF_GETTER_OF(GetCacheControl, _cache_control)
CFG_DECLARE_CONST_REF_GETTER_OF(GetDvr, _dvr)
CFG_DECLARE_CONST_REF_GETTER_OF(GetDefaultQueryString, _default_query_string)
CFG_DECLARE_CONST_REF_GETTER_OF(ShouldCreateDefaultPlaylist, _create_default_playlist)
Expand All @@ -48,10 +61,14 @@ namespace cfg
{
Publisher::MakeList();

Register<Optional>("OriginMode", &_origin_mode);
Register<Optional>("ServerTimeBasedSegmentNumbering", &_server_time_based_segment_numbering);
Register<Optional>("SegmentCount", &_segment_count);
Register<Optional>("SegmentDuration", &_segment_duration);
Register<Optional>("CrossDomains", &_cross_domains);
Register<Optional>("DVR", &_dvr);
Register<Optional>("Dumps", &_dumps);
Register<Optional>("CacheControl", &_cache_control);
Register<Optional>("DefaultQueryString", &_default_query_string);
Register<Optional>("CreateDefaultPlaylist", &_create_default_playlist);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
//==============================================================================
#pragma once

#include "dumps/dumps.h"
#include "hls_options/cache_control.h"
#include "hls_options/drm.h"
#include "hls_publisher.h"

Expand All @@ -24,44 +22,31 @@ namespace cfg
struct LLHlsPublisher : public HlsPublisher
{
protected:
bool _origin_mode = false;
double _chunk_duration = 0.5;
double _part_hold_back = 0; // it will be set to 3 * chunk_duration automatically
Dumps _dumps;
CacheControl _cache_control;
Drm _drm;
bool _server_time_based_segment_numbering = false;
bool _enable_preload_hint = true;
Drm _drm;

public:
PublisherType GetType() const override
{
return PublisherType::LLHls;
}

CFG_DECLARE_CONST_REF_GETTER_OF(IsOriginMode, _origin_mode)
CFG_DECLARE_CONST_REF_GETTER_OF(IsServerTimeBasedSegmentNumbering, _server_time_based_segment_numbering)
CFG_DECLARE_CONST_REF_GETTER_OF(GetChunkDuration, _chunk_duration)
CFG_DECLARE_CONST_REF_GETTER_OF(GetPartHoldBack, _part_hold_back)
CFG_DECLARE_CONST_REF_GETTER_OF(GetDumps, _dumps)
CFG_DECLARE_CONST_REF_GETTER_OF(GetCacheControl, _cache_control)
CFG_DECLARE_CONST_REF_GETTER_OF(GetDrm, _drm)
CFG_DECLARE_CONST_REF_GETTER_OF(IsPreloadHintEnabled, _enable_preload_hint)
CFG_DECLARE_CONST_REF_GETTER_OF(GetDrm, _drm)

protected:
void MakeList() override
{
HlsPublisher::MakeList();

Register<Optional>("OriginMode", &_origin_mode);
Register<Optional>("ServerTimeBasedSegmentNumbering", &_server_time_based_segment_numbering);
Register<Optional>("ChunkDuration", &_chunk_duration);
Register<Optional>("PartHoldBack", &_part_hold_back);
Register<Optional>("CrossDomains", &_cross_domains);
Register<Optional>("Dumps", &_dumps);
Register<Optional>("CacheControl", &_cache_control);
Register<Optional>("DRM", &_drm);
Register<Optional>("EnablePreloadHint", &_enable_preload_hint);
Register<Optional>("DRM", &_drm);
}
};
} // namespace pub
Expand Down

0 comments on commit 0bca6d1

Please sign in to comment.