Search in sources :

Example 1 with DisplayCapture

use of co.videofirst.vft.capture.model.display.DisplayCapture in project vft-capture by videofirst.

the class CaptureStatus method record.

/**
 * Generate a CaptureStatus object from an existing capture status object
 */
public CaptureStatus record(DisplayCapture displayCapture) {
    if (state != CaptureState.recording) {
        // 1) Set started to now
        LocalDateTime started = LocalDateTime.now();
        // 2) Create id from started time + random string
        String id = VftUtils.generateId(started);
        // 3) Create folder (from categories)
        List<String> categoryFolders = VftUtils.getFolderFriendlyCategories(getCategories(), getFeature(), getScenario(), id);
        String folder = String.join("/", categoryFolders);
        // 4) Create and return capture object from existing one
        Capture capture = this.getCapture().toBuilder().started(started).folder(folder).id(id).capture(displayCapture).format(FORMAT_AVI).build();
        // 5) Create VideoStatus object and return
        CaptureStatus captureStatus = new CaptureStatus(this.getCaptureStartParams(), capture, CaptureState.recording);
        return captureStatus;
    }
    // just return the old one
    return this;
}
Also used : LocalDateTime(java.time.LocalDateTime) DisplayCapture(co.videofirst.vft.capture.model.display.DisplayCapture)

Example 2 with DisplayCapture

use of co.videofirst.vft.capture.model.display.DisplayCapture in project vft-capture by videofirst.

the class VideoRecorderMonte method record.

@Override
public void record(VideoRecord videoRecord) {
    try {
        this.videoRecord = videoRecord;
        DisplayCapture displayCapture = videoRecord.getCapture();
        Rectangle captureArea = new Rectangle(displayCapture.getX(), displayCapture.getY(), displayCapture.getWidth(), displayCapture.getHeight());
        screenRecorder = new EnhancedScreenRecorder(graphicsConfiguration, captureArea, fileFormat, screenFormat, mouseFormat, audioFormat, tempFolder);
        screenRecorder.start();
    } catch (IOException ioEx) {
        throw new VideoRecordException("Record exception when starting recording", ioEx);
    } catch (AWTException awtEx) {
        throw new VideoRecordException("Record exception when starting recording", awtEx);
    }
}
Also used : DisplayCapture(co.videofirst.vft.capture.model.display.DisplayCapture) VideoRecordException(co.videofirst.vft.capture.exception.VideoRecordException) Rectangle(java.awt.Rectangle) IOException(java.io.IOException) AWTException(java.awt.AWTException)

Example 3 with DisplayCapture

use of co.videofirst.vft.capture.model.display.DisplayCapture in project vft-capture by videofirst.

the class DefaultDisplayService method drawBorder.

private void drawBorder(Graphics g) {
    DisplayBorder db = displayUpdate.getBorder();
    DisplayCapture dc = displayUpdate.getCapture();
    if (db != null && db.isDisplay()) {
        g.setColor(db.getColor());
        int pad = db.getPadding();
        for (int i = 0; i < db.getWidth(); i++) {
            // draw rectangle for each pixel of width
            int x = dc.getX() - pad;
            int y = dc.getY() - pad;
            int w = dc.getWidth() - 1 + (pad * 2);
            int h = dc.getHeight() - 1 + (pad * 2);
            g.drawRect(x, y, w, h);
            pad++;
        }
    }
}
Also used : DisplayBorder(co.videofirst.vft.capture.model.display.DisplayBorder) DisplayCapture(co.videofirst.vft.capture.model.display.DisplayCapture)

Aggregations

DisplayCapture (co.videofirst.vft.capture.model.display.DisplayCapture)3 VideoRecordException (co.videofirst.vft.capture.exception.VideoRecordException)1 DisplayBorder (co.videofirst.vft.capture.model.display.DisplayBorder)1 AWTException (java.awt.AWTException)1 Rectangle (java.awt.Rectangle)1 IOException (java.io.IOException)1 LocalDateTime (java.time.LocalDateTime)1