当前位置: 首页>>代码示例>>Java>>正文


Java TrackHeaderBox.setMatrix方法代码示例

本文整理汇总了Java中com.coremedia.iso.boxes.TrackHeaderBox.setMatrix方法的典型用法代码示例。如果您正苦于以下问题:Java TrackHeaderBox.setMatrix方法的具体用法?Java TrackHeaderBox.setMatrix怎么用?Java TrackHeaderBox.setMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.coremedia.iso.boxes.TrackHeaderBox的用法示例。


在下文中一共展示了TrackHeaderBox.setMatrix方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: muxerFileDebug

import com.coremedia.iso.boxes.TrackHeaderBox; //导入方法依赖的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);
	}	
}
 
开发者ID:xunboo,项目名称:JJCamera,代码行数:26,代码来源:MP4Muxer.java

示例2: createTrackBox

import com.coremedia.iso.boxes.TrackHeaderBox; //导入方法依赖的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;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:56,代码来源:MP4Builder.java

示例3: createTrackBox

import com.coremedia.iso.boxes.TrackHeaderBox; //导入方法依赖的package包/类
private 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.setModificationTime(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.setModificationTime(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;
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:58,代码来源:SrsMp4Muxer.java

示例4: RotateVideo

import com.coremedia.iso.boxes.TrackHeaderBox; //导入方法依赖的package包/类
public static Uri RotateVideo( Uri uri, int rotation ) {

      Uri rotatedVideoUri = null;

      try {
         IsoFile file = new IsoFile( uri.toString() );

         List<Box> boxes = file.getMovieBox().getBoxes();

         for ( Box box : boxes ) {
            if ( box instanceof TrackBox ) {
               TrackBox trackBox = (TrackBox) box;
               
               HandlerBox handlerBox = trackBox.getMediaBox().getHandlerBox();
               if ( handlerBox.getHandlerType().toLowerCase( Locale.US ).equals( "vide" ) ) {
                  TrackHeaderBox trackHeaderBox = trackBox.getTrackHeaderBox();
                  trackHeaderBox.setMatrix( GetMatrixFromRotation( rotation ) );
               }
            }
         }

         String pathWithoutExtension = uri.toString().replace( ".mp4", "" );

         String rotatedFileName = String.format( Locale.US, "%s_rotated_to_%d.mp4", pathWithoutExtension, rotation );

         FileOutputStream videoFileOutputStream = new FileOutputStream( rotatedFileName );
         file.getBox( videoFileOutputStream.getChannel() );

         file.close();
         videoFileOutputStream.close();

         rotatedVideoUri = Uri.parse( rotatedFileName );

      } catch ( IOException e ) {
         e.printStackTrace();

         return null;
      }

      return rotatedVideoUri;
   }
 
开发者ID:hoolrory,项目名称:AndroidVideoSamples,代码行数:42,代码来源:MediaHelper.java


注:本文中的com.coremedia.iso.boxes.TrackHeaderBox.setMatrix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。