Skip to content

Commit

Permalink
Revamped HLS stream classification
Browse files Browse the repository at this point in the history
HLS streams now classified by video resolution rather than bitrate.  HLS
720p streams are now all "hd" rather than using "vhd" for 50fps streams.
HLS 540p high-bitrate stream is now "sd" (also via alias "vbetter"),
even though it's not exactly SD definition for PAL.
  • Loading branch information
dinkypumpkin committed Oct 13, 2015
1 parent 45aa5a5 commit 4495ba2
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions get_iplayer
Expand Up @@ -7488,7 +7488,7 @@ sub get_stream_data {
$mobile_conn->{href} =~ s/(\*\~hmac|\,\.mp4\.csmil)/,${pc_hd_id}$1/g;
}
my $prefix;
$prefix = "hlx" if $mobile_conn->{supplier} =~ /hls_open/;
$prefix = "hlx" if $mobile_conn->{supplier} =~ /hls_open/ && $prog->{type} ne "radio";
my @hls_medias = parse_hls_connection( $mobile_media, $mobile_conn, undef, undef, $prefix );
for my $hls_media ( @hls_medias ) {
for my $hls_conn ( @{$hls_media->{connections}} ) {
Expand Down Expand Up @@ -7665,24 +7665,22 @@ sub get_stream_data {
if ( $mattribs->{kind} =~ 'video' ) {
my $pfx = $mattribs->{service} =~ /hlx/ ? "hlx" : "hls";
my $ext = "mp4";
if ( $mattribs->{bitrate} > 4000 ) {
get_stream_data_cdn( $data, $mattribs, "${pfx}vhd", 'hls', $ext );
} elsif ( $mattribs->{bitrate} > 2000 ) {
get_stream_data_cdn( $data, $mattribs, "${pfx}hd", 'hls', $ext );
} elsif ( $mattribs->{bitrate} > 1200 ) {
get_stream_data_cdn( $data, $mattribs, "${pfx}vhigh", 'hls', $ext );
} elsif ( $mattribs->{bitrate} > 700 ) {
if ( $mattribs->{height} > 700 ) {
get_stream_data_cdn( $data, $mattribs, "${pfx}hd", 'hls', $ext );
} elsif ( $mattribs->{height} > 400 ) {
if ( $mattribs->{bitrate} > 2000 ) {
get_stream_data_cdn( $data, $mattribs, "${pfx}sd", 'hls', $ext );
} else {
get_stream_data_cdn( $data, $mattribs, "${pfx}vhigh", 'hls', $ext );
}
} elsif ( $mattribs->{height} > 200 ) {
if ( $mattribs->{bitrate} > 700 ) {
get_stream_data_cdn( $data, $mattribs, "${pfx}high", 'hls', $ext );
} elsif ( $mattribs->{bitrate} > 400 ) {
get_stream_data_cdn( $data, $mattribs, "${pfx}std", 'hls', $ext );
} elsif ( $mattribs->{bitrate} > 300 ) {
get_stream_data_cdn( $data, $mattribs, "${pfx}low", 'hls', $ext );
#} elsif ( $mattribs->{bitrate} > 200 ) {
# get_stream_data_cdn( $data, $mattribs, "${pfx}vlow", 'hls', $ext );
#} elsif ( $mattribs->{bitrate} > 100 ) {
# get_stream_data_cdn( $data, $mattribs, "${pfx}vvlow", 'hls', $ext );
#} else {
# get_stream_data_cdn( $data, $mattribs, "${pfx}vvvlow", 'hls', $ext );
} elsif ( $mattribs->{bitrate} > 500 ) {
get_stream_data_cdn( $data, $mattribs, "${pfx}std", 'hls', $ext );
} elsif ( $mattribs->{bitrate} > 300 ) {
get_stream_data_cdn( $data, $mattribs, "${pfx}low", 'hls', $ext );
}
}
} elsif ( $mattribs->{kind} =~ 'audio' ) {
my $ext = "m4a";
Expand Down Expand Up @@ -7988,8 +7986,8 @@ sub modelist {
$mlist = main::expand_list($mlist, 'hls', 'hlsdefault');
$mlist = main::expand_list($mlist, 'hlsdefault', 'hlsbetter');
$mlist = main::expand_list($mlist, 'hlsvbest', 'hlsvhd,hlsbest');
$mlist = main::expand_list($mlist, 'hlsbest', 'hlshd,hlsbetter');
$mlist = main::expand_list($mlist, 'hlsvbetter', 'hlsbetter');
$mlist = main::expand_list($mlist, 'hlsbest', 'hlshd,hlsvbetter');
$mlist = main::expand_list($mlist, 'hlsvbetter', 'hlssd,hlsbetter');
$mlist = main::expand_list($mlist, 'hlsbetter', 'hlsvhigh,hlsgood');
$mlist = main::expand_list($mlist, 'hlsgood', 'hlshigh,hlsstd,hlslow');
$mlist = main::expand_list($mlist, 'hlx', 'hlxdefault');
Expand Down

0 comments on commit 4495ba2

Please sign in to comment.