Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 786ecf84 authored by Gil Dobjanschi's avatar Gil Dobjanschi
Browse files

Added a callback interface to the generatePreview method.

Change-Id: I7ba678aba47f232e1c320bb36decf59f80f3755d
parent fff4ab09
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
@@ -97,6 +97,31 @@ public interface VideoEditor {
        public void onProgress(VideoEditor videoEditor, String filename, int progress);
    }

    /**
     * This listener interface is used by the VideoEditor to emit export status
     * notifications.
     * {@link #generatePreview(MediaProcessingProgressListener listener)}
     */
    public interface MediaProcessingProgressListener {
        // Values used for the action parameter
        public static final int ACTION_ENCODE = 1;
        public static final int ACTION_DECODE = 2;

        /**
         * This method notifies the listener of the progress status of
         * processing a media object such as a Transition, AudioTrack or a
         * media image item (when Ken Burns effect is applied).
         * This method may be called maximum 100 times for one operation.
         *
         * @param object The object that is being processed such as a
         *          Transition or AudioTrack
         * @param action The type of processing being performed
         * @param progress The progress in %. At the beginning of the operation,
         *          this value is set to 0; at the end, the value is set to 100.
         */
        public void onProgress(Object item, int action, int progress);
    }

    /**
     * @return The path where the VideoEditor stores all files related to the
     * project
@@ -496,8 +521,11 @@ public interface VideoEditor {
     * This method must be called after the aspect ratio of the project changes
     * and before startPreview is called. Note that this method may block for
     * an extensive period of time.
     *
     * @param listener The listener interface which will be used to notify
     *  the caller of the progress of each storyboard item being processed.
     */
    public void generatePreview();
    public void generatePreview(MediaProcessingProgressListener listener);

    /**
     * Start the preview of all the storyboard items applied on all MediaItems
+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ public class VideoEditorFactory {

        final VideoEditor videoEditor = (VideoEditor)ct.newInstance(arglist);
        if (generatePreview) {
            videoEditor.generatePreview();
            videoEditor.generatePreview(null);
        }
        return videoEditor;
    }
+1 −1
Original line number Diff line number Diff line
@@ -1055,7 +1055,7 @@ public class VideoEditorTestImpl implements VideoEditor {
    /*
     * {@inheritDoc}
     */
    public void generatePreview() {
    public void generatePreview(MediaProcessingProgressListener listener) {
        // Generate all the needed transitions
        for (Transition transition : mTransitions) {
            if (!transition.isGenerated()) {