本文整理汇总了Java中com.googlecode.mp4parser.util.Matrix类的典型用法代码示例。如果您正苦于以下问题:Java Matrix类的具体用法?Java Matrix怎么用?Java Matrix使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Matrix类属于com.googlecode.mp4parser.util包,在下文中一共展示了Matrix类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _parseDetails
import com.googlecode.mp4parser.util.Matrix; //导入依赖的package包/类
@Override
public void _parseDetails(ByteBuffer content) {
parseVersionAndFlags(content);
if (getVersion() == 1) {
creationTime = DateHelper.convert(IsoTypeReader.readUInt64(content));
modificationTime = DateHelper.convert(IsoTypeReader.readUInt64(content));
trackId = IsoTypeReader.readUInt32(content);
IsoTypeReader.readUInt32(content);
duration = IsoTypeReader.readUInt64(content);
} else {
creationTime = DateHelper.convert(IsoTypeReader.readUInt32(content));
modificationTime = DateHelper.convert(IsoTypeReader.readUInt32(content));
trackId = IsoTypeReader.readUInt32(content);
IsoTypeReader.readUInt32(content);
duration = IsoTypeReader.readUInt32(content);
} // 196
IsoTypeReader.readUInt32(content);
IsoTypeReader.readUInt32(content);
layer = IsoTypeReader.readUInt16(content); // 204
alternateGroup = IsoTypeReader.readUInt16(content);
volume = IsoTypeReader.readFixedPoint88(content);
IsoTypeReader.readUInt16(content); // 212
matrix = Matrix.fromByteBuffer(content);
width = IsoTypeReader.readFixedPoint1616(content); // 248
height = IsoTypeReader.readFixedPoint1616(content);
}
示例2: muxerFileDebug
import com.googlecode.mp4parser.util.Matrix; //导入依赖的package包/类
public static void muxerFileDebug(){
try
{
File input = new File(SDCardUtils.getExternalSdCardPath() + "/a.h264");
File output = new File(SDCardUtils.getExternalSdCardPath() + "/b.mp4");
H264TrackImpl h264Track = new H264TrackImpl(new FileDataSourceImpl(input), "eng", UriParser.videoQuality.framerate, 1);
Movie m = new Movie();
m.addTrack(h264Track);
m.setMatrix(Matrix.ROTATE_90);
Container out = new DefaultMp4Builder().build(m);
MovieHeaderBox mvhd = Path.getPath(out, "moov/mvhd");
mvhd.setMatrix(Matrix.ROTATE_90);
TrackBox trackBox = Path.getPath(out, "moov/trak");
TrackHeaderBox tkhd = trackBox.getTrackHeaderBox();
tkhd.setMatrix(Matrix.ROTATE_90);
FileChannel fc = new FileOutputStream(output.getAbsolutePath()).getChannel();
out.writeContainer(fc);
fc.close();
}
catch (IOException e) {
Log.e("test", "some exception", e);
}
}
示例3: setRotation
import com.googlecode.mp4parser.util.Matrix; //导入依赖的package包/类
public void setRotation(int angle) {
if (angle == 0) {
matrix = Matrix.ROTATE_0;
} else if (angle == 90) {
matrix = Matrix.ROTATE_90;
} else if (angle == 180) {
matrix = Matrix.ROTATE_180;
} else if (angle == 270) {
matrix = Matrix.ROTATE_270;
}
}
示例4: _parseDetails
import com.googlecode.mp4parser.util.Matrix; //导入依赖的package包/类
@Override
public void _parseDetails(ByteBuffer content) {
parseVersionAndFlags(content);
if (getVersion() == 1) {
creationTime = DateHelper.convert(IsoTypeReader.readUInt64(content));
modificationTime = DateHelper.convert(IsoTypeReader.readUInt64(content));
timescale = IsoTypeReader.readUInt32(content);
duration = IsoTypeReader.readUInt64(content);
} else {
creationTime = DateHelper.convert(IsoTypeReader.readUInt32(content));
modificationTime = DateHelper.convert(IsoTypeReader.readUInt32(content));
timescale = IsoTypeReader.readUInt32(content);
duration = IsoTypeReader.readUInt32(content);
}
rate = IsoTypeReader.readFixedPoint1616(content);
volume = IsoTypeReader.readFixedPoint88(content);
IsoTypeReader.readUInt16(content);
IsoTypeReader.readUInt32(content);
IsoTypeReader.readUInt32(content);
matrix = Matrix.fromByteBuffer(content);
previewTime = content.getInt();
previewDuration = content.getInt();
posterTime = content.getInt();
selectionTime = content.getInt();
selectionDuration = content.getInt();
currentTime = content.getInt();
nextTrackId = IsoTypeReader.readUInt32(content);
}
示例5: saveVideoTagToFile
import com.googlecode.mp4parser.util.Matrix; //导入依赖的package包/类
public static ActionImageData saveVideoTagToFile(Bitmap bitmap, String saveDirectory,
String filename, String videoPath) {
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
mediaMetadataRetriever.setDataSource(videoPath);
int videoWidth;
int rotation = getRotation(mediaMetadataRetriever);
switch (rotation) {
case 90:
case 270:
videoWidth =
Integer.parseInt(mediaMetadataRetriever
.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT));
break;
default:
videoWidth =
Integer.parseInt(mediaMetadataRetriever
.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH));
break;
}
mediaMetadataRetriever.release();
android.graphics.Matrix matrix = new android.graphics.Matrix();
matrix
.postScale(videoWidth / (float) bitmap.getWidth(), videoWidth / (float) bitmap.getWidth());
Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(),
bitmap.getHeight(), matrix, false);
return new ActionImageData(videoWidth / (float) bitmap.getWidth(),
FileUtils.saveVideoTagToFile(resizedBitmap, saveDirectory,
filename, rotation));
}
示例6: saveActionToFile
import com.googlecode.mp4parser.util.Matrix; //导入依赖的package包/类
public static ActionImageData saveActionToFile(Context context, Bitmap bitmap,
String saveDirectory,
String filename, String videoPath) {
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
mediaMetadataRetriever.setDataSource(videoPath);
int videoWidth;
int rotation = getRotation(mediaMetadataRetriever);
switch (rotation) {
case 90:
case 270:
videoWidth =
Integer.parseInt(mediaMetadataRetriever
.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT));
break;
default:
videoWidth =
Integer.parseInt(mediaMetadataRetriever
.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH));
break;
}
mediaMetadataRetriever.release();
android.graphics.Matrix matrix = new android.graphics.Matrix();
matrix
.postScale(
videoWidth / ((float) SystemUtils.getScreenWidthPx()
- context.getResources().getDimensionPixelSize(R.dimen.edit_center_margin) * 2),
videoWidth
/ ((float) SystemUtils.getScreenWidthPx()
- context.getResources().getDimensionPixelSize(R.dimen.edit_center_margin) * 2));
Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(),
bitmap.getHeight(), matrix, false);
return new ActionImageData(videoWidth / (float) bitmap.getWidth(),
FileUtils.saveVideoTagToFile(resizedBitmap, saveDirectory,
filename, rotation));
}
示例7: startTrim
import com.googlecode.mp4parser.util.Matrix; //导入依赖的package包/类
public static void startTrim(File src, File dst, double startTime, double endTime) throws IOException {
FileDataSourceImpl file = new FileDataSourceImpl(src);
Movie movie = MovieCreator.build(file);
List<Track> tracks = movie.getTracks();
movie.setTracks(new LinkedList<Track>());
Log.d(TAG, "startTrim: " + startTime + " " + endTime);
for (Track track : tracks) {
long currentSample = 0;
double currentTime = 0;
long startSample = -1;
long endSample = -1;
for (int i = 0; i < track.getSampleDurations().length; i++) {
if (currentTime <= startTime) {
// current sample is still before the new starttime
startSample = currentSample;
}
if (currentTime <= endTime) {
// current sample is after the new start time and still before the new endtime
endSample = currentSample;
} else {
// current sample is after the end of the cropped video
break;
}
currentTime += (double) track.getSampleDurations()[i] / (double) track.getTrackMetaData().getTimescale();
currentSample++;
}
movie.addTrack(new CroppedTrack(track, startSample, endSample));
}
Container out = new DefaultMp4Builder().build(movie);
MovieHeaderBox mvhd = Path.getPath(out, "moov/mvhd");
mvhd.setMatrix(Matrix.ROTATE_180);
if (!dst.exists()) {
dst.createNewFile();
}
FileOutputStream fos = new FileOutputStream(dst);
WritableByteChannel fc = fos.getChannel();
try {
out.writeContainer(fc);
}catch (Exception e){
e.printStackTrace();
} finally {
fc.close();
fos.close();
file.close();
}
}
示例8: setRotationMatrix
import com.googlecode.mp4parser.util.Matrix; //导入依赖的package包/类
public static void setRotationMatrix(int iDegree){
if(iDegree == 90)
sMatrix = Matrix.ROTATE_90;
else if(iDegree == 180)
sMatrix = Matrix.ROTATE_180;
else
sMatrix = Matrix.ROTATE_0;
}
示例9: addViewForValue
import com.googlecode.mp4parser.util.Matrix; //导入依赖的package包/类
private void addViewForValue( String key, Object value ) {
if ( value instanceof String[] ) {
addStringArrayView( key, (String[]) value );
} else if ( value instanceof Matrix ) {
addMatrixView( key, (Matrix) value );
} else {
addTextView( key, value );
}
}
示例10: addMatrixView
import com.googlecode.mp4parser.util.Matrix; //导入依赖的package包/类
private void addMatrixView( String key, Matrix matrix ) {
ByteBuffer bb = ByteBuffer.allocate( Double.SIZE * 9 );
matrix.getContent( bb );
bb.rewind();
double a = IsoTypeReader.readFixedPoint1616( bb );
double b = IsoTypeReader.readFixedPoint1616( bb );
double u = IsoTypeReader.readFixedPoint0230( bb );
double c = IsoTypeReader.readFixedPoint1616( bb );
double d = IsoTypeReader.readFixedPoint1616( bb );
double v = IsoTypeReader.readFixedPoint0230( bb );
double tx = IsoTypeReader.readFixedPoint1616( bb );
double ty = IsoTypeReader.readFixedPoint1616( bb );
double w = IsoTypeReader.readFixedPoint0230( bb );
Double[] matrixArray = new Double[9];
matrixArray[0] = a;
matrixArray[1] = b;
matrixArray[2] = u;
matrixArray[3] = c;
matrixArray[4] = d;
matrixArray[5] = v;
matrixArray[6] = tx;
matrixArray[7] = ty;
matrixArray[8] = w;
RelativeLayout layout = (RelativeLayout) View.inflate( getContext(), R.layout.matrix_layout, null );
TextView textView = (TextView) layout.findViewById( R.id.matrix_title );
textView.setText( "Matrix:" );
GridView gridView = (GridView) layout.findViewById( R.id.matrix_grid );
ArrayAdapter<Double> adapter = new ArrayAdapter<Double>( getContext(), R.layout.matrix_item_layout, matrixArray );
gridView.setAdapter( adapter );
mBaseLayout.addView( layout );
}
示例11: GetMatrixFromRotation
import com.googlecode.mp4parser.util.Matrix; //导入依赖的package包/类
private static Matrix GetMatrixFromRotation( int rotation ) {
switch ( rotation ) {
case 90:
return Matrix.ROTATE_90;
case 180:
return Matrix.ROTATE_180;
case 270:
return Matrix.ROTATE_270;
default:
case 0:
return Matrix.ROTATE_0;
}
}
示例12: getMatrix
import com.googlecode.mp4parser.util.Matrix; //导入依赖的package包/类
public Matrix getMatrix() {
return matrix;
}
示例13: createTrackBox
import com.googlecode.mp4parser.util.Matrix; //导入依赖的package包/类
protected TrackBox createTrackBox(Track track, Mp4Movie movie) {
TrackBox trackBox = new TrackBox();
TrackHeaderBox tkhd = new TrackHeaderBox();
tkhd.setEnabled(true);
tkhd.setInMovie(true);
tkhd.setInPreview(true);
if (track.isAudio()) {
tkhd.setMatrix(Matrix.ROTATE_0);
} else {
tkhd.setMatrix(movie.getMatrix());
}
tkhd.setAlternateGroup(0);
tkhd.setCreationTime(track.getCreationTime());
tkhd.setDuration(track.getDuration() * getTimescale(movie) / track.getTimeScale());
tkhd.setHeight(track.getHeight());
tkhd.setWidth(track.getWidth());
tkhd.setLayer(0);
tkhd.setModificationTime(new Date());
tkhd.setTrackId(track.getTrackId() + 1);
tkhd.setVolume(track.getVolume());
trackBox.addBox(tkhd);
MediaBox mdia = new MediaBox();
trackBox.addBox(mdia);
MediaHeaderBox mdhd = new MediaHeaderBox();
mdhd.setCreationTime(track.getCreationTime());
mdhd.setDuration(track.getDuration());
mdhd.setTimescale(track.getTimeScale());
mdhd.setLanguage("eng");
mdia.addBox(mdhd);
HandlerBox hdlr = new HandlerBox();
hdlr.setName(track.isAudio() ? "SoundHandle" : "VideoHandle");
hdlr.setHandlerType(track.getHandler());
mdia.addBox(hdlr);
MediaInformationBox minf = new MediaInformationBox();
minf.addBox(track.getMediaHeaderBox());
DataInformationBox dinf = new DataInformationBox();
DataReferenceBox dref = new DataReferenceBox();
dinf.addBox(dref);
DataEntryUrlBox url = new DataEntryUrlBox();
url.setFlags(1);
dref.addBox(url);
minf.addBox(dinf);
Box stbl = createStbl(track);
minf.addBox(stbl);
mdia.addBox(minf);
return trackBox;
}
示例14: setMatrix
import com.googlecode.mp4parser.util.Matrix; //导入依赖的package包/类
public void setMatrix(Matrix m) {
this.matrix = m;
}
示例15: setMatrix
import com.googlecode.mp4parser.util.Matrix; //导入依赖的package包/类
public void setMatrix(Matrix matrix) {
this.matrix = matrix;
}