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 Sep 9, 2024
1 parent e20b86f commit 2c170f1
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 47 deletions.
46 changes: 43 additions & 3 deletions src/application/Shutter.java
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ public class Shutter {
protected static JCheckBox caseDecimate;
protected static JCheckBox caseConform;
protected static JCheckBox caseCreateTree;
protected static JComboBox<String> comboCreateTree;
protected static JCheckBox casePreserveMetadata;
protected static JCheckBox casePreserveSubs;
protected static JCheckBox caseCreateOPATOM;
Expand Down Expand Up @@ -5025,7 +5026,7 @@ public void keyReleased(KeyEvent e) {
txtExtension.setEnabled(false);
txtExtension.setFont(new Font("SansSerif", Font.PLAIN, 12));
txtExtension.setBounds(btnExtension.getLocation().x + btnExtension.getWidth() + 6, btnExtension.getLocation().y + 1, grpDestination.getWidth() - (btnExtension.getLocation().x + btnExtension.getWidth()) - 18, 21);
txtExtension.setToolTipText("<html>{codec/function}<br>{preset}<br>{resolution/scale}<br>{width}<br>{height}<br>{ratio/aspect}<br>{framerate/fps}<br>{bitrate}<br>{duration/time}<br>{date}</html>");
txtExtension.setToolTipText("<html>{codec/function}<br>{preset}<br>{resolution/scale}<br>{width}<br>{height}<br>{ratio/aspect}<br>{framerate/fps}<br>{bitrate}<br>{timecode}<br>{duration/time}<br>{date}</html>");
destination1.add(txtExtension);

btnExtension.addActionListener(new ActionListener() {
Expand Down Expand Up @@ -15680,7 +15681,8 @@ public void actionPerformed(ActionEvent arg0) {

if (caseCreateTree.isSelected())
{
setDestinationTabs(2);
setDestinationTabs(2);
comboCreateTree.setEnabled(true);
}
else
{
Expand All @@ -15696,10 +15698,29 @@ public void actionPerformed(ActionEvent arg0) {
else
setDestinationTabs(5);
}

comboCreateTree.setEnabled(false);
}
}
});

comboCreateTree = new JComboBox<String>();
comboCreateTree.setName("comboCreateTree");
comboCreateTree.setEnabled(false);
comboCreateTree.setMaximumRowCount(15);

String[] levels = new String[11];
for (int i = 0 ; i < 11 ; i++)
{
levels[i] = String.valueOf(i);
}

comboCreateTree.setModel(new DefaultComboBoxModel<String>(levels));
comboCreateTree.setSelectedIndex(0);
comboCreateTree.setFont(new Font(freeSansFont, Font.PLAIN, 10));
comboCreateTree.setEditable(false);
comboCreateTree.setSize(35, 16);

casePreserveMetadata = new JCheckBox(language.getProperty("casePreserveMetadata"));
casePreserveMetadata.setName("casePreserveMetadata");
casePreserveMetadata.setFont(new Font(freeSansFont, Font.PLAIN, 12));
Expand Down Expand Up @@ -19609,6 +19630,8 @@ else if (language.getProperty("functionRewrap").equals(function) || language.get
grpAdvanced.add(casePreserveSubs);
caseCreateTree.setLocation(7, casePreserveSubs.getLocation().y + 17);
grpAdvanced.add(caseCreateTree);
comboCreateTree.setLocation(caseCreateTree.getX() + caseCreateTree.getWidth() + 4, caseCreateTree.getY() + 3);
grpAdvanced.add(comboCreateTree);
casePreserveMetadata.setLocation(7, caseCreateTree.getLocation().y + 17);
grpAdvanced.add(casePreserveMetadata);

Expand Down Expand Up @@ -19817,6 +19840,8 @@ else if (language.getProperty("functionMerge").equals(function))
grpAdvanced.setLocation(grpAdvanced.getX(), grpSetAudio.getSize().height + grpSetAudio.getLocation().y + 6);
caseCreateTree.setLocation(7, caseLRA.getLocation().y + 17);
grpAdvanced.add(caseCreateTree);
comboCreateTree.setLocation(caseCreateTree.getX() + caseCreateTree.getWidth() + 4, caseCreateTree.getY() + 3);
grpAdvanced.add(comboCreateTree);
btnReset.setLocation(btnReset.getX(), grpAdvanced.getSize().height + grpAdvanced.getLocation().y + 6);
}
else
Expand Down Expand Up @@ -19878,6 +19903,8 @@ else if (comboFonctions.getSelectedItem().toString().equals("Opus"))
grpAdvanced.setVisible(true);
caseCreateTree.setLocation(7, 14);
grpAdvanced.add(caseCreateTree);
comboCreateTree.setLocation(caseCreateTree.getX() + caseCreateTree.getWidth() + 4, caseCreateTree.getY() + 3);
grpAdvanced.add(comboCreateTree);
caseDRC.setLocation(7, caseCreateTree.getLocation().y + 17);
grpAdvanced.add(caseDRC);
grpAdvanced.setLocation(grpAdvanced.getX(), grpTransitions.getSize().height + grpTransitions.getLocation().y + 6);
Expand Down Expand Up @@ -20533,6 +20560,8 @@ public void run() {
caseCreateTree.setLocation(7, caseForcerInversion.getLocation().y + 17);
}
grpAdvanced.add(caseCreateTree);
comboCreateTree.setLocation(caseCreateTree.getX() + caseCreateTree.getWidth() + 4, caseCreateTree.getY() + 3);
grpAdvanced.add(comboCreateTree);

casePreserveMetadata.setLocation(7, caseCreateTree.getLocation().y + 17);
grpAdvanced.add(casePreserveMetadata);
Expand Down Expand Up @@ -21115,6 +21144,8 @@ else if ("H.266".equals(function))
grpAdvanced.add(lblIsConform);
caseCreateTree.setLocation(7, caseConform.getLocation().y + 17);
grpAdvanced.add(caseCreateTree);
comboCreateTree.setLocation(caseCreateTree.getX() + caseCreateTree.getWidth() + 4, caseCreateTree.getY() + 3);
grpAdvanced.add(comboCreateTree);
casePreserveMetadata.setLocation(7, caseCreateTree.getLocation().y + 17);
grpAdvanced.add(casePreserveMetadata);
casePreserveSubs.setLocation(7, casePreserveMetadata.getLocation().y + 17);
Expand Down Expand Up @@ -21670,6 +21701,8 @@ else if ("MPEG-1".equals(function) || "MPEG-2".equals(function))
grpAdvanced.add(lblIsConform);
caseCreateTree.setLocation(7, caseConform.getLocation().y + 17);
grpAdvanced.add(caseCreateTree);
comboCreateTree.setLocation(caseCreateTree.getX() + caseCreateTree.getWidth() + 4, caseCreateTree.getY() + 3);
grpAdvanced.add(comboCreateTree);
casePreserveMetadata.setLocation(7, caseCreateTree.getLocation().y + 17);
grpAdvanced.add(casePreserveMetadata);
casePreserveSubs.setLocation(7, casePreserveMetadata.getLocation().y + 17);
Expand Down Expand Up @@ -22107,7 +22140,9 @@ else if (comboFilter.getSelectedItem().toString().equals(".gif") || comboFilter.
grpAdvanced.removeAll();
grpAdvanced.setVisible(true);
caseCreateTree.setLocation(7, 14);
grpAdvanced.add(caseCreateTree);
grpAdvanced.add(caseCreateTree);
comboCreateTree.setLocation(caseCreateTree.getX() + caseCreateTree.getWidth() + 4, caseCreateTree.getY() + 3);
grpAdvanced.add(comboCreateTree);
grpAdvanced.setLocation(grpAdvanced.getX(), grpImageFilter.getSize().height + grpImageFilter.getLocation().y + 6);

btnReset.setLocation(btnReset.getX(), grpAdvanced.getSize().height + grpAdvanced.getLocation().y + 6);
Expand Down Expand Up @@ -23385,6 +23420,11 @@ public static void enableAll() {
components[i].setEnabled(true);
}

if (caseCreateTree.isSelected() == false)
{
comboCreateTree.setEnabled(false);
}

components = grpBitrate.getComponents();
for (int i = 0; i < components.length; i++) {
components[i].setEnabled(true);
Expand Down
84 changes: 40 additions & 44 deletions src/application/VideoPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ public void run() {
//Read 1 video frame
if (playerCurrentFrame >= offsetVideo)
{
frameVideo = ImageIO.read(videoInputStream);
frameVideo = ImageIO.read(videoInputStream);
playerRepaint();
fps ++;
}
Expand All @@ -733,7 +733,7 @@ else if (playerPlayVideo)
long delay = startTime - System.nanoTime();

if (delay > 0)
{
{
//Because the next loop is very cpu intensive but accurate, this sleep reduce the cpu usage by waiting just less than needed
try {
Thread.sleep((int) (delay / 1500000));
Expand All @@ -750,8 +750,7 @@ else if (playerPlayVideo)
}
}
else
{

{
if (line!= null && closeAudioStream && sliderChange == false && frameControl == false)
{
line.flush();
Expand All @@ -765,7 +764,7 @@ else if (playerPlayVideo)
} while (playerLoop == false && playerVideo.isAlive());
}
} while (playerVideo.isAlive());

try {
video.close();
} catch (IOException e) {}
Expand Down Expand Up @@ -888,7 +887,7 @@ public static void playerRepaint() {
player.repaint();
getTimePoint(playerCurrentFrame);
}
}
}
}

public static boolean playerIsPlaying() {
Expand All @@ -903,7 +902,7 @@ public static boolean playerIsPlaying() {

public static void playerSetTime(float time) {

if ((setTime == null || setTime.isAlive() == false && frameVideo != null) && playerThread != null && Shutter.doNotLoadImage == false && time < totalFrames - 2 && videoPath != null)
if ((setTime == null || setTime.isAlive() == false) && playerThread != null && Shutter.doNotLoadImage == false && time < totalFrames - 2 && videoPath != null)
{
setTime = new Thread(new Runnable() {

Expand Down Expand Up @@ -1034,46 +1033,43 @@ else if (framesToSkip != 0 || (framesToSkip == 0 && mouseIsPressed == false)) //
playback = true;
}
else
playback = false;

if (frameVideo != null)
{
playerStop();
do {
try {
Thread.sleep(1);
} catch (InterruptedException e) {}
} while (playerThread.isAlive());
playback = false;

playerStop();
do {
try {
Thread.sleep(1);
} catch (InterruptedException e) {}
} while (playerThread.isAlive());

frameControl = true; //IMPORTANT to stop the player loop
frameIsComplete = false;
playerLoop = true;
playerProcess(t);

long time = System.currentTimeMillis();

do {

try {
Thread.sleep(1);
} catch (InterruptedException e) {}

frameControl = true; //IMPORTANT to stop the player loop
frameIsComplete = false;
playerLoop = true;
playerProcess(t);

long time = System.currentTimeMillis();
if (frameVideo == null || System.currentTimeMillis() - time > 5000)
frameIsComplete = true;

} while (frameIsComplete == false);

do {

try {
Thread.sleep(1);
} catch (InterruptedException e) {}

if (System.currentTimeMillis() - time > 5000)
frameIsComplete = true;

} while (frameIsComplete == false);

if (playback && mouseIsPressed == false)
{
playerLoop = true;
}
else
playerLoop = false;

playerCurrentFrame = t;
getTimePoint(playerCurrentFrame);
Shutter.timecode.repaint();
if (playback && mouseIsPressed == false)
{
playerLoop = true;
}
else
playerLoop = false;

playerCurrentFrame = t;
getTimePoint(playerCurrentFrame);
Shutter.timecode.repaint();

frameControl = false;
playerPlayVideo = true;
Expand Down

0 comments on commit 2c170f1

Please sign in to comment.