⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 seekable_stream_decoder.h

📁 这是著名的TCPMP播放器在WINDWOWS,和WINCE下编译通过的源程序.笔者对其中的LIBMAD库做了针对ARM MPU的优化. 并增加了词幕功能.
💻 H
📖 第 1 页 / 共 3 页
字号:
/* libOggFLAC - Free Lossless Audio Codec + Ogg library
 * Copyright (C) 2002,2003,2004,2005  Josh Coalson
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * - Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *
 * - Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 *
 * - Neither the name of the Xiph.org Foundation nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef OggFLAC__SEEKABLE_STREAM_DECODER_H
#define OggFLAC__SEEKABLE_STREAM_DECODER_H

#include "export.h"
#include "stream_decoder.h"

#ifdef __cplusplus
extern "C" {
#endif


/** \file include/OggFLAC/seekable_stream_decoder.h
 *
 *  \brief
 *  This module contains the functions which implement the seekable stream
 *  decoder.
 *
 *  See the detailed documentation in the
 *  \link oggflac_seekable_stream_decoder seekable stream decoder \endlink module.
 */

/** \defgroup oggflac_seekable_stream_decoder OggFLAC/seekable_stream_decoder.h: seekable stream decoder interface
 *  \ingroup oggflac_decoder
 *
 *  \brief
 *  This module contains the functions which implement the seekable stream
 *  decoder.
 *
 * The interface here is nearly identical to FLAC's seekable stream decoder,
 * including the callbacks, with the addition of
 * OggFLAC__seekable_stream_decoder_set_serial_number().  See the
 * \link flac_seekable_stream_decoder FLAC seekable stream decoder module \endlink
 * for full documentation.
 *
 * \{
 */


/** State values for an OggFLAC__SeekableStreamDecoder
 *
 *  The decoder's state can be obtained by calling OggFLAC__seekable_stream_decoder_get_state().
 */
typedef enum {

	OggFLAC__SEEKABLE_STREAM_DECODER_OK = 0,
	/**< The decoder is in the normal OK state. */

	OggFLAC__SEEKABLE_STREAM_DECODER_SEEKING,
	/**< The decoder is in the process of seeking. */

	OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM,
	/**< The decoder has reached the end of the stream. */

	OggFLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR,
	/**< Memory allocation failed. */

	OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR,
	/**< An error occurred in the underlying stream decoder;
	 * check OggFLAC__seekable_stream_decoder_get_stream_decoder_state().
	 */

	OggFLAC__SEEKABLE_STREAM_DECODER_READ_ERROR,
	/**< The read callback returned an error. */

	OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR,
	/**< An error occurred while seeking or the seek or tell
	 * callback returned an error.
	 */

	OggFLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED,
	/**< OggFLAC__seekable_stream_decoder_init() was called when the decoder was
	 * already initialized, usually because
	 * OggFLAC__seekable_stream_decoder_finish() was not called.
	 */

	OggFLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK,
	/**< The decoder was initialized before setting all the required callbacks. */

	OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED
	/**< The decoder is in the uninitialized state. */

} OggFLAC__SeekableStreamDecoderState;

/** Maps an OggFLAC__SeekableStreamDecoderState to a C string.
 *
 *  Using an OggFLAC__SeekableStreamDecoderState as the index to this array
 *  will give the string equivalent.  The contents should not be modified.
 */
extern OggFLAC_API const char * const OggFLAC__SeekableStreamDecoderStateString[];


/** Return values for the OggFLAC__SeekableStreamDecoder read callback.
 */
typedef enum {

	OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK,
	/**< The read was OK and decoding can continue. */

	OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR
	/**< An unrecoverable error occurred.  The decoder will return from the process call. */

} OggFLAC__SeekableStreamDecoderReadStatus;

/** Maps a OggFLAC__SeekableStreamDecoderReadStatus to a C string.
 *
 *  Using a OggFLAC__SeekableStreamDecoderReadStatus as the index to this array
 *  will give the string equivalent.  The contents should not be modified.
 */
extern OggFLAC_API const char * const OggFLAC__SeekableStreamDecoderReadStatusString[];


/** Return values for the OggFLAC__SeekableStreamDecoder seek callback.
 */
typedef enum {

	OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK,
	/**< The seek was OK and decoding can continue. */

	OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR
	/**< An unrecoverable error occurred.  The decoder will return from the process call. */

} OggFLAC__SeekableStreamDecoderSeekStatus;

/** Maps a OggFLAC__SeekableStreamDecoderSeekStatus to a C string.
 *
 *  Using a OggFLAC__SeekableStreamDecoderSeekStatus as the index to this array
 *  will give the string equivalent.  The contents should not be modified.
 */
extern OggFLAC_API const char * const OggFLAC__SeekableStreamDecoderSeekStatusString[];


/** Return values for the OggFLAC__SeekableStreamDecoder tell callback.
 */
typedef enum {

	OggFLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK,
	/**< The tell was OK and decoding can continue. */

	OggFLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR
	/**< An unrecoverable error occurred.  The decoder will return from the process call. */

} OggFLAC__SeekableStreamDecoderTellStatus;

/** Maps a OggFLAC__SeekableStreamDecoderTellStatus to a C string.
 *
 *  Using a OggFLAC__SeekableStreamDecoderTellStatus as the index to this array
 *  will give the string equivalent.  The contents should not be modified.
 */
extern OggFLAC_API const char * const OggFLAC__SeekableStreamDecoderTellStatusString[];


/** Return values for the OggFLAC__SeekableStreamDecoder length callback.
 */
typedef enum {

	OggFLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK,
	/**< The length call was OK and decoding can continue. */

	OggFLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR
	/**< An unrecoverable error occurred.  The decoder will return from the process call. */

} OggFLAC__SeekableStreamDecoderLengthStatus;

/** Maps a OggFLAC__SeekableStreamDecoderLengthStatus to a C string.
 *
 *  Using a OggFLAC__SeekableStreamDecoderLengthStatus as the index to this array
 *  will give the string equivalent.  The contents should not be modified.
 */
extern OggFLAC_API const char * const OggFLAC__SeekableStreamDecoderLengthStatusString[];


/***********************************************************************
 *
 * class OggFLAC__SeekableStreamDecoder : public FLAC__StreamDecoder
 *
 ***********************************************************************/

struct OggFLAC__SeekableStreamDecoderProtected;
struct OggFLAC__SeekableStreamDecoderPrivate;
/** The opaque structure definition for the seekable stream decoder type.
 *  See the
 *  \link oggflac_seekable_stream_decoder seekable stream decoder module \endlink
 *  for a detailed description.
 */
typedef struct {
	struct OggFLAC__SeekableStreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */
	struct OggFLAC__SeekableStreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */
} OggFLAC__SeekableStreamDecoder;

/** Signature for the read callback.
 *  See OggFLAC__seekable_stream_decoder_set_read_callback()
 *  and OggFLAC__StreamDecoderReadCallback for more info.
 *
 * \param  decoder  The decoder instance calling the callback.
 * \param  buffer   A pointer to a location for the callee to store
 *                  data to be decoded.
 * \param  bytes    A pointer to the size of the buffer.
 * \param  client_data  The callee's client data set through
 *                      OggFLAC__seekable_stream_decoder_set_client_data().
 * \retval FLAC__SeekableStreamDecoderReadStatus
 *    The callee's return status.
 */
typedef OggFLAC__SeekableStreamDecoderReadStatus (*OggFLAC__SeekableStreamDecoderReadCallback)(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);

/** Signature for the seek callback.
 *  See OggFLAC__seekable_stream_decoder_set_seek_callback() for more info.
 *
 * \param  decoder  The decoder instance calling the callback.
 * \param  absolute_byte_offset  The offset from the beginning of the stream
 *                               to seek to.
 * \param  client_data  The callee's client data set through
 *                      OggFLAC__seekable_stream_decoder_set_client_data().
 * \retval FLAC__SeekableStreamDecoderSeekStatus
 *    The callee's return status.
 */
typedef OggFLAC__SeekableStreamDecoderSeekStatus (*OggFLAC__SeekableStreamDecoderSeekCallback)(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data);

/** Signature for the tell callback.
 *  See OggFLAC__seekable_stream_decoder_set_tell_callback() for more info.
 *
 * \param  decoder  The decoder instance calling the callback.
 * \param  absolute_byte_offset  A pointer to storage for the current offset
 *                               from the beginning of the stream.
 * \param  client_data  The callee's client data set through
 *                      OggFLAC__seekable_stream_decoder_set_client_data().
 * \retval FLAC__SeekableStreamDecoderTellStatus
 *    The callee's return status.
 */
typedef OggFLAC__SeekableStreamDecoderTellStatus (*OggFLAC__SeekableStreamDecoderTellCallback)(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data);

/** Signature for the length callback.
 *  See OggFLAC__seekable_stream_decoder_set_length_callback() for more info.
 *
 * \param  decoder  The decoder instance calling the callback.
 * \param  stream_length  A pointer to storage for the length of the stream
 *                        in bytes.
 * \param  client_data  The callee's client data set through
 *                      OggFLAC__seekable_stream_decoder_set_client_data().
 * \retval FLAC__SeekableStreamDecoderLengthStatus
 *    The callee's return status.
 */
typedef OggFLAC__SeekableStreamDecoderLengthStatus (*OggFLAC__SeekableStreamDecoderLengthCallback)(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data);

/** Signature for the EOF callback.
 *  See OggFLAC__seekable_stream_decoder_set_eof_callback() for more info.
 *
 * \param  decoder  The decoder instance calling the callback.
 * \param  client_data  The callee's client data set through
 *                      OggFLAC__seekable_stream_decoder_set_client_data().
 * \retval FLAC__bool
 *    \c true if the currently at the end of the stream, else \c false.
 */
typedef FLAC__bool (*OggFLAC__SeekableStreamDecoderEofCallback)(const OggFLAC__SeekableStreamDecoder *decoder, void *client_data);

/** Signature for the write callback.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -