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

Commit 53f89e12 authored by Gil Dobjanschi's avatar Gil Dobjanschi
Browse files

Added the video editor to the media items and audio track constructors.

Change-Id: I5db229d28c28e17b487257a9c4ed8c5fb7570a8d
parent 572eab6f
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -183,11 +183,13 @@ public class AudioTrack {
     */
    @SuppressWarnings("unused")
    private AudioTrack() throws IOException {
        this(null, null);
        this(null, null, null);
    }

    /**
     * Constructor
     *
     * @param editor The video editor reference
     * @param audioTrackId The audio track id
     * @param filename The absolute file name
     *
@@ -195,7 +197,8 @@ public class AudioTrack {
     * @throws IllegalArgumentException if file format is not supported or if
     *             the codec is not supported
     */
    public AudioTrack(String audioTrackId, String filename) throws IOException {
    public AudioTrack(VideoEditor editor, String audioTrackId, String filename)
            throws IOException {
        mUniqueId = audioTrackId;
        mFilename = filename;
        mStartTimeMs = 0;
+5 −3
Original line number Diff line number Diff line
@@ -53,12 +53,13 @@ public class MediaImageItem extends MediaItem {
     */
    @SuppressWarnings("unused")
    private MediaImageItem() throws IOException {
        this(null, null, 0, RENDERING_MODE_BLACK_BORDER);
        this(null, null, null, 0, RENDERING_MODE_BLACK_BORDER);
    }

    /**
     * Constructor
     *
     * @param editor The video editor reference
     * @param mediaItemId The media item id
     * @param filename The image file name
     * @param durationMs The duration of the image on the storyboard
@@ -66,9 +67,10 @@ public class MediaImageItem extends MediaItem {
     *
     * @throws IOException
     */
    public MediaImageItem(String mediaItemId, String filename, long durationMs, int renderingMode)
    public MediaImageItem(VideoEditor editor, String mediaItemId, String filename, long durationMs,
            int renderingMode)
            throws IOException {
        super(mediaItemId, filename, renderingMode);
        super(editor, mediaItemId, filename, renderingMode);

        // Determine the dimensions of the image
        final BitmapFactory.Options dbo = new BitmapFactory.Options();
+3 −1
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ public abstract class MediaItem {
    /**
     * Constructor
     *
     * @param editor The video editor reference
     * @param mediaItemId The MediaItem id
     * @param filename name of the media file.
     * @param renderingMode The rendering mode
@@ -79,7 +80,8 @@ public abstract class MediaItem {
     *             supported the exception object contains the unsupported
     *             capability
     */
    protected MediaItem(String mediaItemId, String filename, int renderingMode) throws IOException {
    protected MediaItem(VideoEditor editor, String mediaItemId, String filename,
            int renderingMode) throws IOException {
        mUniqueId = mediaItemId;
        mFilename = filename;
        mRenderingMode = renderingMode;
+8 −5
Original line number Diff line number Diff line
@@ -192,26 +192,29 @@ public class MediaVideoItem extends MediaItem {
     */
    @SuppressWarnings("unused")
    private MediaVideoItem() throws IOException {
        this(null, null, RENDERING_MODE_BLACK_BORDER);
        this(null, null, null, RENDERING_MODE_BLACK_BORDER);
    }

    /**
     * Constructor
     *
     * @param editor The video editor reference
     * @param mediaItemId The MediaItem id
     * @param filename The image file name
     * @param renderingMode The rendering mode
     *
     * @throws IOException if the file cannot be opened for reading
     */
    public MediaVideoItem(String mediaItemId, String filename, int renderingMode)
    public MediaVideoItem(VideoEditor editor, String mediaItemId, String filename,
            int renderingMode)
        throws IOException {
        this(mediaItemId, filename, renderingMode, 0, END_OF_FILE, 100, false, null);
        this(editor, mediaItemId, filename, renderingMode, 0, END_OF_FILE, 100, false, null);
    }

    /**
     * Constructor
     *
     * @param editor The video editor reference
     * @param mediaItemId The MediaItem id
     * @param filename The image file name
     * @param renderingMode The rendering mode
@@ -226,10 +229,10 @@ public class MediaVideoItem extends MediaItem {
     *
     * @throws IOException if the file cannot be opened for reading
     */
    MediaVideoItem(String mediaItemId, String filename, int renderingMode,
    MediaVideoItem(VideoEditor editor, String mediaItemId, String filename, int renderingMode,
            long beginMs, long endMs, int volumePercent, boolean muted,
            String audioWaveformFilename)  throws IOException {
        super(mediaItemId, filename, renderingMode);
        super(editor, mediaItemId, filename, renderingMode);
        // TODO: Set these variables correctly
        mWidth = 1080;
        mHeight = 720;
+2 −2
Original line number Diff line number Diff line
@@ -765,7 +765,7 @@ public class VideoEditorTestImpl implements VideoEditor {
                        if (MediaImageItem.class.getSimpleName().equals(type)) {
                            final long durationMs = Long.parseLong(parser.getAttributeValue("",
                                    ATTR_DURATION));
                            currentMediaItem = new MediaImageItem(mediaItemId, filename,
                            currentMediaItem = new MediaImageItem(this, mediaItemId, filename,
                                    durationMs, renderingMode);
                        } else if (MediaVideoItem.class.getSimpleName().equals(type)) {
                            final long beginMs = Long.parseLong(parser.getAttributeValue("",
@@ -778,7 +778,7 @@ public class VideoEditorTestImpl implements VideoEditor {
                                    ATTR_MUTED));
                            final String audioWaveformFilename = parser.getAttributeValue("",
                                    ATTR_AUDIO_WAVEFORM_FILENAME);
                            currentMediaItem = new MediaVideoItem(mediaItemId, filename,
                            currentMediaItem = new MediaVideoItem(this, mediaItemId, filename,
                                    renderingMode, beginMs, endMs, volume, muted,
                                    audioWaveformFilename);