Skip to content

Commit 1cd3300

Browse files
committed
Added utility to transfer color/HDR metadata from one file to another
1 parent de38d7e commit 1cd3300

17 files changed

+3819
-25
lines changed

Media/icon_videocolor.png

708 Bytes
Loading
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Drawing;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace Nmkoder.Data
9+
{
10+
public class VideoColorData
11+
{
12+
public string ColorTransfer { get; set; } = "";
13+
public string ColorMatrixCoeffs { get; set; } = "";
14+
public string ColorPrimaries { get; set; } = "";
15+
public string ColorRange { get; set; } = "";
16+
public string RedX { get; set; } = "";
17+
public string RedY { get; set; } = "";
18+
public string GreenX { get; set; } = "";
19+
public string GreenY { get; set; } = "";
20+
public string BlueX { get; set; } = "";
21+
public string BlueY { get; set; } = "";
22+
public string WhiteX { get; set; } = "";
23+
public string WhiteY { get; set; } = "";
24+
public string LumaMin { get; set; } = "";
25+
public string LumaMax { get; set; } = "";
26+
27+
public override string ToString()
28+
{
29+
return
30+
$"Colour transfer: {ColorTransfer}" +
31+
$"\nColour matrix coefficients: {ColorMatrixCoeffs}" +
32+
$"\nColour primaries: {ColorPrimaries}" +
33+
$"\nColour range: {ColorRange}" +
34+
$"\nRed colour coordinate x: {RedX}" +
35+
$"\nRed colour coordinate y: {RedY}" +
36+
$"\nGreen colour coordinate x: {GreenX}" +
37+
$"\nGreen colour coordinate y: {GreenY}" +
38+
$"\nBlue colour coordinate y: {BlueX}" +
39+
$"\nBlue colour coordinate x: {BlueY}" +
40+
$"\nWhite colour coordinate y: {WhiteX}" +
41+
$"\nWhite colour coordinate x: {WhiteY}" +
42+
$"\nMaximum luminance: {LumaMax}" +
43+
$"\nMinimum luminance: {LumaMin}";
44+
}
45+
}
46+
}

ff-utils-winforms/Forms/MainForm.Designer.cs

Lines changed: 72 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ff-utils-winforms/Forms/MainForm.Utils.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,34 @@ private void utilsMetricsConfBtn_Click(object sender, EventArgs e)
6767
UtilGetMetrics.vidHq = form.VideoHq;
6868
}
6969

70+
private void SelectColorData(object sender, EventArgs e)
71+
{
72+
currentTask = RunTask.TaskType.UtilColorData;
73+
UpdatePanels();
74+
utilsColorDataConfBtn_Click(null, null);
75+
}
76+
77+
78+
private void utilsColorDataConfBtn_Click(object sender, EventArgs e)
79+
{
80+
if (fileListBox.Items.Count < 2)
81+
{
82+
Logger.Log($"You need to load at least 2 files into the file list to use this utility!");
83+
return;
84+
}
85+
86+
Utils.UtilsColorDataForm form = new Utils.UtilsColorDataForm();
87+
form.ShowDialog();
88+
89+
if (form.DialogResult != DialogResult.OK)
90+
return;
91+
92+
UtilColorData.copyColorSpace = form.TransferColorSpace;
93+
UtilColorData.copyHdrData = form.TransferHdrData;
94+
UtilColorData.vidSrc = form.VideoSrc;
95+
UtilColorData.vidTarget = form.VideoTarget;
96+
}
97+
7098
private void SelectOcr(object sender, EventArgs e)
7199
{
72100
currentTask = RunTask.TaskType.UtilOcr;
@@ -78,6 +106,7 @@ private void UpdatePanels ()
78106
utilsBitratesPanel.BorderStyle = (currentTask == RunTask.TaskType.UtilReadBitrates) ? BorderStyle.FixedSingle : BorderStyle.None;
79107
utilsMetricsPanel.BorderStyle = (currentTask == RunTask.TaskType.UtilGetMetrics) ? BorderStyle.FixedSingle : BorderStyle.None;
80108
utilsOcrPanel.BorderStyle = (currentTask == RunTask.TaskType.UtilOcr) ? BorderStyle.FixedSingle : BorderStyle.None;
109+
utilsColorDataPanel.BorderStyle = (currentTask == RunTask.TaskType.UtilColorData) ? BorderStyle.FixedSingle : BorderStyle.None;
81110
}
82111
}
83112
}

0 commit comments

Comments
 (0)