Ejemplo n.º 1
0
int main(int argc, char *argv[]) {
  int retval = EXIT_SUCCESS;
  
  char *f;
  if (!(f = *++argv)) {
    fprintf(stderr, "Usage: vorbistest oggfile\n");
    return 1;
  }
  
  ogg_init();
  
  vorbis_stream_t vorbis;
  vorbis_stream_init(&vorbis);

  buf_t packet;
  packet.len = 0;
  packet.size = 0;
  packet.data = NULL;
  buf_alloc(&packet, 512);

  if (!file_open_read(&vorbis.file, f)) {
    fprintf(stderr, "Could not open ogg file: %s\n", f);
    retval = EXIT_FAILURE;
    goto exit;
  }

  if (!vorbis_stream_read_hdrs(&vorbis)) {
    fprintf(stderr, "Stream is not a OGG encapsulated Vorbis stream\n");
    retval = EXIT_FAILURE;
    goto exit;
  }

  while (vorbis_next_packet(&vorbis, &packet) > 0) {
    fprintf(stderr, "Packet length: %lu, size %lu\n", packet.len, packet.size);
    fgetc(stdin);
  }

  file_close(&vorbis.file);
  
 exit:
  vorbis_stream_destroy(&vorbis);
  buf_free(&packet);

  return retval;
}
Ejemplo n.º 2
0
/**
 * 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;
}
Ejemplo n.º 3
0
int music_init(void)
{
	pspTime tm;

	cache_init();

	xrRtcGetCurrentClockLocalTime(&tm);
	srand(tm.microseconds);
	xr_lock_init(&music_l);

#ifdef ENABLE_MPC
	mpc_init();
#endif

#ifdef ENABLE_WAV
	wav_init();
#endif

#ifdef ENABLE_TTA
	tta_init();
#endif

#ifdef ENABLE_APE
	ape_init();
#endif

#ifdef ENABLE_MP3
	mp3_init();
#endif

#ifdef ENABLE_FLAC
	flac_init();
#endif

#ifdef ENABLE_OGG
	ogg_init();
#endif

#ifdef ENABLE_WMA
	wmadrv_init();
#endif

#ifdef ENABLE_WAVPACK
	wv_init();
#endif

#ifdef ENABLE_AT3
	at3_init();
#endif

#ifdef ENABLE_M4A
	m4a_init();
#endif

#ifdef ENABLE_AAC
	aac_init();
#endif

#ifdef ENABLE_AA3
	aa3_init();
#endif

	memset(&g_list, 0, sizeof(g_list));
	g_list.first_time = true;
	g_shuffle.first_time = true;
	stack_init(&played);
	g_music_thread = xrKernelCreateThread("Music Thread",
										  music_thread, 0x12, 0x10000, 0, NULL);

	if (g_music_thread < 0) {
		return -EBUSY;
	}

	xrKernelStartThread(g_music_thread, 0, 0);

	return 0;
}
Ejemplo n.º 4
0
int music_init(void)
{
	u32 seed;

	cache_init();

	seed = sctrlKernelRand();

	if (seed == 0x8002013A) {
		pspTime tm;

		sceRtcGetCurrentClockLocalTime(&tm);
		seed = tm.microseconds;
	}

	srand(seed);
	xr_lock_init(&music_l);

#ifdef ENABLE_MPC
	mpc_init();
#endif

#ifdef ENABLE_WAV
	wav_init();
#endif

#ifdef ENABLE_TTA
	tta_init();
#endif

#ifdef ENABLE_APE
	ape_init();
#endif

#ifdef ENABLE_MP3
	mp3_init();
#endif

#ifdef ENABLE_FLAC
	flac_init();
#endif

#ifdef ENABLE_OGG
	ogg_init();
#endif

#ifdef ENABLE_WMA
	wmadrv_init();
#endif

#ifdef ENABLE_WAVPACK
	wv_init();
#endif

#ifdef ENABLE_AT3
	at3_init();
#endif

#ifdef ENABLE_M4A
	m4a_init();
#endif

#ifdef ENABLE_AAC
	aac_init();
#endif

#ifdef ENABLE_AA3
	aa3_init();
#endif

	musiclist_init(&g_music_list);
	memset(&g_list, 0, sizeof(g_list));
	g_list.first_time = true;
	stack_init(&g_played);
	g_music_thread = sceKernelCreateThread("Music Thread", music_thread, 0x12, 0x10000, 0, NULL);

	if (g_music_thread < 0) {
		return -EBUSY;
	}

	sceKernelStartThread(g_music_thread, 0, 0);

	return 0;
}