Linux-DVB-DVBT-Advert
view release on metacpan or search on metacpan
lib/Linux/DVB/DVBT/Advert.pm view on Meta::CPAN
# #dump_frames(\@banner_frames, "All BANNER frames") if (@banner_frames) ;
# #dump_frames(\@audio_frames, "All AUDIO frames") if (@audio_frames) ;
# }
## Analysis results
my @black_cut_list ;
my @silent_cut_list ;
my @logo_cut_list ;
## Settings
my $global_settings_href = Linux::DVB::DVBT::Advert::Config::cascade_settings($extra_settings_href, '', $results_settings_href) ;
my $black_settings_href = Linux::DVB::DVBT::Advert::Config::cascade_settings($extra_settings_href, 'frame', $results_settings_href) ;
my $logo_settings_href = Linux::DVB::DVBT::Advert::Config::cascade_settings($extra_settings_href, 'logo', $results_settings_href) ;
my $silent_settings_href = Linux::DVB::DVBT::Advert::Config::cascade_settings($extra_settings_href, 'audio', $results_settings_href) ;
# return cascaded settings
$results_href->{'settings'} = {
$global_settings_href,
'frame' => $black_settings_href,
'logo' => $logo_settings_href,
'audio' => $silent_settings_href,
} ;
my $rise_thresh = $logo_settings_href->{'logo_rise_threshold'} || 1 ;
my $fall_thresh = $logo_settings_href->{'logo_fall_threshold'} || 1 ;
lib/Linux/DVB/DVBT/Advert/Config.pm view on Meta::CPAN
{
$href->{$var} = parse_value($var, $val) ;
}
}
}
#----------------------------------------------------------------------
# Need to copy globals down to key (if not already set), then use defaults
# if neither set
#
sub cascade_settings
{
my ($settings_href, $key, $defaults_href) = @_ ;
$settings_href ||= {} ;
$defaults_href ||= {} ;
my $cascaded_href = {} ;
print Data::Dumper->Dump(["cascade_settings($key) IN:", $settings_href, "DEFAULTS:", $defaults_href]) if $DEBUG >= 10 ;
## start with defaults as a baseline
if ($key && exists($defaults_href->{$key}))
{
_hash_copy_shallow($defaults_href->{$key}, $cascaded_href) ;
}
else
{
_hash_copy_shallow($defaults_href, $cascaded_href) ;
}
## copy over any settings defined in the global namespace
_hash_copy_shallow($settings_href, $cascaded_href) ;
## copy over any settings defined in the key's namespace
if ($key && exists($settings_href->{$key}))
{
_hash_copy_shallow($settings_href->{$key}, $cascaded_href) ;
}
else
{
_hash_copy_shallow($settings_href, $cascaded_href) ;
}
print Data::Dumper->Dump(["cascade_settings($key) OUT:", $cascaded_href]) if $DEBUG >= 10 ;
return $cascaded_href ;
}
#----------------------------------------------------------------------
# Do a deep copy of one HASH heirarchy of settings onto another
# List of settings starting with lowest priority
#
sub merge_settings
{
my (@settings_list) = @_ ;
lib/Linux/DVB/DVBT/Advert/Config.pm view on Meta::CPAN
#
sub channel_settings
{
my ($advert_settings_href, $channel) = @_ ;
$channel ||= "" ;
$channel =~ s/^['"](.*)['"]$/$1/ ;
print Data::Dumper->Dump(["channel_settings($channel) IN:", $advert_settings_href]) if $DEBUG >= 10 ;
my $cascaded_href = {} ;
## Get copy of globals
_hash_copy_deep($advert_settings_href->{$ADVERT_GLOBAL_SECTION}, $cascaded_href);
## If channel specified, overwrite globals with channel-specific
if ($channel && exists($advert_settings_href->{$channel}))
{
_hash_copy_deep($advert_settings_href->{$channel}, $cascaded_href);
## Insert channel name into settings
$cascaded_href->{'channel'} = $channel ;
}
print Data::Dumper->Dump(["channel_settings($channel) OUT:", $cascaded_href]) if $DEBUG >= 10 ;
return $cascaded_href ;
}
# ============================================================================================
# ============================================================================================
#---------------------------------------------------------------------------------
# Copy key values from one hash into another. Follow a single depth of hierarchy for any
( run in 0.530 second using v1.01-cache-2.11-cpan-49f99fa48dc )