Java Code Examples for com.google.android.exoplayer2.util.MimeTypes#getAudioMediaMimeType()

The following examples show how to use com.google.android.exoplayer2.util.MimeTypes#getAudioMediaMimeType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DashManifestParser.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Derives a sample mimeType from a container mimeType and codecs attribute.
 *
 * @param containerMimeType The mimeType of the container.
 * @param codecs The codecs attribute.
 * @return The derived sample mimeType, or null if it could not be derived.
 */
private static String getSampleMimeType(String containerMimeType, String codecs) {
  if (MimeTypes.isAudio(containerMimeType)) {
    return MimeTypes.getAudioMediaMimeType(codecs);
  } else if (MimeTypes.isVideo(containerMimeType)) {
    return MimeTypes.getVideoMediaMimeType(codecs);
  } else if (mimeTypeIsRawText(containerMimeType)) {
    return containerMimeType;
  } else if (MimeTypes.APPLICATION_MP4.equals(containerMimeType)) {
    if ("stpp".equals(codecs)) {
      return MimeTypes.APPLICATION_TTML;
    } else if ("wvtt".equals(codecs)) {
      return MimeTypes.APPLICATION_MP4VTT;
    }
  } else if (MimeTypes.APPLICATION_RAWCC.equals(containerMimeType)) {
    if (codecs != null) {
      if (codecs.contains("cea708")) {
        return MimeTypes.APPLICATION_CEA708;
      } else if (codecs.contains("eia608") || codecs.contains("cea608")) {
        return MimeTypes.APPLICATION_CEA608;
      }
    }
    return null;
  }
  return null;
}
 
Example 2
Source File: DashManifestParser.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Derives a sample mimeType from a container mimeType and codecs attribute.
 *
 * @param containerMimeType The mimeType of the container.
 * @param codecs The codecs attribute.
 * @return The derived sample mimeType, or null if it could not be derived.
 */
private static String getSampleMimeType(String containerMimeType, String codecs) {
  if (MimeTypes.isAudio(containerMimeType)) {
    return MimeTypes.getAudioMediaMimeType(codecs);
  } else if (MimeTypes.isVideo(containerMimeType)) {
    return MimeTypes.getVideoMediaMimeType(codecs);
  } else if (mimeTypeIsRawText(containerMimeType)) {
    return containerMimeType;
  } else if (MimeTypes.APPLICATION_MP4.equals(containerMimeType)) {
    if ("stpp".equals(codecs)) {
      return MimeTypes.APPLICATION_TTML;
    } else if ("wvtt".equals(codecs)) {
      return MimeTypes.APPLICATION_MP4VTT;
    }
  } else if (MimeTypes.APPLICATION_RAWCC.equals(containerMimeType)) {
    if (codecs != null) {
      if (codecs.contains("cea708")) {
        return MimeTypes.APPLICATION_CEA708;
      } else if (codecs.contains("eia608") || codecs.contains("cea608")) {
        return MimeTypes.APPLICATION_CEA608;
      }
    }
    return null;
  }
  return null;
}
 
Example 3
Source File: DashManifestParser.java    From K-Sonic with MIT License 6 votes vote down vote up
/**
 * Derives a sample mimeType from a container mimeType and codecs attribute.
 *
 * @param containerMimeType The mimeType of the container.
 * @param codecs The codecs attribute.
 * @return The derived sample mimeType, or null if it could not be derived.
 */
private static String getSampleMimeType(String containerMimeType, String codecs) {
  if (MimeTypes.isAudio(containerMimeType)) {
    return MimeTypes.getAudioMediaMimeType(codecs);
  } else if (MimeTypes.isVideo(containerMimeType)) {
    return MimeTypes.getVideoMediaMimeType(codecs);
  } else if (mimeTypeIsRawText(containerMimeType)) {
    return containerMimeType;
  } else if (MimeTypes.APPLICATION_MP4.equals(containerMimeType)) {
    if ("stpp".equals(codecs)) {
      return MimeTypes.APPLICATION_TTML;
    } else if ("wvtt".equals(codecs)) {
      return MimeTypes.APPLICATION_MP4VTT;
    }
  } else if (MimeTypes.APPLICATION_RAWCC.equals(containerMimeType)) {
    if (codecs != null) {
      if (codecs.contains("cea708")) {
        return MimeTypes.APPLICATION_CEA708;
      } else if (codecs.contains("eia608") || codecs.contains("cea608")) {
        return MimeTypes.APPLICATION_CEA608;
      }
    }
    return null;
  }
  return null;
}
 
Example 4
Source File: DashManifestParser.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Derives a sample mimeType from a container mimeType and codecs attribute.
 *
 * @param containerMimeType The mimeType of the container.
 * @param codecs The codecs attribute.
 * @return The derived sample mimeType, or null if it could not be derived.
 */
@Nullable
private static String getSampleMimeType(
    @Nullable String containerMimeType, @Nullable String codecs) {
  if (MimeTypes.isAudio(containerMimeType)) {
    return MimeTypes.getAudioMediaMimeType(codecs);
  } else if (MimeTypes.isVideo(containerMimeType)) {
    return MimeTypes.getVideoMediaMimeType(codecs);
  } else if (mimeTypeIsRawText(containerMimeType)) {
    return containerMimeType;
  } else if (MimeTypes.APPLICATION_MP4.equals(containerMimeType)) {
    if (codecs != null) {
      if (codecs.startsWith("stpp")) {
        return MimeTypes.APPLICATION_TTML;
      } else if (codecs.startsWith("wvtt")) {
        return MimeTypes.APPLICATION_MP4VTT;
      }
    }
  } else if (MimeTypes.APPLICATION_RAWCC.equals(containerMimeType)) {
    if (codecs != null) {
      if (codecs.contains("cea708")) {
        return MimeTypes.APPLICATION_CEA708;
      } else if (codecs.contains("eia608") || codecs.contains("cea608")) {
        return MimeTypes.APPLICATION_CEA608;
      }
    }
    return null;
  }
  return null;
}
 
Example 5
Source File: DashManifestParser.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Derives a sample mimeType from a container mimeType and codecs attribute.
 *
 * @param containerMimeType The mimeType of the container.
 * @param codecs The codecs attribute.
 * @return The derived sample mimeType, or null if it could not be derived.
 */
private static String getSampleMimeType(String containerMimeType, String codecs) {
  if (MimeTypes.isAudio(containerMimeType)) {
    return MimeTypes.getAudioMediaMimeType(codecs);
  } else if (MimeTypes.isVideo(containerMimeType)) {
    return MimeTypes.getVideoMediaMimeType(codecs);
  } else if (mimeTypeIsRawText(containerMimeType)) {
    return containerMimeType;
  } else if (MimeTypes.APPLICATION_MP4.equals(containerMimeType)) {
    if (codecs != null) {
      if (codecs.startsWith("stpp")) {
        return MimeTypes.APPLICATION_TTML;
      } else if (codecs.startsWith("wvtt")) {
        return MimeTypes.APPLICATION_MP4VTT;
      }
    }
  } else if (MimeTypes.APPLICATION_RAWCC.equals(containerMimeType)) {
    if (codecs != null) {
      if (codecs.contains("cea708")) {
        return MimeTypes.APPLICATION_CEA708;
      } else if (codecs.contains("eia608") || codecs.contains("cea608")) {
        return MimeTypes.APPLICATION_CEA608;
      }
    }
    return null;
  }
  return null;
}
 
Example 6
Source File: DashManifestParser.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Derives a sample mimeType from a container mimeType and codecs attribute.
 *
 * @param containerMimeType The mimeType of the container.
 * @param codecs The codecs attribute.
 * @return The derived sample mimeType, or null if it could not be derived.
 */
private static String getSampleMimeType(String containerMimeType, String codecs) {
  if (MimeTypes.isAudio(containerMimeType)) {
    return MimeTypes.getAudioMediaMimeType(codecs);
  } else if (MimeTypes.isVideo(containerMimeType)) {
    return MimeTypes.getVideoMediaMimeType(codecs);
  } else if (mimeTypeIsRawText(containerMimeType)) {
    return containerMimeType;
  } else if (MimeTypes.APPLICATION_MP4.equals(containerMimeType)) {
    if (codecs != null) {
      if (codecs.startsWith("stpp")) {
        return MimeTypes.APPLICATION_TTML;
      } else if (codecs.startsWith("wvtt")) {
        return MimeTypes.APPLICATION_MP4VTT;
      }
    }
  } else if (MimeTypes.APPLICATION_RAWCC.equals(containerMimeType)) {
    if (codecs != null) {
      if (codecs.contains("cea708")) {
        return MimeTypes.APPLICATION_CEA708;
      } else if (codecs.contains("eia608") || codecs.contains("cea608")) {
        return MimeTypes.APPLICATION_CEA608;
      }
    }
    return null;
  }
  return null;
}