Пример #1
0
static void stream_close(mpg123_handle *fr)
{
	if(fr->rdat.flags & READER_FD_OPENED) compat_close(fr->rdat.filept);

	fr->rdat.filept = 0;

	if(fr->rdat.flags & READER_BUFFERED)  bc_reset(&fr->rdat.buffer);
	if(fr->rdat.flags & READER_HANDLEIO)
	{
		if(fr->rdat.cleanup_handle != NULL) fr->rdat.cleanup_handle(fr->rdat.iohandle);

		fr->rdat.iohandle = NULL;
	}
}
Пример #2
0
off_t feed_set_pos(mpg123_handle *fr, off_t pos)
{
    struct bufferchain *bc = &fr->rdat.buffer;
    if(pos >= bc->fileoff && pos-bc->fileoff < bc->size)
    {   /* We have the position! */
        bc->pos = (ssize_t)(pos - bc->fileoff);
        return pos+bc->size; /* Next input after end of buffer... */
    }
    else
    {   /* I expect to get the specific position on next feed. Forget what I have now. */
        bc_reset(bc);
        bc->fileoff = pos;
        return pos; /* Next input from exactly that position. */
    }
}
Пример #3
0
mpg_off_t feed_set_pos( mpg123_handle_t *fr, mpg_off_t pos )
{
	bufferchain_t	*bc = &fr->rdat.buffer;

	if( pos >= bc->fileoff && pos - bc->fileoff < bc->size )
	{
		// we have the position!
		bc->pos = (mpg_ssize_t)(pos - bc->fileoff);

		// next input after end of buffer...
		return bc->fileoff + bc->size;
	}
	else
	{
		// i expect to get the specific position on next feed. Forget what I have now.
		bc_reset( bc );
		bc->fileoff = pos;

		// next input from exactly that position.
		return pos;
	}
}
Пример #4
0
static void stream_close(mpg123_handle *fr)
{
    if(fr->rdat.flags & READER_FD_OPENED) compat_close(fr->rdat.filept);
    if(fr->rdat.flags & READER_BUFFERED)  bc_reset(&fr->rdat.buffer);
}