/*-
 * #%L
 * Scenery-backed 3D visualization package for ImageJ.
 * %%
 * Copyright (C) 2016 - 2018 SciView developers.
 * %%
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 * #L%
 */
package sc.iview.commands.view;

import graphics.scenery.utils.*;
import org.scijava.command.*;
import org.scijava.module.*;
import org.scijava.plugin.Menu;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;
import sc.iview.SciView;

import java.util.*;
import java.util.stream.*;

import static org.scijava.widget.ChoiceWidget.LIST_BOX_STYLE;
import static sc.iview.commands.MenuWeights.*;

@Plugin(type = Command.class, menuRoot = "SciView", //
        menu = { @Menu(label = "View", weight = VIEW), //
                 @Menu(label = "Start recording video", weight = VIEW_START_RECORDING_VIDEO) })
public class StartRecordingVideo extends InteractiveCommand {

    @Parameter
    private SciView sciView;

    @Parameter(min = "0.1", max = "100.0", label = "Bitrate (MBit)")
    private float bitrate = 5.0f;// 5 MBit

    @Parameter(style = LIST_BOX_STYLE, label = "Video Encoding Quality", initializer = "initializeQualities")
    private String videoEncodingQuality = "Medium";

    private void initializeQualities() {
        System.out.println("initializing fields");
        final MutableModuleItem<String> qualityInput = getInfo().getMutableInput( "videoEncodingQuality", String.class );
        final List<String> qualities = Arrays.stream(VideoEncodingQuality.values()).map(Enum::name).collect(Collectors.toList());
        qualityInput.setChoices(qualities);
    }

    @Override
    public void run() {

        bitrate = Math.max(0,bitrate);
        sciView.getScenerySettings().set("VideoEncoder.Bitrate", Math.round(bitrate * 1024.0f * 1024.0f));
        sciView.getScenerySettings().set("VideoEncoder.Quality", videoEncodingQuality);
        sciView.toggleRecordVideo();
    }
}

@@ -1480,91 +1480,35 @@
 ort 
-graphics.scenery.utils.*;%0Aimport org.scijava.command.*;%0Aimport org.scijava.module.*
+org.scijava.command.Command
 ;%0Aim
@@ -1638,118 +1638,8 @@
 w;%0A%0A
-import java.util.*;%0Aimport java.util.stream.*;%0A%0Aimport static org.scijava.widget.ChoiceWidget.LIST_BOX_STYLE;%0A
 impo
@@ -1928,27 +1928,19 @@
 deo 
-extend
+implement
 s 
-Interactive
 Comm
@@ -2123,549 +2123,370 @@
 ter(
-style = LIST_BOX_STYLE, label = %22Video Encoding Quality%22, initializer = %22initializeQualities%22)%0A    private String videoEncodingQuality = %22Medium%22;%0A%0A    private void initializeQualities() %7B%0A        System.out.println(%22initializing fields%22);%0A        final MutableModuleItem%3CString%3E qualityInput = getInfo().getMutableInput( %22videoEncodingQuality%22, String.class );%0A        final List%3CString%3E qualities = Arrays.stream(VideoEncodingQuality.values()).map(Enum::name).collect(Collectors.toList());%0A        qualityInput.setChoices(qualities);%0A    %7D
+choices=%7B%22VeryLow%22, %22Low%22, %22Medium%22, %22High%22, %22Ultra%22, %22Insane%22%7D, style=%22listBox%22, label = %22Video Encoding Quality%22)%0A    private String videoEncodingQuality = %22Medium%22;// listed as an enum here, cant access from java https://github.com/scenerygraphics/scenery/blob/1a451c2864e5a48e47622d9313fe1681e47d7958/src/main/kotlin/graphics/scenery/utils/H264Encoder.kt#L65
 %0A%0A  
@@ -2521,17 +2521,16 @@
 run() %7B%0A
-%0A
         
@@ -2798,10 +2798,9 @@
 ;%0A    %7D%0A
+
 %7D
-%0A

Undo InteractiveCommand breakage to StartRecordingVideo