Here you can find the source of getNaluStartLength(ByteBuffer buffer)
public static int getNaluStartLength(ByteBuffer buffer)
//package com.java2s; /***/*from w ww .j a v a2s . c o m*/ * The content of this file or document is CONFIDENTIAL and PROPRIETARY * to ChengZhen(anyou@msn.com). It is subject to the terms of a * License Agreement between Licensee and ChengZhen(anyou@msn.com). * restricting among other things, the use, reproduction, distribution * and transfer. Each of the embodiments, including this information and * any derivative work shall retain this copyright notice. * * Copyright (c) 2005-2014 ChengZhen(anyou@msn.com) All Rights Reserved. * */ import java.nio.ByteBuffer; public class Main { public static int getNaluStartLength(ByteBuffer buffer) { if (buffer.remaining() <= 4) { return 0; } // byte 2 if (buffer.get() != 0x00) { return 0; } // byte 3 byte ch = buffer.get(); if (ch == 0x01) { return 3; } else if (ch != 0x00) { return 0; } // byte 4 ch = buffer.get(); if (ch == 0x01) { return 4; } return 0; } }