Commit daf9a0d5 authored by conrad's avatar conrad

add API functions for getting and seting preroll:

oggz_get_preroll(), oggz_set_preroll()
Set preroll in oggz_auto.c for vorbis and speex


git-svn-id: http://svn.annodex.net/liboggz/trunk@3795 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent b9f6bdb4
......@@ -258,6 +258,30 @@ long oggz_seek_packets (OGGZ * oggz, long serialno, long packets, int whence);
* \{
*/
/**
* Retrieve the preroll of a logical bitstream.
* \param oggz An OGGZ handle
* \param serialno Identify the logical bitstream in \a oggz
* \returns The preroll of the specified logical bitstream.
* \retval OGGZ_ERR_BAD_SERIALNO \a serialno does not identify an existing
* logical bitstream in \a oggz.
* \retval OGGZ_ERR_BAD_OGGZ \a oggz does not refer to an existing OGGZ
*/
int oggz_get_preroll (OGGZ * oggz, long serialno);
/**
* Specify the preroll of a logical bitstream.
* \param oggz An OGGZ handle
* \param serialno Identify the logical bitstream in \a oggz to attach
* this preroll to.
* \param preroll The preroll
* \returns 0 Success
* \retval OGGZ_ERR_BAD_SERIALNO \a serialno does not identify an existing
* logical bitstream in \a oggz.
* \retval OGGZ_ERR_BAD_OGGZ \a oggz does not refer to an existing OGGZ
*/
int oggz_set_preroll (OGGZ * oggz, long serialno, int preroll);
/**
* Retrieve the granuleshift of a logical bitstream.
* \param oggz An OGGZ handle
......
......@@ -38,6 +38,8 @@
oggz_get_granulerate;
oggz_set_granuleshift;
oggz_get_granuleshift;
oggz_set_preroll;
oggz_get_preroll;
oggz_tell;
oggz_tell_granulepos;
......
......@@ -94,6 +94,8 @@ auto_speex (OGGZ * oggz, long serialno, unsigned char * data, long length, void
oggz_set_granulerate (oggz, serialno, granule_rate, OGGZ_AUTO_MULT);
oggz_set_preroll (oggz, serialno, 3);
numheaders = (ogg_int64_t) INT32_LE_AT(&header[68]) + 2;
oggz_stream_set_numheaders (oggz, serialno, numheaders);
......@@ -115,6 +117,8 @@ auto_vorbis (OGGZ * oggz, long serialno, unsigned char * data, long length, void
oggz_set_granulerate (oggz, serialno, granule_rate, OGGZ_AUTO_MULT);
oggz_set_preroll (oggz, serialno, 2);
oggz_stream_set_numheaders (oggz, serialno, 3);
return 1;
......
......@@ -279,9 +279,11 @@ oggz_get_granulerate (OGGZ * oggz, long serialno,
ogg_int64_t * granulerate_d);
int oggz_set_granuleshift (OGGZ * oggz, long serialno, int granuleshift);
int oggz_get_granuleshift (OGGZ * oggz, long serialno);
int oggz_set_preroll (OGGZ * oggz, long serialno, int preroll);
int oggz_get_preroll (OGGZ * oggz, long serialno);
/* oggz_auto */
int
......
......@@ -86,3 +86,30 @@ oggz_stream_get_numheaders (OGGZ * oggz, long serialno)
return stream->numheaders;
}
int
oggz_set_preroll (OGGZ * oggz, long serialno, int preroll)
{
oggz_stream_t * stream;
if (oggz == NULL) return OGGZ_ERR_BAD_OGGZ;
stream = oggz_get_stream (oggz, serialno);
if (stream == NULL) return OGGZ_ERR_BAD_SERIALNO;
stream->preroll = preroll;
return 0;
}
int
oggz_get_preroll (OGGZ * oggz, long serialno)
{
oggz_stream_t * stream;
if (oggz == NULL) return OGGZ_ERR_BAD_OGGZ;
stream = oggz_get_stream (oggz, serialno);
if (stream == NULL) return OGGZ_ERR_BAD_SERIALNO;
return stream->preroll;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment