コード例 #1
0
ファイル: libovd.cpp プロジェクト: h16o2u9u/rtoss
BOOL ovd_parse_stream(ovd_stream_buf* buf)
{
	ovd_handle* handle = (ovd_handle*)buf->handle;

	ogg_sync_wrote(handle->oy, buf->len);
	if (ogg_sync_pageout(handle->oy, &handle->og) != 1)
		goto fail;

//	ogg_stream_init(&handle->os, ogg_page_serialno(&handle->og));
	handle->os = ogg_stream_create(ogg_page_serialno(&handle->og));
	vorbis_info_init(&handle->vi);
    vorbis_comment_init(&handle->vc);
	if (ogg_stream_pagein(handle->os, &handle->og) < 0)
		goto fail;

	if (ogg_stream_packetout(handle->os,&handle->op) != 1)
		goto fail;

	if (vorbis_synthesis_headerin(&handle->vi, &handle->vc, &handle->op) < 0)
		goto fail;

	handle->init = 0;
	handle->eof = 0;
	ovd_header_init(handle);

	buf->buf = ogg_sync_bufferin(handle->oy, OVD_STREAM_BUF_LEN);
	buf->len = OVD_STREAM_BUF_LEN;
	return TRUE;
fail:
//	ogg_sync_init(&handle->oy);
	handle->oy = ogg_sync_create();
	buf->buf = ogg_sync_bufferin(handle->oy, OVD_STREAM_BUF_LEN);
	buf->len = OVD_STREAM_BUF_LEN;
	return FALSE;
}
コード例 #2
0
ファイル: vorbisfile.c プロジェクト: h16o2u9u/rtoss
/* read a little more data from the file/pipe into the ogg_sync framer */
static long _get_data(OggVorbis_File *vf){
  errno=0;
  if(vf->datasource){
    unsigned char *buffer=ogg_sync_bufferin(vf->oy,CHUNKSIZE);
    long bytes=(vf->callbacks.read_func)(buffer,1,CHUNKSIZE,vf->datasource);
    if(bytes>0)ogg_sync_wrote(vf->oy,bytes);
    if(bytes==0 && errno)return(-1);
    return(bytes);
  }else
    return(0);
}
コード例 #3
0
ファイル: libovd.cpp プロジェクト: h16o2u9u/rtoss
ovd_stream_buf* ovd_init_stream()
{
	ovd_handle* handle = new ovd_handle;
	memset(handle, 0, sizeof(ovd_handle));

//	ogg_sync_init(&handle->oy);
	handle->oy = ogg_sync_create();

	ovd_stream_buf* ret = new ovd_stream_buf;
	ret->handle = (HANDLE)handle;
	ret->buf = ogg_sync_bufferin(handle->oy, OVD_STREAM_BUF_LEN);
	ret->len = OVD_STREAM_BUF_LEN;

	return ret;
}
コード例 #4
0
ファイル: vorbisfile.c プロジェクト: IVBeatz/genplus-gx
/* read a little more data from the file/pipe into the ogg_sync framer */
static long _get_data(OggVorbis_File *vf){
  errno=0;
  if(vf->datasource){
    unsigned char *buffer=ogg_sync_bufferin(vf->oy,CHUNKSIZE);
    long bytes=(vf->callbacks.read_func)(buffer,1,CHUNKSIZE,vf->datasource);
    if(bytes>0)ogg_sync_wrote(vf->oy,bytes);

#ifndef GEKKO
    else if(bytes==0 && errno ) 
#else
    // Not sure what is up with this... appears that EOVERFLOW is set whenever
    // we read to the end of the file...
    // original patch by raz0red for Mednafen-Wii
    else if(bytes==0 && errno && errno != EOVERFLOW ) 
#endif
    {
      return(-1);
    }
    return(bytes);
  }else
コード例 #5
0
ファイル: libovd.cpp プロジェクト: h16o2u9u/rtoss
BOOL ovd_reparse_stream(ovd_stream_buf* buf)
{
	ovd_handle* handle = (ovd_handle*)buf->handle;

	if (buf->len) {
		ogg_sync_wrote(handle->oy, buf->len);
		int result = ogg_sync_pageout(handle->oy, &handle->og);
		if (result == 0) {
			buf->len = OVD_STREAM_BUF_LEN;
			return TRUE;
		}
		else if (result < 0)
			return FALSE;
	}

//	ogg_stream_init(&handle->os, ogg_page_serialno(&handle->og));
	handle->os = ogg_stream_create(ogg_page_serialno(&handle->og));
	vorbis_info_init(&handle->vi);
    vorbis_comment_init(&handle->vc);
	if (ogg_stream_pagein(handle->os, &handle->og) < 0)
		return FALSE;

	if (ogg_stream_packetout(handle->os,&handle->op) != 1)
		return FALSE;

	if (vorbis_synthesis_headerin(&handle->vi, &handle->vc, &handle->op) < 0)
		return FALSE;

	handle->init = 0;
	handle->eof = 0;
	ovd_header_init(handle);

	buf->buf = ogg_sync_bufferin(handle->oy, OVD_STREAM_BUF_LEN);
	buf->len = OVD_STREAM_BUF_LEN;
	return TRUE;
}