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


Java CodecSpecificDataUtil.splitNalUnits方法代码示例

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


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

示例1: parseStartTag

import com.google.android.exoplayer.util.CodecSpecificDataUtil; //导入方法依赖的package包/类
@Override
public void parseStartTag(XmlPullParser parser) throws ParserException {
  int type = (Integer) getNormalizedAttribute(KEY_TYPE);
  String value;

  index = parseInt(parser, KEY_INDEX, -1);
  bitrate = parseRequiredInt(parser, KEY_BITRATE);

  if (type == StreamElement.TYPE_VIDEO) {
    maxHeight = parseRequiredInt(parser, KEY_MAX_HEIGHT);
    maxWidth = parseRequiredInt(parser, KEY_MAX_WIDTH);
    mimeType = fourCCToMimeType(parseRequiredString(parser, KEY_FOUR_CC));
  } else {
    maxHeight = -1;
    maxWidth = -1;
    String fourCC = parser.getAttributeValue(null, KEY_FOUR_CC);
    // If fourCC is missing and the stream type is audio, we assume AAC.
    mimeType = fourCC != null ? fourCCToMimeType(fourCC)
        : type == StreamElement.TYPE_AUDIO ? MimeTypes.AUDIO_AAC : null;
  }

  if (type == StreamElement.TYPE_AUDIO) {
    samplingRate = parseRequiredInt(parser, KEY_SAMPLING_RATE);
    channels = parseRequiredInt(parser, KEY_CHANNELS);
  } else {
    samplingRate = -1;
    channels = -1;
  }

  value = parser.getAttributeValue(null, KEY_CODEC_PRIVATE_DATA);
  if (value != null && value.length() > 0) {
    byte[] codecPrivateData = hexStringToByteArray(value);
    byte[][] split = CodecSpecificDataUtil.splitNalUnits(codecPrivateData);
    if (split == null) {
      csd.add(codecPrivateData);
    } else {
      for (int i = 0; i < split.length; i++) {
        csd.add(split[i]);
      }
    }
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:43,代码来源:SmoothStreamingManifestParser.java

示例2: parseStartTag

import com.google.android.exoplayer.util.CodecSpecificDataUtil; //导入方法依赖的package包/类
@Override
public void parseStartTag(XmlPullParser parser) throws ParserException {
  int type = (Integer) getNormalizedAttribute(KEY_TYPE);
  String value;

  index = parseInt(parser, KEY_INDEX, -1);
  bitrate = parseRequiredInt(parser, KEY_BITRATE);
  language = (String) getNormalizedAttribute(KEY_LANGUAGE);

  if (type == StreamElement.TYPE_VIDEO) {
    maxHeight = parseRequiredInt(parser, KEY_MAX_HEIGHT);
    maxWidth = parseRequiredInt(parser, KEY_MAX_WIDTH);
    mimeType = fourCCToMimeType(parseRequiredString(parser, KEY_FOUR_CC));
  } else {
    maxHeight = -1;
    maxWidth = -1;
    String fourCC = parser.getAttributeValue(null, KEY_FOUR_CC);
    // If fourCC is missing and the stream type is audio, we assume AAC.
    mimeType = fourCC != null ? fourCCToMimeType(fourCC)
        : type == StreamElement.TYPE_AUDIO ? MimeTypes.AUDIO_AAC : null;
  }

  if (type == StreamElement.TYPE_AUDIO) {
    samplingRate = parseRequiredInt(parser, KEY_SAMPLING_RATE);
    channels = parseRequiredInt(parser, KEY_CHANNELS);
  } else {
    samplingRate = -1;
    channels = -1;
  }

  value = parser.getAttributeValue(null, KEY_CODEC_PRIVATE_DATA);
  if (value != null && value.length() > 0) {
    byte[] codecPrivateData = Util.getBytesFromHexString(value);
    byte[][] split = CodecSpecificDataUtil.splitNalUnits(codecPrivateData);
    if (split == null) {
      csd.add(codecPrivateData);
    } else {
      for (int i = 0; i < split.length; i++) {
        csd.add(split[i]);
      }
    }
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:44,代码来源:SmoothStreamingManifestParser.java

示例3: parseStartTag

import com.google.android.exoplayer.util.CodecSpecificDataUtil; //导入方法依赖的package包/类
@Override
public void parseStartTag(XmlPullParser parser) throws ParserException {
  int type = (Integer) getNormalizedAttribute(KEY_TYPE);
  content = null;
  String value;

  index = parseInt(parser, KEY_INDEX, -1);
  bitrate = parseRequiredInt(parser, KEY_BITRATE);
  nalUnitLengthField = parseInt(parser, KEY_NAL_UNIT_LENGTH_FIELD, 4);

  if (type == StreamElement.TYPE_VIDEO) {
    maxHeight = parseRequiredInt(parser, KEY_MAX_HEIGHT);
    maxWidth = parseRequiredInt(parser, KEY_MAX_WIDTH);
    mimeType = fourCCToMimeType(parseRequiredString(parser, KEY_FOUR_CC));
  } else {
    maxHeight = -1;
    maxWidth = -1;
    String fourCC = parser.getAttributeValue(null, KEY_FOUR_CC);
    // If fourCC is missing and the stream type is audio, we assume AAC.
    mimeType = fourCC != null ? fourCCToMimeType(fourCC)
        : type == StreamElement.TYPE_AUDIO ? MimeTypes.AUDIO_AAC : null;
  }

  if (type == StreamElement.TYPE_AUDIO) {
    samplingRate = parseRequiredInt(parser, KEY_SAMPLING_RATE);
    channels = parseRequiredInt(parser, KEY_CHANNELS);
    bitPerSample = parseRequiredInt(parser, KEY_BITS_PER_SAMPLE);
    packetSize = parseRequiredInt(parser, KEY_PACKET_SIZE);
    audioTag = parseRequiredInt(parser, KEY_AUDIO_TAG);
  } else {
    samplingRate = -1;
    channels = -1;
    bitPerSample = -1;
    packetSize = -1;
    audioTag = -1;
  }

  value = parser.getAttributeValue(null, KEY_CODEC_PRIVATE_DATA);
  if (value != null && value.length() > 0) {
    byte[] codecPrivateData = hexStringToByteArray(value);
    byte[][] split = CodecSpecificDataUtil.splitNalUnits(codecPrivateData);
    if (split == null) {
      csd.add(codecPrivateData);
    } else {
      for (int i = 0; i < split.length; i++) {
        Pair<Integer, Integer> spsParameters = CodecSpecificDataUtil.parseSpsNalUnit(split[i]);
        if (spsParameters != null) {
          profile = spsParameters.first;
          level = spsParameters.second;
        }
        csd.add(split[i]);
      }
    }
  }
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:56,代码来源:SmoothStreamingManifestParser.java

示例4: parseStartTag

import com.google.android.exoplayer.util.CodecSpecificDataUtil; //导入方法依赖的package包/类
@Override
public void parseStartTag(XmlPullParser parser) throws ParserException {
  int type = (Integer) getNormalizedAttribute(KEY_TYPE);
  content = null;
  String value;

  index = parseInt(parser, KEY_INDEX, -1);
  bitrate = parseRequiredInt(parser, KEY_BITRATE);
  nalUnitLengthField = parseInt(parser, KEY_NAL_UNIT_LENGTH_FIELD, 4);

  if (type == StreamElement.TYPE_VIDEO) {
    maxHeight = parseRequiredInt(parser, KEY_MAX_HEIGHT);
    maxWidth = parseRequiredInt(parser, KEY_MAX_WIDTH);
    fourCC = parseRequiredString(parser, KEY_FOUR_CC);
  } else {
    maxHeight = -1;
    maxWidth = -1;
    fourCC = parser.getAttributeValue(null, KEY_FOUR_CC);
  }

  if (type == StreamElement.TYPE_AUDIO) {
    samplingRate = parseRequiredInt(parser, KEY_SAMPLING_RATE);
    channels = parseRequiredInt(parser, KEY_CHANNELS);
    bitPerSample = parseRequiredInt(parser, KEY_BITS_PER_SAMPLE);
    packetSize = parseRequiredInt(parser, KEY_PACKET_SIZE);
    audioTag = parseRequiredInt(parser, KEY_AUDIO_TAG);
  } else {
    samplingRate = -1;
    channels = -1;
    bitPerSample = -1;
    packetSize = -1;
    audioTag = -1;
  }

  value = parser.getAttributeValue(null, KEY_CODEC_PRIVATE_DATA);
  if (value != null && value.length() > 0) {
    byte[] codecPrivateData = hexStringToByteArray(value);
    byte[][] split = CodecSpecificDataUtil.splitNalUnits(codecPrivateData);
    if (split == null) {
      csd.add(codecPrivateData);
    } else {
      for (int i = 0; i < split.length; i++) {
        Pair<Integer, Integer> spsParameters = CodecSpecificDataUtil.parseSpsNalUnit(split[i]);
        if (spsParameters != null) {
          profile = spsParameters.first;
          level = spsParameters.second;
        }
        csd.add(split[i]);
      }
    }
  }
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:53,代码来源:SmoothStreamingManifestParser.java


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