...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
package com.flashphoner.mixerlayout; import com.flashphoner.media.mixer.video.presentation.Box; import com.flashphoner.media.mixer.video.presentation.BoxPosition; import com.flashphoner.media.mixer.video.presentation.VideoLayoutsdk.media.IVideoMixerLayout; import com.flashphoner.sdk.media.IVideoMixerLayoutYUVFrame; import comjava.flashphoner.sdk.media.YUVFrameawt.*; import java.util.ArrayList; public class TestLayout extendsimplements VideoLayoutIVideoMixerLayout { private static final int PADDING = 5; @Override public Layout[] computecomputeLayout(YUVFrame[] framesyuvFrames, intString[] strings, int canvasWidth, int canvasHeight) { ArrayList<IVideoMixerLayout.Layout> return computeGrid(frames, canvasWidth, canvasHeightlayout = new ArrayList<>(); } for private IVideoMixerLayout.Layout[] computeGrid(YUVFrame[] frames, int canvasWidth, int canvasHeight(int c = 0; c < yuvFrames.length; c++) { Box mainBox Point prevPoint = new Box(null, Point(); Dimension prevDimension = new Dimension(canvasWidth, canvasHeight); for (int i = 0; i < frames.length; i++if (layout.size() > 0) { Box frameBox = new Box(mainBox, canvasWidth/frames.length, canvasHeight/frames.length); prevPoint.setLocation(layout.get(c-1).getPoint()); prevDimension.setSize(layout.get(c-1).getDimension()); } Point currentPoint = new Point((int) (prevPoint.getX()+prevDimension.getWidth()+PADDING), frameBox.setPosition(BoxPosition.INLINE_HORIZONTAL_CENTER); frameBox.setPaddingLeft(PADDING); frameBox.setPaddingRight(PADDING(int)(prevPoint.getY()+prevDimension.getHeight())); Box frame = new Box(frameBox, frames[i]); layout.add(new IVideoMixerLayout.Layout(currentPoint, new Dimension(canvasWidth/yuvFrames.length, frame.setPosition(BoxPosition.INLINE_HORIZONTAL); frame.fillParent(); } ArrayList<IVideoMixerLayout.Layout> layout = new ArrayList<>( canvasHeight/yuvFrames.length), yuvFrames[c])); mainBox.computeLayout(layout);} return layout.toArray(new IVideoMixerLayout.Layout[layout.size()]); } } |
Then the class should be complied into byte code. To do this, create folder tree accordind to TestLayout class package name
...