當前位置: 首頁>>代碼示例>>Java>>正文


Java MediaFormat.setByteBuffer方法代碼示例

本文整理匯總了Java中android.media.MediaFormat.setByteBuffer方法的典型用法代碼示例。如果您正苦於以下問題:Java MediaFormat.setByteBuffer方法的具體用法?Java MediaFormat.setByteBuffer怎麽用?Java MediaFormat.setByteBuffer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.media.MediaFormat的用法示例。


在下文中一共展示了MediaFormat.setByteBuffer方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: configureDecoder

import android.media.MediaFormat; //導入方法依賴的package包/類
private static MediaCodec configureDecoder(ImageInfo info, int maxInputSize, Surface surface) {
    if (mDecoderSupportedSize.getWidth() < info.size.getWidth() || mDecoderSupportedSize.getHeight() < info.size.getHeight()) {
        Log.w(TAG, "HEVC image may exceed decoder capability");
    }
    try {
        MediaCodec decoder = MediaCodec.createByCodecName(mDecoderName);
        MediaFormat inputFormat = MediaFormat.createVideoFormat(
                MediaFormat.MIMETYPE_VIDEO_HEVC, info.size.getWidth(), info.size.getHeight());
        inputFormat.setInteger(MediaFormat.KEY_MAX_INPUT_SIZE, maxInputSize);
        inputFormat.setByteBuffer("csd-0", info.paramset);
        Log.d(TAG, "HEVC input-format=" + inputFormat);
        decoder.configure(inputFormat, surface, null, 0);
        return decoder;
    }  catch (IOException ex) {
        throw new RuntimeException("no HEVC decoding support");
    }
}
 
開發者ID:yohhoy,項目名稱:heifreader,代碼行數:18,代碼來源:HeifReader.java

示例2: getFrameworkMediaFormatV16

import android.media.MediaFormat; //導入方法依賴的package包/類
/**
 * Returns a {@link MediaFormat} representation of this format.
 */
@SuppressLint("InlinedApi")
@TargetApi(16)
public final MediaFormat getFrameworkMediaFormatV16() {
  MediaFormat format = new MediaFormat();
  format.setString(MediaFormat.KEY_MIME, sampleMimeType);
  maybeSetStringV16(format, MediaFormat.KEY_LANGUAGE, language);
  maybeSetIntegerV16(format, MediaFormat.KEY_MAX_INPUT_SIZE, maxInputSize);
  maybeSetIntegerV16(format, MediaFormat.KEY_WIDTH, width);
  maybeSetIntegerV16(format, MediaFormat.KEY_HEIGHT, height);
  maybeSetFloatV16(format, MediaFormat.KEY_FRAME_RATE, frameRate);
  maybeSetIntegerV16(format, "rotation-degrees", rotationDegrees);
  maybeSetIntegerV16(format, MediaFormat.KEY_CHANNEL_COUNT, channelCount);
  maybeSetIntegerV16(format, MediaFormat.KEY_SAMPLE_RATE, sampleRate);
  maybeSetIntegerV16(format, "encoder-delay", encoderDelay);
  maybeSetIntegerV16(format, "encoder-padding", encoderPadding);
  for (int i = 0; i < initializationData.size(); i++) {
    format.setByteBuffer("csd-" + i, ByteBuffer.wrap(initializationData.get(i)));
  }
  maybeSetColorInfoV24(format, colorInfo);
  return format;
}
 
開發者ID:sanjaysingh1990,項目名稱:Exoplayer2Radio,代碼行數:25,代碼來源:Format.java

示例3: setAacFormatSpecificData

import android.media.MediaFormat; //導入方法依賴的package包/類
private static void setAacFormatSpecificData(MediaFormat format, Fmtp fmtp) {
    String params = fmtp.formatSpecificParams;
    String configString = null;
    String[] paramsSplit = params.split(";");
    for (String param : paramsSplit) {
        param = param.trim();
        String[] paramSplit = param.split("=");
        if (paramSplit[0].toLowerCase().equals("config") && paramSplit.length == 2) {
            configString = paramSplit[1];
        }
    }
    format.setByteBuffer("csd-0", ByteBuffer.wrap(Utils.hexStringToByteArray(configString)));
}
 
開發者ID:devinbrown7,項目名稱:streaminglib,代碼行數:14,代碼來源:MediaFormatHelper.java

示例4: CreateCodec

import android.media.MediaFormat; //導入方法依賴的package包/類
public  int CreateCodec(ByteBuffer bbcsd){
	Log.i(TAG, "HardwareDecoder:CreateCodec");
	
    int   videoHeight  	= mAPlayerAndroid.getVideoHeight();
    int   videoWidth   	= mAPlayerAndroid.getVideoWidth();
    long  duration      = mAPlayerAndroid.getDuration() * 1000L;

    Surface surface = null;
    if(mSurfaceType == 0){
        surface = mAPlayerAndroid.getInnerSurface();
    }else if(mSurfaceType == 2) {
        surface = mAPlayerAndroid.getInnerSurface();
        int surfaceWidth  = mAPlayerAndroid.getViewSurfaceWidth();
        int surfaceHeight = mAPlayerAndroid.getViewSurfaceHeight();
        mSurfaceRenderer = new SurfaceRenderer(mAPlayerAndroid,surface,surfaceWidth,surfaceHeight,videoHeight,videoWidth);
        surface =  mSurfaceRenderer.GetSurface();
    }else if(mSurfaceType == 3){

    }


    if(surface == null){
        Log.e(TAG,"HardWareDecoder CreateCodec surface == null");
        return -1;
    }
    
    mBbcsd = bbcsd;

    MediaFormat mediaFormat = new MediaFormat();
    mediaFormat.setInteger(MediaFormat.KEY_HEIGHT, videoHeight);
    mediaFormat.setInteger(MediaFormat.KEY_WIDTH, videoWidth);
    mediaFormat.setString(MediaFormat.KEY_MIME, mAVCodeIDToMime.get(mCodeId));
    mediaFormat.setLong(MediaFormat.KEY_DURATION, duration);

    if(mBbcsd != null){
        mediaFormat.setByteBuffer("csd-0", mBbcsd);
        mBbcsd.position(0);
    }


    return CreateCodec(mediaFormat, surface) ? 1 : 0;
}
 
開發者ID:lzmlsfe,項目名稱:19porn,代碼行數:43,代碼來源:HardwareDecoder.java

示例5: maybeSetByteBufferV16

import android.media.MediaFormat; //導入方法依賴的package包/類
@TargetApi(16)
private static void maybeSetByteBufferV16(MediaFormat format, String key, byte[] value) {
  if (value != null) {
    format.setByteBuffer(key, ByteBuffer.wrap(value));
  }
}
 
開發者ID:sanjaysingh1990,項目名稱:Exoplayer2Radio,代碼行數:7,代碼來源:Format.java


注:本文中的android.media.MediaFormat.setByteBuffer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。