u32 gf_media_nalu_next_start_code(const u8 *data, u32 data_len, u32 *sc_size)
{
	u32 v, bpos;
	u32 end;

	bpos = 0;
	end = 0;
	v = 0xffffffff;
	while (!end) {
		/*refill cache*/
		if (bpos == (u32) data_len)
			break;

		v = ( (v<<8) & 0xFFFFFF00) | ((u32) data[bpos]);
		bpos++;
		if (v == 0x00000001) {
			end = bpos-4;
			*sc_size = 4;
			return end;
		}
		else if ( (v & 0x00FFFFFF) == 0x00000001) {
			end = bpos-3;
			*sc_size = 3;
			return end;
		}
	}
	if (!end) end = data_len;
	return (u32) (end);
}
u32 gf_media_nalu_next_start_code(const u8 *data, u32 data_len, u32 *sc_size)
{
	u32 v, bpos;
	u32 end;

	bpos = 0;
	end = 0;
	v = 0xffffffff;
	while (!end) {
		 
		if (bpos == (u32) data_len)
			break;

		v = ( (v<<8) & 0xFFFFFF00) | ((u32) data[bpos]);
		bpos++;
		if (v == 0x00000001) {
			end = bpos-4;
			*sc_size = 4;
			return end;
		}
		else if ( (v & 0x00FFFFFF) == 0x00000001) {
			end = bpos-3;
			*sc_size = 3;
			return end;
		}
	}
	if (!end) end = data_len;
	return (u32) (end);
}