/** * Used to update subtitle component. * * @param info the video info */ protected void updateSubtitle(VideoInfo info) { List<SubtitleStream> subtitleStreams = info.getSubtitleLanguages(); SubtitleStream subSelection = findSubtitleSelection(subtitleStreams, getInputVideo().getSubtitleTrack()); Object selection = subSelection; if (selection == null) { selection = disableElement; } updateViewer(subtitleCombo, subtitleStreams, selection, false, true); }
/** * Used to update audio component. * * @param info the video information. */ protected void updateLanguage(VideoInfo info) { List<AudioStream> audioStreams = info.getAudioStreams(); AudioStream audioSelection = findAudioSelection(audioStreams, getInputVideo().getAudioTrack()); if (audioSelection != null) { updateViewer(languageCombo, audioStreams, audioSelection, false, false); } else { updateViewer(languageCombo, audioStreams, disableElement, false, true); } }
/** * Used to update description component. * * @param info the video information. */ protected void updateDescription(VideoInfo info) { String description; // Video description description = VideoInfoFormater.formatVideoInfo(info); videoDescription.setText(description); // Audio description List<AudioStream> audioStreams = info.getAudioStreams(); AudioStream audioSelection = findAudioSelection(audioStreams, getInputVideo().getAudioTrack()); if (audioSelection != null) { description = VideoInfoFormater.formatAudioStream(audioSelection); } else { description = ""; // $NON-NLS-1$ } audioDescription.setText(description); }
/** This implementation update all input video fields. */ protected void videoHasChanged() { super.videoHasChanged(); // Check if the input video has changed if (lastInputVideo != getInputVideo()) { lastInputVideo = getInputVideo(); // Update the file name inputFileName.setText(getInputVideo().getFile().getAbsolutePath()); // Check if viewsite are available if (getViewSite() == null) { return; } VideoInfo info; try { MPlayerWrapper mplayer = getViewSite().getMplayer(); if (mplayer == null) { ErrorMessage.showLocalizedError(getShell(), Localization.MPLAYER_NOT_FOUND); return; } info = mplayer.getVideoInfo(getInputVideo()); } catch (MPlayerException e) { e.printStackTrace(); ErrorMessage.showMPlayerException( getShell(), e, Localization.INPUTOUTPUT_RETRIEVE_INFO_FAILED); return; } // CheckAudio selection List<AudioStream> audioStreams = info.getAudioStreams(); AudioStream audioSelection = findAudioSelection(audioStreams, getInputVideo().getAudioTrack()); if (audioSelection == null && audioStreams.size() > 0) { audioSelection = audioStreams.get(0); try { InputVideoFile inputVideo = new InputVideoFile( getInputVideo().getFile(), audioSelection.getAudioID(), getInputVideo().getSubtitleTrack()); if (audioStreams.size() == 1) { lastInputVideo = inputVideo; getVideo().setInputVideo(inputVideo); } else { getVideo().setInputVideo(inputVideo); return; } } catch (FileNotFoundException e) { ErrorMessage.showLocalizedError(getShell(), Localization.INPUTOUTPUT_FILE_NO_MORE_EXIST); } } // Update audio component. updateLanguage(info); // Update subtitle component updateSubtitle(info); // Update description updateDescription(info); } }