Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpacifico authored Aug 6, 2024
1 parent 11acc06 commit 80e9d76
Show file tree
Hide file tree
Showing 11 changed files with 234 additions and 79 deletions.
6 changes: 3 additions & 3 deletions src/application/HashGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,21 @@ public HashGenerator() {
MD5.setSelected(true);
MD5.setFont(new Font(Shutter.montserratFont, Font.PLAIN, 12));
MD5.setForeground(new Color(235,235,240));
MD5.setBounds(0, 0, MD5.getPreferredSize().width, 21);
MD5.setBounds(0, 0, MD5.getPreferredSize().width + 4, 21);
panelHash.add(MD5);

SHA1 = new JRadioButton("SHA-1");
SHA1.setSelected(false);
SHA1.setFont(new Font(Shutter.montserratFont, Font.PLAIN, 12));
SHA1.setForeground(new Color(235,235,240));
SHA1.setBounds(MD5.getX() + MD5.getWidth() + 7, 0, SHA1.getPreferredSize().width, 21);
SHA1.setBounds(MD5.getX() + MD5.getWidth() + 7, 0, SHA1.getPreferredSize().width + 4, 21);
panelHash.add(SHA1);

SHA256 = new JRadioButton("SHA-256");
SHA256.setSelected(false);
SHA256.setFont(new Font(Shutter.montserratFont, Font.PLAIN, 12));
SHA256.setForeground(new Color(235,235,240));
SHA256.setBounds(SHA1.getX() + SHA1.getWidth() + 7, 0, SHA256.getPreferredSize().width, 21);
SHA256.setBounds(SHA1.getX() + SHA1.getWidth() + 7, 0, SHA256.getPreferredSize().width + 4, 21);
panelHash.add(SHA256);

panelHash.setLayout(null);
Expand Down
127 changes: 108 additions & 19 deletions src/application/Shutter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,14 @@ public void run()
}
}

//btnStart
if ((ke.getKeyCode() == KeyEvent.VK_ENTER) && ((ke.getModifiersEx() & KeyEvent.META_DOWN_MASK) != 0)
|| (ke.getKeyCode() == KeyEvent.VK_ENTER)
&& ((ke.getModifiersEx() & KeyEvent.CTRL_DOWN_MASK) != 0))
{
btnStart.doClick();
}

//Informations
if ((ke.getKeyCode() == KeyEvent.VK_I) && ((ke.getModifiersEx() & KeyEvent.META_DOWN_MASK) != 0)
|| (ke.getKeyCode() == KeyEvent.VK_I)
Expand Down Expand Up @@ -1930,11 +1938,13 @@ public void mouseReleased(MouseEvent down) {
{
screenIndex = newScreenIndex;

/*
if (comboFonctions.getSelectedItem().toString().isEmpty() == false)
{
changeFunction(false);
}

*/

Area shape1 = new Area(new AntiAliasedRoundRectangle(0, 0, frame.getWidth(), frame.getHeight(), 15, 15));
Area shape2 = new Area(new Rectangle(0, frame.getHeight()-15, frame.getWidth(), 15));
shape1.add(shape2);
Expand Down Expand Up @@ -3659,7 +3669,7 @@ else if (btnStart.getText().equals(language.getProperty("btnStopRecording")))

language.getProperty("itemEditingCodecs"), "DNxHD", "DNxHR", "Apple ProRes", "QT Animation", "GoPro CineForm" ,"Uncompressed",

language.getProperty("itemOuputCodecs"), "H.264", "H.265", "VP8", "VP9", "AV1",
language.getProperty("itemOuputCodecs"), "H.264", "H.265", "H.266", "VP8", "VP9", "AV1",

language.getProperty("itemBroadcastCodecs"), "XDCAM HD422", "XDCAM HD 35", "AVC-Intra 100", "XAVC", "HAP",

Expand Down Expand Up @@ -3695,12 +3705,6 @@ else if (btnStart.getText().equals(language.getProperty("btnStopRecording")))
comboFonctions.setRenderer(new ComboBoxRenderer());
grpChooseFunction.add(comboFonctions);

/*
if (System.getProperty("os.name").contains("Mac") && arch.equals("x86_64")) //MAC
{
comboFonctions.removeItem("H.266");
}*/

comboFonctions.addActionListener(new ActionListener() {

ArrayList<String> newList = new ArrayList<String>();
Expand Down Expand Up @@ -3753,12 +3757,13 @@ else if (comboFonctions.getSelectedItem().equals(language.getProperty("itemOuput
newList.clear();

newList.add("H.264");
newList.add("H.265");
/*
if (System.getProperty("os.name").contains("Windows") || System.getProperty("os.name").contains("Mac") && arch.equals("x86_64") == false) //MAC
newList.add("H.265");

if (System.getProperty("os.name").contains("Mac") == false || (System.getProperty("os.name").contains("Mac") && arch.equals("arm64")))
{
newList.add("H.266");
}*/
newList.add("H.266");
}

newList.add("VP8");
newList.add("VP9");
newList.add("AV1");
Expand Down Expand Up @@ -7406,7 +7411,7 @@ public void mouseExited(MouseEvent e) {

caseEnableCrop = new JCheckBox(Shutter.language.getProperty("enable"));
caseEnableCrop.setName("caseEnableCrop");
caseEnableCrop.setBounds(8, 16, caseEnableCrop.getPreferredSize().width, 23);
caseEnableCrop.setBounds(8, 16, caseEnableCrop.getPreferredSize().width + 4, 23);
caseEnableCrop.setFont(new Font(Shutter.freeSansFont, Font.PLAIN, 12));
caseEnableCrop.setSelected(false);
grpCrop.add(caseEnableCrop);
Expand Down Expand Up @@ -8782,13 +8787,43 @@ else if (caseShowTimecode.isSelected() && FFPROBE.timecode1 == "" == false)
GraphicsConfiguration gfxConfig = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
AffineTransform transform = gfxConfig.getDefaultTransform();

//Checking screen DPI
GraphicsConfiguration config = frame.getGraphicsConfiguration();
GraphicsDevice myScreen = config.getDevice();
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] allScreens = env.getScreenDevices();
int screenIndex = -1;
for (int i = 0; i < allScreens.length; i++) {
if (allScreens[i].equals(myScreen))
{
screenIndex = i;
break;
}
}

float dpiScaleFactor = 1.0f;
if (System.getProperty("os.name").contains("Windows"))
{
double trueHorizontalLines = allScreens[screenIndex].getDefaultConfiguration().getBounds().getHeight();
double scaledHorizontalLines = allScreens[screenIndex].getDisplayMode().getHeight();
dpiScaleFactor = (float) (trueHorizontalLines / scaledHorizontalLines);
}

if (System.getProperty("os.name").contains("Mac") && transform.isIdentity() == false) // false = RetinaScreen
g2.fillRect(0, 0, bounds.width, bounds.height / 2);
{
g2.fillRect(0, 0, bounds.width, bounds.height / 2);
}
else if (System.getProperty("os.name").contains("Windows"))
{
g2.fillRect(0, 0, (int) Math.round(bounds.width * dpiScaleFactor), (int) Math.round(bounds.height * dpiScaleFactor));
}
else
g2.fillRect(0, 0, bounds.width, bounds.height);

if (lblTcBackground.getText().equals(language.getProperty("aucun")))
{
g2.setColor(new Color(foregroundColor.getRed(),foregroundColor.getGreen(),foregroundColor.getBlue(), (int) ( (float) (Integer.parseInt(textNameOpacity.getText()) * 255) / 100)));
}
else
g2.setColor(foregroundColor);

Expand All @@ -8797,6 +8832,11 @@ else if (caseShowTimecode.isSelected() && FFPROBE.timecode1 == "" == false)
Integer offset = bounds.height + (int) bounds.getY();
g2.drawString(str, -2, bounds.height / 2 - offset / 2);
}
else if (System.getProperty("os.name").contains("Windows"))
{
Integer offset = bounds.height + (int) bounds.getY();
g2.drawString(str, -2 * dpiScaleFactor, (bounds.height - offset) * dpiScaleFactor);
}
else
{
Integer offset = bounds.height + (int) bounds.getY();
Expand Down Expand Up @@ -9624,8 +9664,36 @@ protected void paintComponent(Graphics g)
GraphicsConfiguration gfxConfig = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
AffineTransform transform = gfxConfig.getDefaultTransform();

//Checking screen DPI
GraphicsConfiguration config = frame.getGraphicsConfiguration();
GraphicsDevice myScreen = config.getDevice();
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] allScreens = env.getScreenDevices();
int screenIndex = -1;
for (int i = 0; i < allScreens.length; i++) {
if (allScreens[i].equals(myScreen))
{
screenIndex = i;
break;
}
}

float dpiScaleFactor = 1.0f;
if (System.getProperty("os.name").contains("Windows"))
{
double trueHorizontalLines = allScreens[screenIndex].getDefaultConfiguration().getBounds().getHeight();
double scaledHorizontalLines = allScreens[screenIndex].getDisplayMode().getHeight();
dpiScaleFactor = (float) (trueHorizontalLines / scaledHorizontalLines);
}

if (System.getProperty("os.name").contains("Mac") && transform.isIdentity() == false) // false = RetinaScreen
g2.fillRect(0, 0, bounds.width, bounds.height / 2);
{
g2.fillRect(0, 0, bounds.width, bounds.height / 2);
}
else if (System.getProperty("os.name").contains("Windows"))
{
g2.fillRect(0, 0, (int) Math.round(bounds.width * dpiScaleFactor), (int) Math.round(bounds.height * dpiScaleFactor));
}
else
g2.fillRect(0, 0, bounds.width, bounds.height);

Expand All @@ -9639,6 +9707,11 @@ protected void paintComponent(Graphics g)
Integer offset = bounds.height + (int) bounds.getY();
g2.drawString(str, -2, bounds.height / 2 - offset / 2);
}
else if (System.getProperty("os.name").contains("Windows"))
{
Integer offset = bounds.height + (int) bounds.getY();
g2.drawString(str, -2 * dpiScaleFactor, (bounds.height - offset) * dpiScaleFactor);
}
else
{
Integer offset = bounds.height + (int) bounds.getY();
Expand Down Expand Up @@ -18799,7 +18872,7 @@ else if (RenderQueue.frame != null)
}

public static void changeWidth(final boolean bigger) {

String function = comboFonctions.getSelectedItem().toString();

noSettings = false;
Expand Down Expand Up @@ -19089,7 +19162,7 @@ else if (frame.getHeight() >= screenHeight - taskBarHeight)
}

public static void resizeAll(int width, int height) {

if (frame.getWidth() >= 1130 && width >= 1130)
{
frame.setSize(width, frame.getHeight() + height);
Expand Down Expand Up @@ -19244,7 +19317,7 @@ else if (grpSetAudio.isVisible())
frame.setShape(null);
}
else
{
{
Area shape1 = new Area(new AntiAliasedRoundRectangle(0, 0, frame.getWidth(), frame.getHeight(), 15, 15));
Area shape2 = new Area(new Rectangle(0, frame.getHeight()-15, frame.getWidth(), 15));
shape1.add(shape2);
Expand All @@ -19264,6 +19337,10 @@ else if (frame.getWidth() > 332)
{
VideoPlayer.resizeAll();
}
else if (frame.getWidth() == 332)
{
statusBar.setBounds(0, frame.getHeight() - 23, frame.getWidth(), 22);
}

}

Expand Down Expand Up @@ -20505,6 +20582,18 @@ else if ("H.266".equals(comboFonctions.getSelectedItem().toString()))

if (FFMPEG.error == false)
graphicsAccel.add("AMD AMF Encoder");

/*
if (codec == "hevc")
{
FFMPEG.hwaccel("-f lavfi -i nullsrc -t 1 -c:v " + codec + "_d3d12va -s 640x360 -f null -" + '"');
do {
Thread.sleep(10);
} while (FFMPEG.runProcess.isAlive());

if (FFMPEG.error == false)
graphicsAccel.add("D3D12VA");
}*/
}
else if (System.getProperty("os.name").contains("Linux"))
{
Expand Down
2 changes: 1 addition & 1 deletion src/application/Update.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public static void newVersion(){
Document doc = Jsoup.connect("https://www.shutterencoder.com").get();

for (Element file : doc.select("a"))
{
{
if (System.getProperty("os.name").contains("Windows")) //PC
{
try {
Expand Down
18 changes: 13 additions & 5 deletions src/application/VideoPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4513,6 +4513,7 @@ public static void writeCurrentSubs(float inputTime, boolean firstSub) {
BufferedReader bufferedReader = Files.newBufferedReader(Paths.get(Shutter.subtitlesFilePath.toString()), StandardCharsets.UTF_8);
BufferedWriter bufferedWriter = Files.newBufferedWriter(Paths.get(Shutter.subtitlesFile.toString()), StandardCharsets.UTF_8);

Integer subsOffset = 0;
String line;
int subNumber = 0;
while ((line = bufferedReader.readLine()) != null)
Expand All @@ -4528,12 +4529,19 @@ public static void writeCurrentSubs(float inputTime, boolean firstSub) {
}

if (line.contains("-->") )
{
{
//Offset
if (subNumber == 1)
{
String s[] = line.split(":");
subsOffset = Integer.parseInt(s[0]);
}

String split[] = line.split("-->");
String inTimecode[] = split[0].replace(",", ":").replace(" ","").split(":");
String outTimecode[] = split[1].replace(",", ":").replace(" ","").split(":");

int inH = Integer.parseInt(inTimecode[0]) * 3600;
int inH = (Integer.parseInt(inTimecode[0]) - subsOffset) * 3600;
int inM = Integer.parseInt(inTimecode[1]) * 60;
int inS = Integer.parseInt(inTimecode[2]);
int inF = Integer.parseInt(inTimecode[3]);
Expand All @@ -4547,7 +4555,7 @@ public static void writeCurrentSubs(float inputTime, boolean firstSub) {
waveformContainer.repaint();
}

int outH = Integer.parseInt(outTimecode[0]) * 3600;
int outH = (Integer.parseInt(outTimecode[0]) - subsOffset) * 3600;
int outM = Integer.parseInt(outTimecode[1]) * 60;
int outS = Integer.parseInt(outTimecode[2]);
int outF = Integer.parseInt(outTimecode[3]);
Expand Down Expand Up @@ -5465,7 +5473,7 @@ else if (FFPROBE.totalLength > 40 && Shutter.caseEnableSequence.isSelected() ==
}

public static void resizeAll() {

if (Shutter.frame.getWidth() > 332 && Shutter.doNotLoadImage == false)
{
//Clear the buffer
Expand Down Expand Up @@ -5827,7 +5835,7 @@ else if (FFPROBE.totalLength <= 40)
{
refreshTimecodeAndText();
}

Shutter.statusBar.setBounds(0, Shutter.frame.getHeight() - 23, Shutter.frame.getWidth(), 22);

if (Shutter.frame.getWidth() >= 1130)
Expand Down
10 changes: 5 additions & 5 deletions src/functions/ReplaceAudio.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void run() {
if (liste.getSize() >= 2)
{
for (int i = 0 ; i < liste.getSize() ; i++)
{
{
//Ignore mute tracks
if (liste.getElementAt(i).contains("lavfi") == false)
{
Expand All @@ -150,14 +150,14 @@ public void run() {
else
{
shortestLength = FFPROBE.totalLength;
}
}
}

//Start batch replace
if (videoStream > 1)
{
for (int i = 0 ; i < liste.getSize() ; i++)
{
{
if (videoStream == liste.getSize()) //only video files in the list
{
videoFile = new File(liste.getElementAt(i));
Expand Down Expand Up @@ -204,7 +204,7 @@ else if (caseChangeAudioCodec.isSelected())
continue;
}
}

//Start replacement
main(audioFiles, audioExt, videoFile);

Expand Down Expand Up @@ -304,7 +304,7 @@ else if (caseChangeAudioCodec.isSelected())
main(audioFiles, audioExt, videoFile);
}

} catch (InterruptedException e1) {
} catch (InterruptedException e1) {
FFMPEG.error = true;
}
}
Expand Down
Loading

0 comments on commit 80e9d76

Please sign in to comment.