/**
 * The main function for the record helper.
 *
 * @param argc number of arguments from the command line
 * @param argv command line arguments
 * @return 0 ok, 1 on error
 */
int
main (int argc, char *argv[])
{
  GNUNET_assert (GNUNET_OK ==
		 GNUNET_log_setup ("gnunet-helper-audio-record",
				   "WARNING",
				   NULL));
  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
	      "Audio source starts\n");
  audio_message = GNUNET_malloc (UINT16_MAX);
  audio_message->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO);

#ifdef DEBUG_RECORD_PURE_OGG
  dump_pure_ogg = getenv ("GNUNET_RECORD_PURE_OGG") ? 1 : 0;
#endif
  ogg_init ();
  opus_init ();
  pa_init ();
  return 0;
}
Esempio n. 2
0
int _init_decoder(audio_decoder_p decoder, void *dec_ext)
{
	priv_data_p priv = (priv_data_p) decoder->priv_data;
	assert(priv != NULL);

	// Init private data
	priv->mCurrentPos = 0;
	priv->mFixedHeader = 0;
	memset(&(priv->pcm), 0, sizeof(pcm_data_t));

	switch (decoder->audio_type) {
	case AUDIO_TYPE_MP3: {
		int ret = mp3_init(decoder, dec_ext);
		RETURN_VAL_IF_FAIL((ret == AUDIO_DECODER_OK), ret);
		break;
	}

	case AUDIO_TYPE_AAC: {
		int ret = aac_init(decoder, dec_ext);
		RETURN_VAL_IF_FAIL((ret == AUDIO_DECODER_OK), ret);
		break;
	}

#ifdef CONFIG_CODEC_LIBOPUS
	case AUDIO_TYPE_OPUS: {
		int ret = opus_init(decoder, dec_ext);
		RETURN_VAL_IF_FAIL((ret == AUDIO_DECODER_OK), ret);
		break;
	}
#endif

	default:
		// Maybe do not need to init, return success.
		return AUDIO_DECODER_OK;
	}

	return AUDIO_DECODER_OK;
}