Server: FLASHPHONER
Create a custom layout to MIXER
Original Java File:
// Package name should be strictly defined as [login to view URL]
package [login to view URL];
// Import mixer layout interface
import [login to view URL];
// Import YUV frame description
import [login to view URL];
// Import Java packages to use
import java.awt.*;
import [login to view URL];
/**
* Custom mixer layout implementation example
*/
public class TestLayout implements IVideoMixerLayout {
// Pictures padding, should be even (or zero if no padding needed)
private static final int PADDING = 4;
/**
* Function to compute layout, will be called by mixer before encoding output stream picture
* This example computes grid layout
* @param yuvFrames - incoming streams raw pictures array in YUV format
* @param strings - incoming streams names array
* @param canvasWidth - mixer output picture canwas width
* @param canvasHeight - mixer output picture canwas heigth
* @return array of pictures layouts
*/
@Override
public Layout[] computeLayout(YUVFrame[] yuvFrames, String[] strings, int canvasWidth, int canvasHeight) {
// Declare picture layouts list to fill
ArrayList<[login to view URL]> layout = new ArrayList<>();
// Find canvas center height
int canvasCenter = canvasHeight / 2;
// Find frame center
int frameCenter = canvasCenter - (canvasHeight / [login to view URL]) / 2;
// Find every picture dimensions (this are the same for all the pictures because this is grid layout)
int layoutWidth = canvasWidth / [login to view URL] - PADDING;
int layoutHeight = canvasHeight / [login to view URL];
// Iterate through incoming stream pictures array
// Note: streams pictures order corresponds to stream names array, use this to reorder pictures if needed
for (int c = 0; c < [login to view URL]; c++) {
// Use Java AWT Point and Dimension
Point prevPoint = new Point();
Dimension prevDimension = new Dimension();
if ([login to view URL]() > 0) {
// Find previous picture location to calculate next one
[login to view URL]([login to view URL](c - 1).getPoint());
[login to view URL]([login to view URL](c - 1).getDimension());
}
// Set starting point of the picture
Point currentPoint = new Point((int) ([login to view URL]() + [login to view URL]() + PADDING),
frameCenter);
// Create the picture layout passing starting point, dimensions and raw picture YUV frames
[login to view URL](new [login to view URL](currentPoint, new Dimension(layoutWidth,
layoutHeight), yuvFrames[c]));
}
// Return pictures layouts calculated as array
return [login to view URL](new [login to view URL][[login to view URL]()]);
}
}
Its produces videos side by side on screen.
We need to change it .. we need video positions as image attached.
Hi
I am java expert and I can complete yoru job soon.
I have rich experience with java customize layout.
I always focus on the delivery and the best quality.
Let`s discuss with your job via private chat.
Thanks.