diff --git a/src/application/Shutter.java b/src/application/Shutter.java index f83ce338..5c301573 100644 --- a/src/application/Shutter.java +++ b/src/application/Shutter.java @@ -374,6 +374,7 @@ public class Shutter { protected static JCheckBox caseDecimate; protected static JCheckBox caseConform; protected static JCheckBox caseCreateTree; + protected static JComboBox comboCreateTree; protected static JCheckBox casePreserveMetadata; protected static JCheckBox casePreserveSubs; protected static JCheckBox caseCreateOPATOM; @@ -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("{codec/function}
{preset}
{resolution/scale}
{width}
{height}
{ratio/aspect}
{framerate/fps}
{bitrate}
{duration/time}
{date}"); + txtExtension.setToolTipText("{codec/function}
{preset}
{resolution/scale}
{width}
{height}
{ratio/aspect}
{framerate/fps}
{bitrate}
{timecode}
{duration/time}
{date}"); destination1.add(txtExtension); btnExtension.addActionListener(new ActionListener() { @@ -15680,7 +15681,8 @@ public void actionPerformed(ActionEvent arg0) { if (caseCreateTree.isSelected()) { - setDestinationTabs(2); + setDestinationTabs(2); + comboCreateTree.setEnabled(true); } else { @@ -15696,10 +15698,29 @@ public void actionPerformed(ActionEvent arg0) { else setDestinationTabs(5); } + + comboCreateTree.setEnabled(false); } } }); + comboCreateTree = new JComboBox(); + 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(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)); @@ -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); @@ -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 @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); diff --git a/src/application/VideoPlayer.java b/src/application/VideoPlayer.java index 75f58fc4..a1c4e200 100644 --- a/src/application/VideoPlayer.java +++ b/src/application/VideoPlayer.java @@ -713,7 +713,7 @@ public void run() { //Read 1 video frame if (playerCurrentFrame >= offsetVideo) { - frameVideo = ImageIO.read(videoInputStream); + frameVideo = ImageIO.read(videoInputStream); playerRepaint(); fps ++; } @@ -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)); @@ -750,8 +750,7 @@ else if (playerPlayVideo) } } else - { - + { if (line!= null && closeAudioStream && sliderChange == false && frameControl == false) { line.flush(); @@ -765,7 +764,7 @@ else if (playerPlayVideo) } while (playerLoop == false && playerVideo.isAlive()); } } while (playerVideo.isAlive()); - + try { video.close(); } catch (IOException e) {} @@ -888,7 +887,7 @@ public static void playerRepaint() { player.repaint(); getTimePoint(playerCurrentFrame); } - } + } } public static boolean playerIsPlaying() { @@ -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() { @@ -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;