int
main (int argc, char ** argv)
{
  OGGZ * oggz;
  OggzTable * tracks;
  long n;

  if (argc < 2) {
    printf ("usage: %s filename\n", argv[0]);
  }

  tracks = oggz_table_new ();

  if ((oggz = oggz_open ((char *)argv[1], OGGZ_READ | OGGZ_AUTO)) == NULL) {
    printf ("unable to open file %s\n", argv[1]);
    exit (1);
  }

  oggz_set_read_page (oggz, -1, read_page, tracks);

  while ((n = oggz_read (oggz, 1024)) > 0);

  oggz_close (oggz);

  oggz_table_delete (tracks);

  exit (0);
}
Beispiel #2
0
void load_ogg_file(const char *filename)
{
	OGGZ *oggz;

	oggz = oggz_open(filename, OGGZ_READ | OGGZ_AUTO);
	if ( oggz == NULL )
	{
		mylog("Error opening ogg file\n");
	}
	mylog("Successfully opened ogg file %s\n", filename);

	// Initialize internal streams
	audio_stream = calloc(1, sizeof(struct ogg_stream));
	video_stream = calloc(1, sizeof(struct ogg_stream));

	oggz_set_read_callback(oggz, -1, read_cb, NULL);
	oggz_set_read_page(oggz, -1, read_page_cb, NULL);

	oggz_run(oggz);

	//mylog("Audio stream, serialno=%d\n", audio_stream->serialno);
	//dump_stream(audio_stream);
	//mylog("Video stream, serialno=%d\n", video_stream->serialno);
	//dump_stream(video_stream);

	oggz_close(oggz);
}
static inline OMX_ERRORTYPE
set_read_page_callback (oggdmux_prc_t * ap_prc, OggzReadPage ap_read_cback)
{
  assert (ap_prc);
  assert (ap_read_cback);
  if (oggz_set_read_page (ap_prc->p_oggz_, ALL_OGG_STREAMS, ap_read_cback,
                          ap_prc)
      < 0)
    {
      TIZ_ERROR (handleOf (ap_prc),
                 "[OMX_ErrorInsufficientResources] : "
                 "Could not set read page callback.");
      return OMX_ErrorInsufficientResources;
    }
  return OMX_ErrorNone;
}