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


Java MediaCodec.getCodecInfo方法代码示例

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


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

示例1: getMediaCodecInfo

import android.media.MediaCodec; //导入方法依赖的package包/类
public static MediaCodecInfo getMediaCodecInfo(MediaCodec mediaCodec)
{
    MediaCodecInfo retCodecInfo = null;
    if (Build.VERSION.SDK_INT < 18) {
        retCodecInfo = null;
    }else {
        retCodecInfo = (null != mediaCodec) ? mediaCodec.getCodecInfo() : null;
    }

    //retCodecInfo.getCapabilitiesForType(mime).getVideoCapabilities()
    return retCodecInfo;
}
 
开发者ID:lzmlsfe,项目名称:19porn,代码行数:13,代码来源:EncodeUtils.java

示例2: getEncodVieoeCapability

import android.media.MediaCodec; //导入方法依赖的package包/类
public static EncodeVideoCapability getEncodVieoeCapability(MediaCodec mediaCodec, String mime)
    {
        if( mediaCodec == null || Build.VERSION.SDK_INT < 18) {
            return null;
        }

        EncodeVideoCapability retCapability = new EncodeVideoCapability();
        //String mime = mEncodeFormat.getValue();
        MediaCodecInfo codecInfo = mediaCodec.getCodecInfo();
        MediaCodecInfo.CodecCapabilities capabilities = codecInfo.getCapabilitiesForType(mime);
        int[] deviceColor = capabilities.colorFormats;
        retCapability.colorFormat = deviceColor;
        MediaCodecInfo.CodecProfileLevel[] profileLevels = capabilities.profileLevels;

        if(null != profileLevels)
        {
            retCapability.profileLevel = new EncodeVideoCapability.ProfileLevel[profileLevels.length];
            for(int i = 0; i < profileLevels.length; ++i)
            {
                retCapability.profileLevel[i] = new EncodeVideoCapability.ProfileLevel(profileLevels[i].profile, profileLevels[i].level);
            }
        }


        Range<Integer> widthRange = null;
        Range<Integer> heightRange = null;
        if(Build.VERSION.SDK_INT >= 21) {
                MediaCodecInfo.VideoCapabilities videoCapabilities = capabilities.getVideoCapabilities();
                heightRange = videoCapabilities.getSupportedHeights();
                widthRange = videoCapabilities.getSupportedWidths();

                retCapability.heightAlignment = videoCapabilities.getHeightAlignment();
                retCapability.widthAlignment  = videoCapabilities.getWidthAlignment();
        }
        else //for old device limite max width / height
        {
//            retCapability.widthUpper = 1280;
//            retCapability.widthLower = 176;
//            retCapability.heightUpper = 720;
//            retCapability.heightLower = 144;

            retCapability.heightAlignment = 2;
            retCapability.widthAlignment = 2;
        }

        if(null != widthRange)
        {
            retCapability.widthUpper = widthRange.getUpper();
            retCapability.widthLower = widthRange.getLower();
        }

        if(null != heightRange)
        {
            retCapability.heightUpper = heightRange.getUpper();
            retCapability.heightLower = heightRange.getLower();
        }

        return retCapability;
    }
 
开发者ID:lzmlsfe,项目名称:19porn,代码行数:60,代码来源:EncodeUtils.java


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