Skip to content

Commit

Permalink
MacGui: show the source dynamic range, bit depth, chroma subsampling,…
Browse files Browse the repository at this point in the history
… and color code points in the source label.
  • Loading branch information
galad87 committed Apr 25, 2022
1 parent 123d7c4 commit f5f6fcd
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions macosx/HBTitle.m
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,39 @@ - (NSString *)shortFormatDescription
NSString *fps = [NSString localizedStringWithFormat:HBKitLocalizedString(@"%.6g FPS", @"Title short description -> video format"), _hb_title->vrate.num / (double)_hb_title->vrate.den];
[format appendString:fps];

NSString *dynamicRange = @"SDR";

if (_hb_title->mastering.has_primaries && _hb_title->mastering.has_luminance)
{
dynamicRange = @"HDR10";
}
else if (_hb_title->color_transfer == 16 || _hb_title->color_transfer == 18)
{
dynamicRange = @"HDR";
}

[format appendFormat:@", %@ (", dynamicRange];

int bit_depth = hb_get_bit_depth(_hb_title->pix_fmt);
if (bit_depth)
{
[format appendFormat:@"%d-bit ", hb_get_bit_depth(_hb_title->pix_fmt)];
}

int h_shift, v_shift, chroma_available;
chroma_available = hb_get_chroma_sub_sample(_hb_title->pix_fmt, &h_shift, &v_shift);
if (chroma_available == 0)
{
[format appendFormat:@"4:%d:%d", 4 - h_shift * 2, 4 - (v_shift + h_shift) * 2];
}

if (bit_depth > -1 || chroma_available == 0)
{
[format appendString:@", "];
}

[format appendFormat:@"%d-%d-%d)", _hb_title->color_prim, _hb_title->color_transfer, _hb_title->color_matrix];

hb_list_t *audioList = _hb_title->list_audio;
int audioCount = hb_list_count(audioList);

Expand Down

0 comments on commit f5f6fcd

Please sign in to comment.