示例#1
0
static int init_decoder(int32_t fmtp[12]) {
  alac_file *alac;

  frame_size = fmtp[1]; // stereo samples
  sampling_rate = fmtp[11];

  int sample_size = fmtp[3];
  if (sample_size != 16)
    die("only 16-bit samples supported!");

  alac = alac_create(sample_size, 2);
  if (!alac)
    return 1;
  decoder_info = alac;

  alac->setinfo_max_samples_per_frame = frame_size;
  alac->setinfo_7a = fmtp[2];
  alac->setinfo_sample_size = sample_size;
  alac->setinfo_rice_historymult = fmtp[4];
  alac->setinfo_rice_initialhistory = fmtp[5];
  alac->setinfo_rice_kmodifier = fmtp[6];
  alac->setinfo_7f = fmtp[7];
  alac->setinfo_80 = fmtp[8];
  alac->setinfo_82 = fmtp[9];
  alac->setinfo_86 = fmtp[10];
  alac->setinfo_8a_rate = fmtp[11];
  alac_allocate_buffers(alac);
  return 0;
}
示例#2
0
JNIEXPORT void JNICALL Java_com_realtek_cast_util_Alac_setupAlac(JNIEnv* env, jclass clazz,
		jint frameSize, jint i7a, jint sampleSize, jint riceHistoryMult, jint riceInitHistory, jint riceKModifier, jint i7f, jint i80, jint i82, jint i86, jint i8a) {
	s_alac->setinfo_max_samples_per_frame = (uint32_t)frameSize;
	s_alac->setinfo_7a = (uint8_t)i7a;
	s_alac->setinfo_sample_size = (uint8_t)sampleSize;
	s_alac->setinfo_rice_historymult = (uint8_t)riceHistoryMult;
	s_alac->setinfo_rice_initialhistory = (uint8_t)riceInitHistory;
	s_alac->setinfo_rice_kmodifier = (uint8_t)riceKModifier;
	s_alac->setinfo_7f = (uint8_t)i7f;
	s_alac->setinfo_80 = (uint16_t)i80;
	s_alac->setinfo_82 = (uint32_t)i82;
	s_alac->setinfo_86 = (uint32_t)i86;
	s_alac->setinfo_8a_rate = (uint32_t)i8a;

	alac_allocate_buffers(s_alac);
}
示例#3
0
文件: alac.cpp 项目: Volcanoscar/note
void alac_set_info(alac_file *alac, char *inputbuffer)
{
  char *ptr = inputbuffer;
  ptr += 4; /* size */
  ptr += 4; /* frma */
  ptr += 4; /* alac */
  ptr += 4; /* size */
  ptr += 4; /* alac */

  ptr += 4; /* 0 ? */

  alac->setinfo_max_samples_per_frame = *(uint32_t*)ptr; /* buffer size / 2 ? */
  if (!host_bigendian)
      _Swap32(alac->setinfo_max_samples_per_frame);
  ptr += 4;
  alac->setinfo_7a = *(uint8_t*)ptr;
  ptr += 1;
  alac->setinfo_sample_size = *(uint8_t*)ptr;
  ptr += 1;
  alac->setinfo_rice_historymult = *(uint8_t*)ptr;
  ptr += 1;
  alac->setinfo_rice_initialhistory = *(uint8_t*)ptr;
  ptr += 1;
  alac->setinfo_rice_kmodifier = *(uint8_t*)ptr;
  ptr += 1;
  alac->setinfo_7f = *(uint8_t*)ptr;
  ptr += 1;
  alac->setinfo_80 = *(uint16_t*)ptr;
  if (!host_bigendian)
      _Swap16(alac->setinfo_80);
  ptr += 2;
  alac->setinfo_82 = *(uint32_t*)ptr;
  if (!host_bigendian)
      _Swap32(alac->setinfo_82);
  ptr += 4;
  alac->setinfo_86 = *(uint32_t*)ptr;
  if (!host_bigendian)
      _Swap32(alac->setinfo_86);
  ptr += 4;
  alac->setinfo_8a_rate = *(uint32_t*)ptr;
  if (!host_bigendian)
      _Swap32(alac->setinfo_8a_rate);

  alac_allocate_buffers(alac);

}