MovieLibrary
Class VidPlayer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by MovieLibrary.VidPlayer
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ComponentListener, java.awt.event.ItemListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener, javax.swing.event.ListSelectionListener, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class VidPlayer
extends javax.swing.JFrame
implements java.awt.event.ActionListener, java.awt.event.WindowListener, java.awt.event.ComponentListener, java.beans.PropertyChangeListener, java.awt.event.ItemListener, javax.swing.event.ChangeListener, javax.swing.event.ListSelectionListener

Main Video Player class,
This class creates a Video Player where everything will be ran from
Main program contained inside a JFrame

Author:
Alex Della-Croce
See Also:
Serialized Form

Nested Class Summary
 class VidPlayer.ImportVideosTask
           
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 boolean demoVersion
           
 
Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
VidPlayer()
          Video Player constructor
Creates and displays the GUI
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void addAllToConvert()
          This method adds all the videos in the library to be converted with the selected conversion profile.
A conversion job for each video will be created with the same conversion profile each time.
 boolean addConvertedVideoToLibrary()
          This method adds the converted final video to the library
 void addToConvert()
          This method is used to add the selected video to be converted.
The video will be added into a converting job in the conversion list.
 boolean addToConvert(java.io.File jobToAddFile)
          Method to add a job to the batch list from a saved job file
 boolean audioAmp()
          This method is used to run the appropriate methods and external programs in order to increase the sound amplitude for an avi or mp4 (h264 video)
 void autoCropDetect(int mode)
          This method is used to detect crop values automatically
To do that the video is analysed, the length of the video is obtained.
Then a crop values detection is executed at 10 different places throughout the video
If manualCropSettings are chosen this method does not detect auto crop values.
The autoCrop values are then stored in the autocropvalues array for use during conversion passes.
 void calculatorCalculate()
          This method is used to calculate various information about a video file with respect to file size, bitrate, video width and height.
 void cancelCurrentConversion()
          Cancels the current convertion, checks first if a conversion is in progress then changes the conversion state to false to be specific not converting and destroys the convertion process and calls the deleteIncompleteFile() method to delete incomplete files.
 void changeConfig()
          Method to check the current preferences and save any changes when the window is closed.
This method creates a separate JFrame and displays all the preferences inside it, a window listener as been added to that frame to check when the window is closed.
 void changeMediaPlayerLocation()
          Opens a JFileChooser for the user to select a media player.
ExeFileFilter applied to only let the user select an executable file.
Selected executable file path stored as media player path if not null.
Message given to stdout otherwise.
 boolean checkFilePath(java.lang.String fileName)
          This method is used to check if the given file exists
 void checkScale()
          This method is used to check the correct scale of a video to be converted.
This method will call an external program which will simulate playback in the background to check the aspect ratio and scale.
 void checkVersion()
           
 void close3GPSettings()
          This method is used to close the 3gp settings window.
 void closeDVDSettings()
          This method is used to close the DVD settings window.
 void closeFFMPEGSettings()
          This method is used to close the FFMPEG settings window.
 void closeFlashSettings()
          This method is used to close the Flash settings window.
 void closeH264Settings()
          This method is used to close the H264 settings window.
 void closeiPodSettings()
          This method is used to close the iPod settings window.
 void closeMencoderSettings()
          This method is used to close the Mencoder settings window.
 void closeMjpegSettings()
          This method is used to close the MJPEG settings window.
 void closeProfileChoiceWindow()
          This method is used to close the profile choice window.
Closed only if auto crop detection is not running.
 void closePSPSettings()
          This method is used to close the Zune settings window.
 void closeWMVSettings()
          This method is used to close the wmv settings window.
 void closeXvidSettings()
          This method is used to close the Xvid settings window.
 void closeZuneSettings()
          This method is used to close the Zune settings window.
 void componentHidden(java.awt.event.ComponentEvent arg0)
           
 void componentMoved(java.awt.event.ComponentEvent arg0)
           
 void componentResized(java.awt.event.ComponentEvent arg0)
          This method is used to stop the user resizing thw main window to a smaller size than reasonable.
 void componentShown(java.awt.event.ComponentEvent arg0)
           
 void conversionLog()
          This method creates and shows the conversion log window which is used to display information about a conversion process while it is being converted.
This is a JFrame with a JTextArea inside a JScrollPane where the information will be added during conversion.
 void convertSelectedVideos()
          This method is used to start the conversion process for the selected video.
If no video selected or no video in library message given to the user.
 boolean convertTheNextVideo()
          This method is called to use any of the conversion profiles to convert a video to the chosen profile
 VideoObject convertVideoType(VideoObject objectToConvert)
          This method converts a video from its original video type to the video type selected in the tag edit box.
 void createMenu()
          Method that build the PopupMenu and the menu bar.
Once the menus are built they are added to the main window.
Action Listeners added to the menus to listen to menu selections.
 void deleteAllConvertJobs()
          delete all jobs from batch jobs list
 void deleteAllVideos()
          Asks for confirmation from the user then deletes all the videos in the library and then updates the table
 void deleteConvertJob()
          This method is used to delete a conversion job from the conversion list
 void deleteIncompleteFile()
          This method deletes any incomplete file from a conversion termination.
 void deleteLogs()
           
 boolean deleteVideo()
          This method asks the user to confirm if they want to delete the selected video then deletes it if confirmed.
 void disableConvertJob()
           
 void displayMessage(java.lang.String msg)
          Displays the given message in the JLabel shown at the bottom of the JFrame.
A timer is created and the message will be shown for a few seconds then the previous information shown in the label is restored.
 void editor(int startVideoEditIndex)
          This method creates a separate JFrame with JTextField and JComboBox so the user can change the information for the current video being edited.
 boolean editVideo()
          Method to edit the tag of the selected video if any is selected.
 void enableConvertJob()
           
 void encoding3GP()
          This method calls the appropriate methods and external program to undertake the convertion of the video to convert under a 3gpp conversion specifications.
 void encodingDVD()
           
 boolean exportLibrary()
          Method to export the current library to a XML file at the location and with the name selected by the user.
This method opens a JFileChooser so the user can select where he wants to save the library and what he wants to call it.
Filename is checked for validity and corrected, once valid the export library method is called which will write the values to file.
 void fillTable()
          This method fills in the main window table with all the information stored in the library.
Any hidden files will be restored and invalid links will not be indicated anymore
 void firstPassEncoding()
          This method calls the necessary methods and program to convert the first pass of the video to be converted
 java.lang.Process getAudioAmpProcess()
          This method returns the process for audio amplitude increase
 javax.swing.JComboBox getCodecBox()
           
 void getInfoFromMP4(VideoObject mp4ToTag)
          NOT YET IMPLEMENTED, but this will be used to read the meta data from mp4 files to update the video information from it.
 java.lang.String getManualVidConvFPS()
           
 java.lang.String getRegTo()
          Method to return who the program is registered to
 java.lang.String getTimeTaken(long reqStartTime, long reqEndTime)
          This method is used to calculate the elapsed time between the given start time and end time.
The output will be given as a string separating the hours, minutes, seconds and milliseconds.
 DroppableTable getVideoListTable()
          Method to return the droppable main table
 void importJobs()
           
 boolean importLibrary()
          Import library method to import a library from file to the current library.
Reads values from XML library file then imports videos to library.
 void importVideos()
           
 void itemStateChanged(java.awt.event.ItemEvent e)
           
 boolean licenseIsValid()
          Method to check if the license for the program is valid or not.
Opens the license file, checks the key and if the key is valid, returns true otherwise returns false.
 void locateMediaFolder()
          Locate media player method, opens a JFileChooser for the user to select a directory.
The selected folder is then saved as the media folder if not null.
static void main(java.lang.String[] args)
          main method for Video player, calls the constructor for video player which builds and displays the GUI.
 void manualCropDetect()
          This method is used to detect crop values automatically
To do that the video is analysed, the length of the video is obtained.
Then a crop values detection is executed at 10 different places throughout the video
If manualCropSettings are chosen this method does not detect auto crop values.
The autoCrop values are then stored in the autocropvalues array for use during conversion passes.
 boolean mergeVideos()
          This method is used to merge multiple avi files together as long as they have similar settings such as dimensions and bitrate.
 java.lang.String mp4Muxing(java.lang.String videoToConvert)
          This method is used to mux and avi file with codecs (aac and h264) to a quicktime compatible mp4 file
 void openMediaPlayer(java.lang.String requiredFileName)
          This method is used to open the selected video with the selected media player.
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
 java.lang.String rawTranscode()
          This method transcodes a VOB file to mpeg to solve problem with timestamps so that subtitles are not our of sync
 void resetFilters()
          This method resets the media lirary filters, therefore deletes all the values in the filters and inputs the default values to show all possible values.
 void saveAllmp4Tags()
          This method creates and runs a TaggingTask to save the video information from the library to each individual video files for multiple items.
 boolean saveEditorToLibrary()
          Saves the information edited in the editor to the library, changes will then become final.
 boolean savemp4Tag()
          This method calls the setInfoToMP4() to save the video information from the selected video to its metadata within the mp4 file.
The video file has to be an mp4.
 void secondPassEncoding()
          This method calls the necessary methods and program to convert the second pass of the video to be converted
 void setColumnWidthManualChange(boolean changeStatus)
           
 void setInfoToMP4(VideoObject mp4ToTag)
          Method to save the video information from the library to the metadata within the video file if the video file is an mp4.
The video information will then be available if you import it into any program that supports reading metadata information (such as itunes, quicktime).
 void setProfileCropAndScale()
          This method calls various methods from the ConversionProfile being used to set various information about scaling and cropping for the video being converted
 void setProgressBarFrameOnTop(boolean progressBarState)
           
 void setProgressBarMaxSize(int reqMaxSize)
          This method is used to set the maximum size of the progress bar used to show the system is busy doing something.
 void setProgressFinished()
          Method to set the progress to 100%, task finished.
 void setSystemBusy()
          Sets the system to busy so that the user has to wait for the critical function to be completed before having access to the program.
Windows are all disabled appart from the dialo opened which shows the progress throughout the task's execution.
 void setSystemNormal()
          Method to restore the system back to its normal state.
Called when the system has finished the critical function.
 void showAudioAmpTool()
          This method is used to show the audio amplification tool used to increase the amplitude of videos of avi or mp4 format.
 void showCalculator()
          This method is used to create and display the calculator window.
The calculator is used to calculate bitrate or filesize for given settings.
 void showConversionList(int mode)
          This methos createa and shows the conversion list window, this JFrame displays a list of convertion jobs to convert or being converted.
Information about the job completion is also shown in the list.
 void showConversionProfiles()
          This method is used to create and show the window that displays the conversion profiles and the information for the selected profile.
 void showCustom3GPSettings()
          This method is used to show the ipod custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the ipod profile for conversion.
 void showCustomAVCiPodSettings()
          This method is used to show the ipod custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the ipod profile for conversion.
 void showCustomAVCPSPSettings()
          This method is used to show the PSP custom AVC settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the PSP AVC profile for conversion.
 void showCustomDVDSettings()
           
 void showCustomFFMpegSettings()
          This method is used to show the FFMPEG custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the FFMPEG profile for conversion.
 void showCustomFlashSettings()
          This method is used to show the Flash custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the Flash profile for conversion.
 void showCustomH264Settings()
          This method is used to show the H264 custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the H264 codec for conversion.
 void showCustomiPodSettings()
          This method is used to show the ipod custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the ipod profile for conversion.
 void showCustomMencoderSettings()
          This method is used to show the Mencoder custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the Mencoder profile for conversion.
 void showCustomMjpegGENSettings()
          This method is used to show the MJPEG custom general settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the MJPEG profile for conversion.
 void showCustomPSPSettings()
          This method is used to show the psp mpeg4 custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the psp profile for conversion.
 void showCustomWinMediaSettings()
          This method is used to show the wmv custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the wmv profile for conversion.
 void showCustomXvidSettings()
          This method is used to show the Xvid settings window where the user can select the settings to be used with the Xvid codec.
 void showCustomZuneSettings()
          This method is used to show the zune custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the zune profile for conversion.
 void showImportDetails(java.lang.Object[][] importedInfo)
          This method opens up a JPanel on the right hand side of the main window to show the database info found for the objects imported or the objects selected for information update
 void showMencoderHelpScreen()
          This method is used to create and display the Mencoder settings help screen.
This screen will show help about codecs and encoding settings..
 void showMergeAVITool()
          This method is used to create and show the JFrame merge tool for merging multiple avi files together.
 void showPreview()
          This method is used to display a preview in a separate window of the settings chosen for conversion with regard, to scalling and cropping and any video filters that might have been selected.
 void showPreviewHelpScreen()
          This method is used to create and display the preview controls help screen.
This screen will show the controls required by the user to navigate the video player.
 void singlePassEncoding()
          This method calls the appropriate methods and external program to undertake the convertion of the video to convert under a single pass conversion specification.
 boolean startConversionProcess()
          This method is used to start the conversion process for the video jobs in the conversion jobs list.
 void stateChanged(javax.swing.event.ChangeEvent arg0)
           
 void updateAllVideosInfo()
          Updates the information for all the videos in the library.
Creates and runs a MultipleInfoUpdateTask which will run the info update
 VideoObject updateEditorBoxes(VideoObject objectToShow)
          This method is used to display the information from the library into the editor window.
 void updateFilters(int objectID)
          This method updates the media library filters with the new values, for example if the video type chosen as been changed to Movie then the filters for Movies will be shown and filled in accordingly.
The method takes the argument objectID to know which object called this method as filter changes only affect children "objects" and not "parents" for example changing a Movie genre from Action to Comedy will not affect the Video type filter as object still a Movie whether it is a comedy or action movie.
 boolean updateSelectedVideo()
          Checks which video is selected if any then runs the database query method to check if any information about the selected video can be filled in automatically or possible choices given if more than one match possible.
 void updateTable()
          This method updates the main window table with the updates information from the library.
Hidden files will be kept hidden and invalid links will still be flagged.
 void valueChanged(javax.swing.event.ListSelectionEvent listEvent)
          Listener for ListBoxes to check when the media library filters have been changed so that the appropriate updateFilters() function can be called to update the filters and the main table displaying the videos.
 void versionCheckMessage()
           
 void windowActivated(java.awt.event.WindowEvent arg0)
           
 void windowClosed(java.awt.event.WindowEvent arg0)
           
 void windowClosing(java.awt.event.WindowEvent arg0)
          Method used to check actions to undertake in case a window being monitored is being closed.
 void windowDeactivated(java.awt.event.WindowEvent arg0)
           
 void windowDeiconified(java.awt.event.WindowEvent arg0)
           
 void windowIconified(java.awt.event.WindowEvent arg0)
           
 void windowOpened(java.awt.event.WindowEvent arg0)
           
 
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

demoVersion

public boolean demoVersion
Constructor Detail

VidPlayer

public VidPlayer()
Video Player constructor
Creates and displays the GUI

Method Detail

locateMediaFolder

public void locateMediaFolder()
Locate media player method, opens a JFileChooser for the user to select a directory.
The selected folder is then saved as the media folder if not null.


changeMediaPlayerLocation

public void changeMediaPlayerLocation()
Opens a JFileChooser for the user to select a media player.
ExeFileFilter applied to only let the user select an executable file.
Selected executable file path stored as media player path if not null.
Message given to stdout otherwise.


displayMessage

public void displayMessage(java.lang.String msg)
Displays the given message in the JLabel shown at the bottom of the JFrame.
A timer is created and the message will be shown for a few seconds then the previous information shown in the label is restored.

Parameters:
msg - the message to be shown in the info bar at the bottom of the Window, Message will dissapear after a few seconds.

licenseIsValid

public boolean licenseIsValid()
Method to check if the license for the program is valid or not.
Opens the license file, checks the key and if the key is valid, returns true otherwise returns false.

Returns:
true if the license given is valid and false if it is invalid.

resetFilters

public void resetFilters()
This method resets the media lirary filters, therefore deletes all the values in the filters and inputs the default values to show all possible values.


updateFilters

public void updateFilters(int objectID)
This method updates the media library filters with the new values, for example if the video type chosen as been changed to Movie then the filters for Movies will be shown and filled in accordingly.
The method takes the argument objectID to know which object called this method as filter changes only affect children "objects" and not "parents" for example changing a Movie genre from Action to Comedy will not affect the Video type filter as object still a Movie whether it is a comedy or action movie.

Parameters:
objectID - the object that called this method, required to know which object updates can be skipped.

main

public static void main(java.lang.String[] args)
main method for Video player, calls the constructor for video player which builds and displays the GUI.

Parameters:
args - array of arguments given when the program is run.

changeConfig

public void changeConfig()
Method to check the current preferences and save any changes when the window is closed.
This method creates a separate JFrame and displays all the preferences inside it, a window listener as been added to that frame to check when the window is closed.


createMenu

public void createMenu()
Method that build the PopupMenu and the menu bar.
Once the menus are built they are added to the main window.
Action Listeners added to the menus to listen to menu selections.


exportLibrary

public boolean exportLibrary()
Method to export the current library to a XML file at the location and with the name selected by the user.
This method opens a JFileChooser so the user can select where he wants to save the library and what he wants to call it.
Filename is checked for validity and corrected, once valid the export library method is called which will write the values to file.

Returns:
returns true if the export was successfull otherwise returns false

importLibrary

public boolean importLibrary()
Import library method to import a library from file to the current library.
Reads values from XML library file then imports videos to library.

Returns:
returns true if import was successfull otherwise returns false

deleteIncompleteFile

public void deleteIncompleteFile()
This method deletes any incomplete file from a conversion termination.


cancelCurrentConversion

public void cancelCurrentConversion()
Cancels the current convertion, checks first if a conversion is in progress then changes the conversion state to false to be specific not converting and destroys the convertion process and calls the deleteIncompleteFile() method to delete incomplete files.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

convertVideoType

public VideoObject convertVideoType(VideoObject objectToConvert)
This method converts a video from its original video type to the video type selected in the tag edit box.

Parameters:
objectToConvert - the original video object that needs to be converted
Returns:
the new video object that has been converted to the new selected video type

showImportDetails

public void showImportDetails(java.lang.Object[][] importedInfo)
This method opens up a JPanel on the right hand side of the main window to show the database info found for the objects imported or the objects selected for information update

Parameters:
importedInfo - the array of information that will be displayed. Videos and the possible values for each.

updateSelectedVideo

public boolean updateSelectedVideo()
Checks which video is selected if any then runs the database query method to check if any information about the selected video can be filled in automatically or possible choices given if more than one match possible.

Returns:
returns true if update found something in the database otherwise returns false.

editVideo

public boolean editVideo()
Method to edit the tag of the selected video if any is selected.

Returns:
returns true if it is possible to edit the video otherwise returns false.

updateAllVideosInfo

public void updateAllVideosInfo()
Updates the information for all the videos in the library.
Creates and runs a MultipleInfoUpdateTask which will run the info update


deleteAllVideos

public void deleteAllVideos()
Asks for confirmation from the user then deletes all the videos in the library and then updates the table


getInfoFromMP4

public void getInfoFromMP4(VideoObject mp4ToTag)
NOT YET IMPLEMENTED, but this will be used to read the meta data from mp4 files to update the video information from it.

Parameters:
mp4ToTag - mp4 video to read the metadata from and update that metadata to that same video information in the library

setInfoToMP4

public void setInfoToMP4(VideoObject mp4ToTag)
Method to save the video information from the library to the metadata within the video file if the video file is an mp4.
The video information will then be available if you import it into any program that supports reading metadata information (such as itunes, quicktime).

Parameters:
mp4ToTag - the video to have its metadata tagged with the video information stored int the library

saveAllmp4Tags

public void saveAllmp4Tags()
This method creates and runs a TaggingTask to save the video information from the library to each individual video files for multiple items.


savemp4Tag

public boolean savemp4Tag()
This method calls the setInfoToMP4() to save the video information from the selected video to its metadata within the mp4 file.
The video file has to be an mp4.

Returns:
returns true if saving to metadata successfull otherwise returns false

deleteVideo

public boolean deleteVideo()
This method asks the user to confirm if they want to delete the selected video then deletes it if confirmed.

Returns:
returns true if deletion completed otherwise returns false.

editor

public void editor(int startVideoEditIndex)
This method creates a separate JFrame with JTextField and JComboBox so the user can change the information for the current video being edited.

Parameters:
startVideoEditIndex - the video to start editing, while navigating this index will then become irrelevant.

updateEditorBoxes

public VideoObject updateEditorBoxes(VideoObject objectToShow)
This method is used to display the information from the library into the editor window.

Parameters:
objectToShow - the object being edited and displayed
Returns:
returns the previous object with the new changes

saveEditorToLibrary

public boolean saveEditorToLibrary()
Saves the information edited in the editor to the library, changes will then become final.

Returns:
returns true if saving was successfull otherwise returns false

fillTable

public void fillTable()
This method fills in the main window table with all the information stored in the library.
Any hidden files will be restored and invalid links will not be indicated anymore


updateTable

public void updateTable()
This method updates the main window table with the updates information from the library.
Hidden files will be kept hidden and invalid links will still be flagged.


conversionLog

public void conversionLog()
This method creates and shows the conversion log window which is used to display information about a conversion process while it is being converted.
This is a JFrame with a JTextArea inside a JScrollPane where the information will be added during conversion.


showConversionList

public void showConversionList(int mode)
This methos createa and shows the conversion list window, this JFrame displays a list of convertion jobs to convert or being converted.
Information about the job completion is also shown in the list.


mp4Muxing

public java.lang.String mp4Muxing(java.lang.String videoToConvert)
This method is used to mux and avi file with codecs (aac and h264) to a quicktime compatible mp4 file

Parameters:
videoToConvert - the path of the video to be muxed
Returns:
the path of the final muxed video

rawTranscode

public java.lang.String rawTranscode()
This method transcodes a VOB file to mpeg to solve problem with timestamps so that subtitles are not our of sync

Returns:
the path of the final transcoded mpeg video.

getTimeTaken

public java.lang.String getTimeTaken(long reqStartTime,
                                     long reqEndTime)
This method is used to calculate the elapsed time between the given start time and end time.
The output will be given as a string separating the hours, minutes, seconds and milliseconds.

Parameters:
reqStartTime - the start time of a process
reqEndTime - the end time of the same process
Returns:
the time elapsed been start and end given as a properly labeled string of hours,minutes,seconds and milliseconds.

firstPassEncoding

public void firstPassEncoding()
                       throws java.lang.Exception
This method calls the necessary methods and program to convert the first pass of the video to be converted

Throws:
java.lang.Exception

secondPassEncoding

public void secondPassEncoding()
                        throws java.lang.Exception
This method calls the necessary methods and program to convert the second pass of the video to be converted

Throws:
java.lang.Exception

addConvertedVideoToLibrary

public boolean addConvertedVideoToLibrary()
This method adds the converted final video to the library

Returns:
returns true if adding to the library was successful otherwise returns false

checkScale

public void checkScale()
This method is used to check the correct scale of a video to be converted.
This method will call an external program which will simulate playback in the background to check the aspect ratio and scale.


setProfileCropAndScale

public void setProfileCropAndScale()
                            throws java.lang.Exception
This method calls various methods from the ConversionProfile being used to set various information about scaling and cropping for the video being converted

Throws:
java.lang.Exception

singlePassEncoding

public void singlePassEncoding()
                        throws java.lang.Exception
This method calls the appropriate methods and external program to undertake the convertion of the video to convert under a single pass conversion specification.

Throws:
java.lang.Exception

encodingDVD

public void encodingDVD()

encoding3GP

public void encoding3GP()
This method calls the appropriate methods and external program to undertake the convertion of the video to convert under a 3gpp conversion specifications.


convertTheNextVideo

public boolean convertTheNextVideo()
This method is called to use any of the conversion profiles to convert a video to the chosen profile

Returns:
returns true if the conversion was successful otherwise returns false in case of any errors or manual cancelation

versionCheckMessage

public void versionCheckMessage()

checkVersion

public void checkVersion()

showPreview

public void showPreview()
This method is used to display a preview in a separate window of the settings chosen for conversion with regard, to scalling and cropping and any video filters that might have been selected.


audioAmp

public boolean audioAmp()
This method is used to run the appropriate methods and external programs in order to increase the sound amplitude for an avi or mp4 (h264 video)

Returns:
returns true if amplitude increase was successfull otherwise returns false.

getAudioAmpProcess

public java.lang.Process getAudioAmpProcess()
This method returns the process for audio amplitude increase

Returns:
returns the process for amplitude increase

autoCropDetect

public void autoCropDetect(int mode)
                    throws java.lang.Exception
This method is used to detect crop values automatically
To do that the video is analysed, the length of the video is obtained.
Then a crop values detection is executed at 10 different places throughout the video
If manualCropSettings are chosen this method does not detect auto crop values.
The autoCrop values are then stored in the autocropvalues array for use during conversion passes.

Parameters:
mode - operation mode, 0 = detect video info only, 1 = detect video info + crop;
Throws:
java.lang.Exception

manualCropDetect

public void manualCropDetect()
This method is used to detect crop values automatically
To do that the video is analysed, the length of the video is obtained.
Then a crop values detection is executed at 10 different places throughout the video
If manualCropSettings are chosen this method does not detect auto crop values.
The autoCrop values are then stored in the autocropvalues array for use during conversion passes.


mergeVideos

public boolean mergeVideos()
This method is used to merge multiple avi files together as long as they have similar settings such as dimensions and bitrate.

Returns:
returns true if the merge was successfull otherwise returns false.

importVideos

public void importVideos()

deleteLogs

public void deleteLogs()

importJobs

public void importJobs()

addAllToConvert

public void addAllToConvert()
This method adds all the videos in the library to be converted with the selected conversion profile.
A conversion job for each video will be created with the same conversion profile each time.


addToConvert

public void addToConvert()
This method is used to add the selected video to be converted.
The video will be added into a converting job in the conversion list.


addToConvert

public boolean addToConvert(java.io.File jobToAddFile)
Method to add a job to the batch list from a saved job file

Parameters:
jobToAddFile - job file to import and add to batch list

deleteAllConvertJobs

public void deleteAllConvertJobs()
delete all jobs from batch jobs list


deleteConvertJob

public void deleteConvertJob()
This method is used to delete a conversion job from the conversion list


disableConvertJob

public void disableConvertJob()

enableConvertJob

public void enableConvertJob()

showCustomXvidSettings

public void showCustomXvidSettings()
This method is used to show the Xvid settings window where the user can select the settings to be used with the Xvid codec.


calculatorCalculate

public void calculatorCalculate()
This method is used to calculate various information about a video file with respect to file size, bitrate, video width and height.


showMergeAVITool

public void showMergeAVITool()
This method is used to create and show the JFrame merge tool for merging multiple avi files together.


showAudioAmpTool

public void showAudioAmpTool()
This method is used to show the audio amplification tool used to increase the amplitude of videos of avi or mp4 format.


showMencoderHelpScreen

public void showMencoderHelpScreen()
This method is used to create and display the Mencoder settings help screen.
This screen will show help about codecs and encoding settings..


showPreviewHelpScreen

public void showPreviewHelpScreen()
This method is used to create and display the preview controls help screen.
This screen will show the controls required by the user to navigate the video player.


showCalculator

public void showCalculator()
This method is used to create and display the calculator window.
The calculator is used to calculate bitrate or filesize for given settings.


showCustomH264Settings

public void showCustomH264Settings()
This method is used to show the H264 custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the H264 codec for conversion.


showCustomiPodSettings

public void showCustomiPodSettings()
This method is used to show the ipod custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the ipod profile for conversion.


showCustomAVCiPodSettings

public void showCustomAVCiPodSettings()
This method is used to show the ipod custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the ipod profile for conversion.


showCustomAVCPSPSettings

public void showCustomAVCPSPSettings()
This method is used to show the PSP custom AVC settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the PSP AVC profile for conversion.


showCustomPSPSettings

public void showCustomPSPSettings()
This method is used to show the psp mpeg4 custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the psp profile for conversion.


showCustomDVDSettings

public void showCustomDVDSettings()

showCustomWinMediaSettings

public void showCustomWinMediaSettings()
This method is used to show the wmv custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the wmv profile for conversion.


showCustomMencoderSettings

public void showCustomMencoderSettings()
This method is used to show the Mencoder custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the Mencoder profile for conversion.


showCustomFFMpegSettings

public void showCustomFFMpegSettings()
This method is used to show the FFMPEG custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the FFMPEG profile for conversion.


showCustomZuneSettings

public void showCustomZuneSettings()
This method is used to show the zune custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the zune profile for conversion.


showCustomMjpegGENSettings

public void showCustomMjpegGENSettings()
This method is used to show the MJPEG custom general settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the MJPEG profile for conversion.


showCustomFlashSettings

public void showCustomFlashSettings()
This method is used to show the Flash custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the Flash profile for conversion.


showCustom3GPSettings

public void showCustom3GPSettings()
This method is used to show the ipod custom settings window.
This window contains JTextFields and JComboBoxes so that the user can input and select the settings he wants to use with the ipod profile for conversion.


convertSelectedVideos

public void convertSelectedVideos()
This method is used to start the conversion process for the selected video.
If no video selected or no video in library message given to the user.


showConversionProfiles

public void showConversionProfiles()
This method is used to create and show the window that displays the conversion profiles and the information for the selected profile.


startConversionProcess

public boolean startConversionProcess()
This method is used to start the conversion process for the video jobs in the conversion jobs list.

Returns:
returns true if the conversion job list is valid else returns false.

openMediaPlayer

public void openMediaPlayer(java.lang.String requiredFileName)
This method is used to open the selected video with the selected media player.

Parameters:
requiredFileName - the video to play with the media player.

windowActivated

public void windowActivated(java.awt.event.WindowEvent arg0)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent arg0)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent arg0)
Method used to check actions to undertake in case a window being monitored is being closed.

Specified by:
windowClosing in interface java.awt.event.WindowListener

closeProfileChoiceWindow

public void closeProfileChoiceWindow()
This method is used to close the profile choice window.
Closed only if auto crop detection is not running.


closeZuneSettings

public void closeZuneSettings()
This method is used to close the Zune settings window.


closeDVDSettings

public void closeDVDSettings()
This method is used to close the DVD settings window.


closePSPSettings

public void closePSPSettings()
This method is used to close the Zune settings window.


closeFlashSettings

public void closeFlashSettings()
This method is used to close the Flash settings window.


closeMjpegSettings

public void closeMjpegSettings()
This method is used to close the MJPEG settings window.


closeMencoderSettings

public void closeMencoderSettings()
This method is used to close the Mencoder settings window.


closeFFMPEGSettings

public void closeFFMPEGSettings()
This method is used to close the FFMPEG settings window.


closeH264Settings

public void closeH264Settings()
This method is used to close the H264 settings window.


closeiPodSettings

public void closeiPodSettings()
This method is used to close the iPod settings window.


close3GPSettings

public void close3GPSettings()
This method is used to close the 3gp settings window.


closeWMVSettings

public void closeWMVSettings()
This method is used to close the wmv settings window.


closeXvidSettings

public void closeXvidSettings()
This method is used to close the Xvid settings window.


checkFilePath

public boolean checkFilePath(java.lang.String fileName)
This method is used to check if the given file exists

Parameters:
fileName - file to check if it exists
Returns:
returns true if file exists otherwise returns false

getVideoListTable

public DroppableTable getVideoListTable()
Method to return the droppable main table

Returns:
the dropppable main table of the movie library

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent arg0)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent arg0)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent arg0)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent arg0)
Specified by:
windowOpened in interface java.awt.event.WindowListener

componentHidden

public void componentHidden(java.awt.event.ComponentEvent arg0)
Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent arg0)
Specified by:
componentMoved in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent arg0)
This method is used to stop the user resizing thw main window to a smaller size than reasonable.

Specified by:
componentResized in interface java.awt.event.ComponentListener

componentShown

public void componentShown(java.awt.event.ComponentEvent arg0)
Specified by:
componentShown in interface java.awt.event.ComponentListener

getRegTo

public java.lang.String getRegTo()
Method to return who the program is registered to

Returns:
the user the program is registered to

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

setProgressBarMaxSize

public void setProgressBarMaxSize(int reqMaxSize)
This method is used to set the maximum size of the progress bar used to show the system is busy doing something.

Parameters:
reqMaxSize -

setSystemBusy

public void setSystemBusy()
Sets the system to busy so that the user has to wait for the critical function to be completed before having access to the program.
Windows are all disabled appart from the dialo opened which shows the progress throughout the task's execution.


setProgressBarFrameOnTop

public void setProgressBarFrameOnTop(boolean progressBarState)

setProgressFinished

public void setProgressFinished()
Method to set the progress to 100%, task finished.


setSystemNormal

public void setSystemNormal()
Method to restore the system back to its normal state.
Called when the system has finished the critical function.


itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
Specified by:
itemStateChanged in interface java.awt.event.ItemListener

setColumnWidthManualChange

public void setColumnWidthManualChange(boolean changeStatus)

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent listEvent)
Listener for ListBoxes to check when the media library filters have been changed so that the appropriate updateFilters() function can be called to update the filters and the main table displaying the videos.

Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener

getCodecBox

public javax.swing.JComboBox getCodecBox()

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent arg0)
Specified by:
stateChanged in interface javax.swing.event.ChangeListener

getManualVidConvFPS

public java.lang.String getManualVidConvFPS()