/** * Finds sps & pps parameters inside a .mp4. * * @param path Path to the file to analyze * @throws IOException * @throws FileNotFoundException */ public MP4Config(String path) throws IOException, FileNotFoundException { StsdBox stsdBox; // We open the mp4 file mp4Parser = new MP4Parser(path); // We parse it try { mp4Parser.parse(); } catch (IOException ignore) { // Maybe enough of the file has been parsed and we can get the stsd box } // We find the stsdBox stsdBox = mp4Parser.getStsdBox(); mPPS = stsdBox.getB64PPS(); mSPS = stsdBox.getB64SPS(); mProfilLevel = stsdBox.getProfileLevel(); // We're done ! mp4Parser.close(); }
public MP4Config(String sps, String pps) { mPPS = pps; mSPS = sps; mProfilLevel = MP4Parser.toHexString(Base64.decode(sps, Base64.NO_WRAP), 1, 3); }
public MP4Config(byte[] sps, byte[] pps) { mPPS = Base64.encodeToString(pps, 0, pps.length, Base64.NO_WRAP); mSPS = Base64.encodeToString(sps, 0, sps.length, Base64.NO_WRAP); mProfilLevel = MP4Parser.toHexString(sps, 1, 3); }
public String getProfileLevel() { return MP4Parser.toHexString(sps, 1, 3); }