Example usage for java.lang Float toString

List of usage examples for java.lang Float toString

Introduction

In this page you can find the example usage for java.lang Float toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of this Float object.

Usage

From source file:org.f3.tools.framework.Reporter.java

private void printTimingReport() {
    HtmlWriter timingReport = null;/*from   w w  w  .  j  a  v  a 2  s .  c o  m*/
    HtmlWriter dashboardTimingReport = null;
    try {
        timingReport = new HtmlWriter(TIMING_RESULT_FILE_NAME, detailsTable("Timing in milliseconds"));
        dashboardTimingReport = new HtmlWriter("timing-dashboard.html", dashboardTable("Timing"));
        Set<String> kset = new TreeSet<String>(result.keySet());
        for (String x : kset) {
            Float currentToGoal = percentChangeTiming(goals, result, x);
            Float currentToLast = percentChangeTiming(last, result, x);
            // print to details table
            timingReport.writeToHtmlTable(nameAsHref(x), getPerformanceValue(result12, x),
                    getPerformanceValue(result13, x), getPerformanceValue(goals, x),
                    getPerformanceValue(last, x), getPerformanceValue(result, x), currentToGoal.toString(),
                    currentToLast.toString());

            // generate images and print to dashboard
            dashboardTimingReport.writeToHtmlTable(nameAsHref(x),
                    generateImage(TIMING_RESULT_FILE_NAME, x + TIMING_GOAL_PLOT_FILE_NAME_TAIL, currentToGoal),
                    generateImage(TIMING_RESULT_FILE_NAME, x + TIMING_LAST_PLOT_FILE_NAME_TAIL, currentToLast));
        }
    } catch (IOException ioe) {
        Utils.logger.severe(ioe.toString());
    } finally {
        Utils.close(dashboardTimingReport);
        Utils.close(timingReport);
    }
}

From source file:org.apache.solr.update.processor.AddSchemaFieldsUpdateProcessorFactoryTest.java

public void testSingleFieldDefaultFieldTypeRoundTrip() throws Exception {
    IndexSchema schema = h.getCore().getLatestSchema();
    final String fieldName = "newfield4";
    assertNull(schema.getFieldOrNull(fieldName));
    Float fieldValue1 = -13258.0f;
    Double fieldValue2 = 8.4828800808E10;
    String fieldValue3 = "blah blah";
    SolrInputDocument d = processAdd("add-fields",
            doc(f("id", "4"), f(fieldName, fieldValue1, fieldValue2, fieldValue3)));
    assertNotNull(d);/*from w w  w  . ja  v a 2s.  c o m*/
    schema = h.getCore().getLatestSchema();
    assertNotNull(schema.getFieldOrNull(fieldName));
    assertEquals("text", schema.getFieldType(fieldName).getTypeName());
    assertU(commit());
    assertQ(req("id:4"), "//arr[@name='" + fieldName + "']/str[.='" + fieldValue1.toString() + "']",
            "//arr[@name='" + fieldName + "']/str[.='" + fieldValue2.toString() + "']",
            "//arr[@name='" + fieldName + "']/str[.='" + fieldValue3.toString() + "']");
}

From source file:edu.ku.brc.af.prefs.AppPreferences.java

/**
 * Sets a Float value into a pref.//from  w w w .j a  va 2s .  co m
 * @param name the name
 * @param value the new value
 */
public void putFloat(final String name, final Float value) {
    put(name, value.toString());
}

From source file:eu.impact_project.resultsrepository.ServiceImpl.java

private String toPercent(String decimal) {
    Float percent = Float.parseFloat(decimal) * 100;
    // String beforePoint = percent.intValue() + "";
    ////from  w ww.  j  a v a2 s  .c o  m
    // String percentString = percent.toString();
    // int pointIndex = percentString.indexOf(".");
    // String afterPoint = percentString.substring(pointIndex+1,
    // pointIndex+3);

    return percent.toString();
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWSchema.java

public static String getFloatString(Float val) {
    if (val == null) {
        return ("null");
    } else {//from w  w  w.  j a v a2s. c  o  m
        return (val.toString());
    }
}

From source file:org.openmeetings.app.data.flvrecord.converter.BaseConverter.java

protected void stripAudioFirstPass(FlvRecording flvRecording, List<HashMap<String, String>> returnLog,
        List<String> listOfFullWaveFiles, String streamFolderName, List<FlvRecordingMetaData> metaDataList) {
    try {/*from ww w. jav  a 2 s.  co m*/
        // Init variables
        log.debug("### meta Data Number - " + metaDataList.size());
        log.debug("###################################################");

        for (FlvRecordingMetaData flvRecordingMetaData : metaDataList) {

            if (flvRecordingMetaData.getStreamReaderThreadComplete() == null) {
                throw new IllegalStateException("StreamReaderThreadComplete Bit is NULL, error in recording");
            }

            if (!flvRecordingMetaData.getStreamReaderThreadComplete()) {

                log.debug("### meta Stream not yet written to disk"
                        + flvRecordingMetaData.getFlvRecordingMetaDataId());
                boolean doStop = true;
                while (doStop) {

                    log.debug("### Stream not yet written Thread Sleep - "
                            + flvRecordingMetaData.getFlvRecordingMetaDataId());

                    flvRecordingMetaData = flvRecordingMetaDataDaoImpl
                            .getFlvRecordingMetaDataById(flvRecordingMetaData.getFlvRecordingMetaDataId());

                    if (flvRecordingMetaData.getStreamReaderThreadComplete()) {
                        log.debug("### Stream now written Thread continue - ");
                        doStop = false;
                    }

                    Thread.sleep(100L);
                }
            }

            String inputFlv = streamFolderName + flvRecordingMetaData.getStreamName() + ".flv";

            String hashFileName = flvRecordingMetaData.getStreamName() + "_WAVE.wav";
            String outputWav = streamFolderName + hashFileName;

            flvRecordingMetaData.setWavAudioData(hashFileName);

            File inputFlvFile = new File(inputFlv);

            log.debug("FLV File Name: {} Length: {} ", inputFlvFile.getName(), inputFlvFile.length());

            if (inputFlvFile.exists()) {

                String[] argv = new String[] { this.getPathToFFMPEG(), "-async", "1", "-i", inputFlv,
                        outputWav };

                log.debug("START stripAudioFromFLVs ################# ");
                for (int i = 0; i < argv.length; i++) {
                    log.debug(" i " + i + " argv-i " + argv[i]);
                }
                log.debug("END stripAudioFromFLVs ################# ");

                returnLog.add(ProcessHelper.executeScript("generateFFMPEG", argv));

                // check if the resulting Audio is valid
                File output_wav = new File(outputWav);

                if (!output_wav.exists()) {
                    flvRecordingMetaData.setAudioIsValid(false);
                } else {
                    if (output_wav.length() == 0) {
                        flvRecordingMetaData.setAudioIsValid(false);
                    } else {
                        flvRecordingMetaData.setAudioIsValid(true);
                    }
                }

            } else {
                flvRecordingMetaData.setAudioIsValid(false);
            }

            if (flvRecordingMetaData.getAudioIsValid()) {

                // Strip Wave to Full Length
                String outputGapFullWav = outputWav;

                // Fix Start/End in Audio
                List<FlvRecordingMetaDelta> flvRecordingMetaDeltas = flvRecordingMetaDeltaDaoImpl
                        .getFlvRecordingMetaDeltaByMetaId(flvRecordingMetaData.getFlvRecordingMetaDataId());

                int counter = 0;

                for (FlvRecordingMetaDelta flvRecordingMetaDelta : flvRecordingMetaDeltas) {

                    String inputFile = outputGapFullWav;

                    // Strip Wave to Full Length
                    String hashFileGapsFullName = flvRecordingMetaData.getStreamName() + "_GAP_FULL_WAVE_"
                            + counter + ".wav";
                    outputGapFullWav = streamFolderName + hashFileGapsFullName;

                    flvRecordingMetaDelta.setWaveOutPutName(hashFileGapsFullName);

                    String[] argv_sox = null;

                    if (flvRecordingMetaDelta.getIsStartPadding() != null
                            && flvRecordingMetaDelta.getIsStartPadding()) {

                        double gapSeconds = Double.valueOf(flvRecordingMetaDelta.getDeltaTime().toString())
                                .doubleValue() / 1000;

                        Double.valueOf(flvRecordingMetaDelta.getDeltaTime().toString()).doubleValue();

                        if (gapSeconds > 0) {
                            // Add the item at the beginning
                            argv_sox = new String[] { this.getPathToSoX(), inputFile, outputGapFullWav, "pad",
                                    String.valueOf(gapSeconds).toString(), "0" };
                        }

                    } else if (flvRecordingMetaDelta.getIsEndPadding() != null
                            && flvRecordingMetaDelta.getIsEndPadding()) {

                        double gapSeconds = Double.valueOf(flvRecordingMetaDelta.getDeltaTime().toString())
                                .doubleValue() / 1000;

                        if (gapSeconds > 0) {
                            // Add the item at the end
                            argv_sox = new String[] { this.getPathToSoX(), inputFile, outputGapFullWav, "pad",
                                    "0", String.valueOf(gapSeconds).toString() };
                        }
                    }

                    if (argv_sox != null) {
                        log.debug("START addGapAudioToWaves ################# ");
                        log.debug("START addGapAudioToWaves ################# Delta-ID :: "
                                + flvRecordingMetaDelta.getFlvRecordingMetaDeltaId());
                        String commandHelper = " ";
                        for (int i = 0; i < argv_sox.length; i++) {
                            commandHelper += " " + argv_sox[i];
                        }
                        log.debug(" commandHelper " + commandHelper);
                        log.debug("END addGapAudioToWaves ################# ");

                        returnLog.add(ProcessHelper.executeScript("fillGap", argv_sox));

                        this.flvRecordingMetaDeltaDaoImpl.updateFlvRecordingMetaDelta(flvRecordingMetaDelta);
                        counter++;
                    } else {
                        outputGapFullWav = inputFile;
                    }

                }

                // Strip Wave to Full Length
                String hashFileFullName = flvRecordingMetaData.getStreamName() + "_FULL_WAVE.wav";
                String outputFullWav = streamFolderName + hashFileFullName;

                // Calculate delta at beginning
                Long deltaTimeStartMilliSeconds = flvRecordingMetaData.getRecordStart().getTime()
                        - flvRecording.getRecordStart().getTime();

                Float startPadding = Float.parseFloat(deltaTimeStartMilliSeconds.toString()) / 1000;

                // Calculate delta at ending
                Long deltaTimeEndMilliSeconds = flvRecording.getRecordEnd().getTime()
                        - flvRecordingMetaData.getRecordEnd().getTime();

                Float endPadding = Float.parseFloat(deltaTimeEndMilliSeconds.toString()) / 1000;

                String[] argv_sox = new String[] { this.getPathToSoX(), outputGapFullWav, outputFullWav, "pad",
                        startPadding.toString(), endPadding.toString() };

                log.debug("START addAudioToWaves ################# ");
                String padString = "";
                for (int i = 0; i < argv_sox.length; i++) {
                    padString += " " + argv_sox[i];
                }
                log.debug("padString :: " + padString);
                log.debug("END addAudioToWaves ################# ");

                returnLog.add(ProcessHelper.executeScript("addStartEndToAudio", argv_sox));

                // Fix for Audio Length - Invalid Audio Length in Recorded
                // Files
                // Audio must match 100% the Video
                log.debug("############################################");
                log.debug("Trim Audio to Full Length -- Start");
                File aFile = new File(outputFullWav);

                if (!aFile.exists()) {
                    throw new Exception("Audio File does not exist , could not extract the Audio correctly");
                }
                flvRecordingMetaData.setFullWavAudioData(hashFileFullName);

                // Finally add it to the row!
                listOfFullWaveFiles.add(outputFullWav);

            }

            flvRecordingMetaDataDaoImpl.updateFlvRecordingMetaData(flvRecordingMetaData);

        }
    } catch (Exception err) {
        log.error("[stripAudioFromFLVs]", err);
    }
}

From source file:org.apache.solr.update.processor.AddSchemaFieldsUpdateProcessorFactoryTest.java

public void testMultipleFieldsRoundTrip() throws Exception {
    IndexSchema schema = h.getCore().getLatestSchema();
    final String fieldName1 = "newfield5";
    final String fieldName2 = "newfield6";
    assertNull(schema.getFieldOrNull(fieldName1));
    assertNull(schema.getFieldOrNull(fieldName2));
    Float field1Value1 = -13258.0f;
    Double field1Value2 = 8.4828800808E10;
    Long field1Value3 = 999L;/*from  w  w  w . ja  va 2 s .c o m*/
    Integer field2Value1 = 55123;
    Long field2Value2 = 1234567890123456789L;
    SolrInputDocument d = processAdd("add-fields",
            doc(f("id", "5"), f(fieldName1, field1Value1, field1Value2, field1Value3),
                    f(fieldName2, field2Value1, field2Value2)));
    assertNotNull(d);
    schema = h.getCore().getLatestSchema();
    assertNotNull(schema.getFieldOrNull(fieldName1));
    assertNotNull(schema.getFieldOrNull(fieldName2));
    assertEquals("tdouble", schema.getFieldType(fieldName1).getTypeName());
    assertEquals("tlong", schema.getFieldType(fieldName2).getTypeName());
    assertU(commit());
    assertQ(req("id:5"), "//arr[@name='" + fieldName1 + "']/double[.='" + field1Value1.toString() + "']",
            "//arr[@name='" + fieldName1 + "']/double[.='" + field1Value2.toString() + "']",
            "//arr[@name='" + fieldName1 + "']/double[.='" + field1Value3.doubleValue() + "']",
            "//arr[@name='" + fieldName2 + "']/long[.='" + field2Value1.toString() + "']",
            "//arr[@name='" + fieldName2 + "']/long[.='" + field2Value2.toString() + "']");
}

From source file:org.apache.openmeetings.data.flvrecord.converter.FlvInterviewConverter.java

public void stripAudioFromFLVs(FlvRecording flvRecording, boolean reconversion) {
    List<ConverterProcessResult> returnLog = new ArrayList<ConverterProcessResult>();
    List<String> listOfFullWaveFiles = new LinkedList<String>();
    File streamFolder = getStreamFolder(flvRecording);
    List<FlvRecordingMetaData> metaDataList = flvRecordingMetaDataDaoImpl
            .getFlvRecordingMetaDataAudioFlvsByRecording(flvRecording.getFlvRecordingId());

    stripAudioFirstPass(flvRecording, returnLog, listOfFullWaveFiles, streamFolder, metaDataList);
    try {//from w ww.  ja v a2s  .c  om
        // Merge Wave to Full Length
        File streamFolderGeneral = getStreamFolder();

        String hashFileFullName = "INTERVIEW_" + flvRecording.getFlvRecordingId() + "_FINAL_WAVE.wav";
        String outputFullWav = streamFolder.getAbsolutePath() + File.separatorChar + hashFileFullName;
        deleteFileIfExists(outputFullWav);

        if (listOfFullWaveFiles.size() == 1) {

            outputFullWav = listOfFullWaveFiles.get(0);

        } else if (listOfFullWaveFiles.size() > 0) {
            String[] argv_full_sox;
            if (reconversion) {
                argv_full_sox = mergeAudioToWaves(listOfFullWaveFiles, outputFullWav, metaDataList);
            } else {
                argv_full_sox = mergeAudioToWaves(listOfFullWaveFiles, outputFullWav);
            }

            log.debug("START mergeAudioToWaves ################# ");
            log.debug(argv_full_sox.toString());
            String iString = "";
            for (int i = 0; i < argv_full_sox.length; i++) {
                iString += argv_full_sox[i] + " ";
            }
            log.debug(iString);
            log.debug("END mergeAudioToWaves ################# ");

            returnLog.add(ProcessHelper.executeScript("mergeWave", argv_full_sox));
        } else {

            // create default Audio to merge it.
            // strip to content length
            File outputWav = new File(streamFolderGeneral, "one_second.wav");

            // Calculate delta at beginning
            Long deltaTimeMilliSeconds = flvRecording.getRecordEnd().getTime()
                    - flvRecording.getRecordStart().getTime();
            Float deltaPadding = (Float.parseFloat(deltaTimeMilliSeconds.toString()) / 1000) - 1;

            String[] argv_full_sox = new String[] { this.getPathToSoX(), outputWav.getCanonicalPath(),
                    outputFullWav, "pad", "0", deltaPadding.toString() };

            log.debug("START generateSampleAudio ################# ");
            String tString = "";
            for (int i = 0; i < argv_full_sox.length; i++) {
                tString += argv_full_sox[i] + " ";
            }
            log.debug(tString);
            log.debug("END generateSampleAudio ################# ");

            returnLog.add(ProcessHelper.executeScript("mergeWave", argv_full_sox));

        }

        // Merge Audio with Video / Calculate resulting FLV

        // Start extracting image sequence
        int frameRate = 25;

        for (FlvRecordingMetaData flvRecordingMetaData : metaDataList) {

            // FLV to 24 FPS Sequence AVI
            String inputFlv = new File(streamFolder, flvRecordingMetaData.getStreamName() + ".flv")
                    .getCanonicalPath();

            File inputFlvFile = new File(inputFlv);

            if (inputFlvFile.exists()) {
                // TO Image Sequence

                // Image Folder
                File imageSequenceFolder = new File(streamFolder,
                        "" + flvRecordingMetaData.getFlvRecordingMetaDataId());
                imageSequenceFolder.mkdir();

                String outputImages = new File(imageSequenceFolder, "image%d.png").getCanonicalPath();

                String[] argv_imageSeq = new String[] { this.getPathToFFMPEG(), "-i", inputFlv, "-r",
                        "" + frameRate, "-s", "320x240", outputImages };

                log.debug("START generateImageSequence ################# ");
                String iString = "";
                for (int i = 0; i < argv_imageSeq.length; i++) {
                    iString += argv_imageSeq[i] + " ";
                }
                log.debug(iString);
                log.debug("END generateImageSequence ################# ");

                returnLog.add(ProcessHelper.executeScript("generateImageSequence", argv_imageSeq));

            }

        }

        // Default Image for empty interview video pods
        File defaultInterviewImageFile = new File(streamFolderGeneral, "default_interview_image.png");

        if (!defaultInterviewImageFile.exists()) {
            throw new Exception("defaultInterviewImageFile does not exist!");
        }
        String defaultInterviewImage = defaultInterviewImageFile.getCanonicalPath();

        // Create Folder for the output Image Sequence
        String outputImageMergedData = streamFolder.getAbsolutePath() + File.separatorChar + "INTERVIEW_"
                + flvRecording.getFlvRecordingId() + File.separatorChar;

        // Merged Image Folder
        File outputImageMergedDateFolder = new File(outputImageMergedData);
        outputImageMergedDateFolder.mkdir();

        // Generate the Single Image by sequencing
        boolean jobRunning = true;
        long currentTimeInMilliSeconds = 0;

        long completeLengthInSeconds = flvRecording.getRecordEnd().getTime()
                - flvRecording.getRecordStart().getTime();

        log.debug("completeLengthInSeconds :: " + completeLengthInSeconds);

        int sequenceCounter = 0;

        while (jobRunning) {

            // Process one Second of Movie
            String[] interviewPod1Images = new String[frameRate];
            String[] interviewPod2Images = new String[frameRate];
            int[] outputFrameNumbers = new int[frameRate];

            for (FlvRecordingMetaData flvRecordingMetaData : metaDataList) {

                long deltaStartRecording = flvRecordingMetaData.getRecordStart().getTime()
                        - flvRecording.getRecordStart().getTime();

                if (flvRecording.getRecordStart().getTime() + currentTimeInMilliSeconds >= flvRecordingMetaData
                        .getRecordStart().getTime()
                        && flvRecording.getRecordStart().getTime()
                                + currentTimeInMilliSeconds <= flvRecordingMetaData.getRecordEnd().getTime()) {

                    // Calculate which images should be in here

                    // Calculate the relative starting point
                    long thisImageSequenceStartingPoint = currentTimeInMilliSeconds - deltaStartRecording;

                    // Calculate the first and following frameRate FPS
                    // Number
                    int secondToStart = Long.valueOf(thisImageSequenceStartingPoint / 1000).intValue();

                    int firstFrame = secondToStart * frameRate;

                    for (int i = 0; i < frameRate; i++) {

                        int currentImageNumber = firstFrame + i;
                        currentImageNumber -= (frameRate / 2);
                        // Remove the first half seconds and fill
                        // it up with black screens

                        // Remove the first period of Images, this is where
                        // the user has started
                        // to share his Video but does not have agreed in
                        // the Flash Security Warning Dialogue
                        Integer initialGapSeconds = flvRecordingMetaData.getInitialGapSeconds();
                        if (initialGapSeconds != null) {
                            int initialMissingImages = Double
                                    .valueOf(Math.floor((initialGapSeconds / 1000) * frameRate)).intValue();
                            currentImageNumber -= initialMissingImages;
                        }

                        String imageName = "image" + currentImageNumber + ".png";

                        File outputMetaImageFullDataFile = new File(streamFolder,
                                "" + flvRecordingMetaData.getFlvRecordingMetaDataId() + File.separatorChar
                                        + imageName);

                        String outputMetaImageFullData = !outputMetaImageFullDataFile.exists()
                                ? defaultInterviewImage
                                : outputMetaImageFullDataFile.getCanonicalPath();

                        if (flvRecordingMetaData.getInteriewPodId() == 1) {
                            interviewPod1Images[i] = outputMetaImageFullData;
                        } else if (flvRecordingMetaData.getInteriewPodId() == 2) {
                            interviewPod2Images[i] = outputMetaImageFullData;
                        }

                    }

                }

            }

            // Update Sequence Count
            for (int i = 0; i < frameRate; i++) {
                outputFrameNumbers[i] = sequenceCounter;
                sequenceCounter++;
            }

            // Now we should have found the needed Images to calculate, in
            // case not we add an empty black screen
            for (int i = 0; i < frameRate; i++) {
                String addZeros = "";

                String outputImageName = outputImageMergedData + "image" + addZeros + outputFrameNumbers[i]
                        + ".png";

                if (interviewPod1Images[i] == null) {
                    interviewPod1Images[i] = defaultInterviewImage;
                }
                if (interviewPod2Images[i] == null) {
                    interviewPod2Images[i] = defaultInterviewImage;
                }

                if (System.getProperty("os.name").toUpperCase().indexOf("WINDOWS") == -1) {
                    String[] argv_imageMagick = new String[] { this.getPathToImageMagick(), "+append",
                            interviewPod1Images[i], interviewPod2Images[i], outputImageName };
                    returnLog.add(ProcessHelper.executeScript("generateImageSequence", argv_imageMagick));
                } else {
                    returnLog.add(processImageWindows(interviewPod1Images[i], interviewPod2Images[i],
                            outputImageName));
                }
            }

            currentTimeInMilliSeconds += 1000;

            double cLength = 100 * ((double) currentTimeInMilliSeconds) / completeLengthInSeconds;

            int progress = Double.valueOf(cLength).intValue();

            log.debug("completeLengthInSeconds|currentTimeInMilliSeconds " + completeLengthInSeconds + "|"
                    + currentTimeInMilliSeconds + "|" + progress + "|" + cLength);

            flvRecordingDaoImpl.updateFlvRecordingProgress(flvRecording.getFlvRecordingId(), progress);

            if (currentTimeInMilliSeconds >= completeLengthInSeconds) {

                jobRunning = false;

            }

        }

        // Generate Movie by sequence of Images

        String imagescomplete = outputImageMergedData + "image%d.png";

        String[] argv_generatedMoview = null;

        String inputScreenFullFlv = streamFolder.getAbsolutePath() + File.separatorChar + "COMPLETE_INTERVIEW_"
                + flvRecording.getFlvRecordingId() + ".flv";
        deleteFileIfExists(inputScreenFullFlv);

        argv_generatedMoview = new String[] { this.getPathToFFMPEG(), "-i", imagescomplete, "-r",
                "" + frameRate, "-vcodec", "flv", "-qmax", "1", "-qmin", "1", inputScreenFullFlv };

        log.debug("START generateFullBySequenceFLV ################# ");
        String tString2 = "";
        for (int i = 0; i < argv_generatedMoview.length; i++) {
            tString2 += argv_generatedMoview[i] + " ";
        }
        log.debug(tString2);
        log.debug("END generateFullBySequenceFLV ################# ");

        returnLog.add(ProcessHelper.executeScript("generateFullBySequenceFLV", argv_generatedMoview));

        String hashFileFullNameFlv = "flvRecording_" + flvRecording.getFlvRecordingId() + ".flv";
        String outputFullFlv = new File(streamFolderGeneral, hashFileFullNameFlv).getCanonicalPath();
        deleteFileIfExists(outputFullFlv);

        // ffmpeg -vcodec flv -qscale 9.5 -r 25 -ar 22050 -ab 32k -s 320x240
        // -i
        // 65318fb5c54b1bc1b1bca077b493a914_28_12_2009_23_38_17_FINAL_WAVE.wav
        // -i 65318fb5c54b1bc1b1bca077b493a914_28_12_2009_23_38_17.flv
        // final1.flv

        int flvWidth = 640;
        int flvHeight = 240;

        flvRecording.setFlvWidth(flvWidth);
        flvRecording.setFlvHeight(flvHeight);

        String[] argv_fullFLV = new String[] { this.getPathToFFMPEG(), //
                "-i", inputScreenFullFlv, "-i", outputFullWav, "-ar", "22050", //
                "-ab", "32k", //
                "-s", flvWidth + "x" + flvHeight, //
                "-vcodec", "flv", //
                "-r", "" + frameRate, "-qmax", "1", "-qmin", "1", outputFullFlv };

        log.debug("START generateFullFLV ################# ");
        String tString = "";
        for (int i = 0; i < argv_fullFLV.length; i++) {
            tString += argv_fullFLV[i] + " ";
            // log.debug(" i " + i + " argv-i " + argv_fullFLV[i]);
        }
        log.debug(tString);
        log.debug("END generateFullFLV ################# ");

        returnLog.add(ProcessHelper.executeScript("generateFullFLV", argv_fullFLV));

        flvRecording.setFileHash(hashFileFullNameFlv);

        // Extract first Image for preview purpose
        // ffmpeg -i movie.flv -vcodec mjpeg -vframes 1 -an -f rawvideo -s
        // 320x240 movie.jpg

        String hashFileFullNameJPEG = "flvRecording_" + flvRecording.getFlvRecordingId() + ".jpg";
        String outPutJpeg = new File(streamFolderGeneral, hashFileFullNameJPEG).getCanonicalPath();
        deleteFileIfExists(outPutJpeg);

        flvRecording.setPreviewImage(hashFileFullNameJPEG);

        String[] argv_previewFLV = new String[] { //
                this.getPathToFFMPEG(), //
                "-i", outputFullFlv, //
                "-vcodec", "mjpeg", //
                "-vframes", "100", "-an", //
                "-f", "rawvideo", //
                "-s", flvWidth + "x" + flvHeight, //
                outPutJpeg };

        log.debug("START previewFullFLV ################# ");
        log.debug(argv_previewFLV.toString());
        String kString = "";
        for (int i = 0; i < argv_previewFLV.length; i++) {
            kString += argv_previewFLV[i] + " ";
        }
        log.debug(kString);
        log.debug("END previewFullFLV ################# ");

        returnLog.add(ProcessHelper.executeScript("generateFullFLV", argv_previewFLV));

        String alternateDownloadName = "flvRecording_" + flvRecording.getFlvRecordingId() + ".avi";
        String alternateDownloadFullName = new File(streamFolderGeneral, alternateDownloadName)
                .getCanonicalPath();
        deleteFileIfExists(alternateDownloadFullName);

        String[] argv_alternateDownload = new String[] { this.getPathToFFMPEG(), "-i", outputFullFlv,
                alternateDownloadFullName };

        log.debug("START alternateDownLoad ################# ");
        log.debug(argv_previewFLV.toString());
        String sString = "";
        for (int i = 0; i < argv_alternateDownload.length; i++) {
            sString += argv_alternateDownload[i] + " ";
        }
        log.debug(sString);
        log.debug("END alternateDownLoad ################# ");

        returnLog.add(ProcessHelper.executeScript("alternateDownload", argv_alternateDownload));

        flvRecording.setAlternateDownload(alternateDownloadName);

        flvRecordingDaoImpl.updateFlvRecording(flvRecording);

        flvRecordingLogDaoImpl.deleteFLVRecordingLogByRecordingId(flvRecording.getFlvRecordingId());

        for (ConverterProcessResult returnMap : returnLog) {
            flvRecordingLogDaoImpl.addFLVRecordingLog("generateFFMPEG", flvRecording, returnMap);
        }

        // Delete Wave Files
        for (String fileName : listOfFullWaveFiles) {
            File audio = new File(fileName);
            if (audio.exists()) {
                audio.delete();
            }
        }

        // Delete all Image temp dirs
        for (FlvRecordingMetaData flvRecordingMetaData : metaDataList) {
            FileHelper.removeRec(new File(streamFolder, "" + flvRecordingMetaData.getFlvRecordingMetaDataId()));
        }

        FileHelper.removeRec(new File(outputImageMergedData));

    } catch (Exception err) {
        log.error("[stripAudioFromFLVs]", err);
    }
}

From source file:acmi.l2.clientmod.l2smr.Controller.java

private void updateSMAPane() {
    Platform.runLater(() -> {/* w w  w .  ja  v  a 2s .co m*/
        smaPane.setDisable(true);
        Arrays.stream(new TextField[] { locationX, locationY, locationZ, rotationPitch, rotationYaw,
                rotationRoll, drawScale3DX, drawScale3DY, drawScale3DZ, drawScale, rotationPitchRate,
                rotationYawRate, rotationRollRate, zoneState }).forEach(this::clearTextAndDisable);
        actorStaticMeshChooser.getSelectionModel().clearSelection();

        Actor actor2 = table.getSelectionModel().getSelectedItem();
        if (actor2 == null)
            return;

        smaPane.setDisable(false);
        float[] location = actor2.getLocation();
        if (location != null) {
            setTextAndEnable(locationX, String.valueOf(location[0]));
            setTextAndEnable(locationY, String.valueOf(location[1]));
            setTextAndEnable(locationZ, String.valueOf(location[2]));
        }
        int[] rotator = actor2.getRotation();
        if (rotator != null) {
            setTextAndEnable(rotationPitch, String.valueOf(rotator[0]));
            setTextAndEnable(rotationYaw, String.valueOf(rotator[1]));
            setTextAndEnable(rotationRoll, String.valueOf(rotator[2]));
        }
        Float ds = actor2.getScale();
        if (ds != null) {
            setTextAndEnable(drawScale, ds.toString());
        }
        float[] drawScale3D = actor2.getScale3D();
        if (drawScale3D != null) {
            setTextAndEnable(drawScale3DX, String.valueOf(drawScale3D[0]));
            setTextAndEnable(drawScale3DY, String.valueOf(drawScale3D[1]));
            setTextAndEnable(drawScale3DZ, String.valueOf(drawScale3D[2]));
        }
        int[] rotationRate = actor2.getRotationRate();
        if (rotationRate != null) {
            setTextAndEnable(rotationPitchRate, String.valueOf(rotationRate[0]));
            setTextAndEnable(rotationYawRate, String.valueOf(rotationRate[1]));
            setTextAndEnable(rotationRollRate, String.valueOf(rotationRate[2]));
        }
        int[] zoneRenderState = actor2.getZoneRenderState();
        if (zoneRenderState != null) {
            String s = Arrays.toString(zoneRenderState);
            setTextAndEnable(zoneState, s.substring(1, s.length() - 1));
        }
        actorStaticMeshChooser.getSelectionModel().select(indexIf(actorStaticMeshChooser.getItems(),
                ie -> ie.getObjectReference() == actor2.getStaticMeshRef()));
    });
}

From source file:org.commonjava.indy.stats.IndyDeprecatedApis.java

public IndyDeprecatedApis(Properties props) {
    this.props = props;

    Float minVersion = 0f;

    Set<String> keys = props.stringPropertyNames();
    for (String key : keys) {
        DeprecatedApiEntry et;/*from   w w w. j  av  a2s.c o m*/
        String value = props.getProperty(key);

        Float startVersion;
        Float endVersion;

        if (key.indexOf(",") >= 0) // range
        {
            key = key.replaceAll("[\\[|\\]]", ""); // strip off square brackets if present
            String[] kv = key.split(",");
            startVersion = Float.parseFloat(kv[0].trim());
            endVersion = Float.parseFloat(kv[1].trim());
            et = new DeprecatedApiEntry(new FloatRange(startVersion, endVersion), value);
        } else {
            endVersion = Float.parseFloat(key.trim());
            et = new DeprecatedApiEntry(endVersion, value);
        }

        // Calculate minApiVersion
        if (et.isOff()) {
            minVersion = endVersion + 0.1f;
        }
        deprecatedApis.add(et);
    }

    minApiVersion = minVersion.toString();

    logger.debug("Parsed deprecatedApis:{}, minApiVersion:{}", deprecatedApis, minApiVersion);
}