1c74663799493f2b1e6123c18def94295d0afab7Kenny Root/* libFLAC - Free Lossless Audio Codec
231e4f3166a91a2ebb34f643787122a638d9f1471Robert Shih * Copyright (C) 2002-2009  Josh Coalson
3ae0e7bcc925f0624f6e34976984b40181c965fd9Elliott Hughes * Copyright (C) 2011-2016  Xiph.Org Foundation
4c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
5c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Redistribution and use in source and binary forms, with or without
6c74663799493f2b1e6123c18def94295d0afab7Kenny Root * modification, are permitted provided that the following conditions
7c74663799493f2b1e6123c18def94295d0afab7Kenny Root * are met:
8c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
9c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - Redistributions of source code must retain the above copyright
10c74663799493f2b1e6123c18def94295d0afab7Kenny Root * notice, this list of conditions and the following disclaimer.
11c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
12c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - Redistributions in binary form must reproduce the above copyright
13c74663799493f2b1e6123c18def94295d0afab7Kenny Root * notice, this list of conditions and the following disclaimer in the
14c74663799493f2b1e6123c18def94295d0afab7Kenny Root * documentation and/or other materials provided with the distribution.
15c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
16c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - Neither the name of the Xiph.org Foundation nor the names of its
17c74663799493f2b1e6123c18def94295d0afab7Kenny Root * contributors may be used to endorse or promote products derived from
18c74663799493f2b1e6123c18def94295d0afab7Kenny Root * this software without specific prior written permission.
19c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
20c74663799493f2b1e6123c18def94295d0afab7Kenny Root * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21c74663799493f2b1e6123c18def94295d0afab7Kenny Root * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22c74663799493f2b1e6123c18def94295d0afab7Kenny Root * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23c74663799493f2b1e6123c18def94295d0afab7Kenny Root * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
24c74663799493f2b1e6123c18def94295d0afab7Kenny Root * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25c74663799493f2b1e6123c18def94295d0afab7Kenny Root * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26c74663799493f2b1e6123c18def94295d0afab7Kenny Root * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27c74663799493f2b1e6123c18def94295d0afab7Kenny Root * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28c74663799493f2b1e6123c18def94295d0afab7Kenny Root * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29c74663799493f2b1e6123c18def94295d0afab7Kenny Root * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30c74663799493f2b1e6123c18def94295d0afab7Kenny Root * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
32c74663799493f2b1e6123c18def94295d0afab7Kenny Root
33c74663799493f2b1e6123c18def94295d0afab7Kenny Root#ifndef FLAC__PRIVATE__OGG_DECODER_ASPECT_H
34c74663799493f2b1e6123c18def94295d0afab7Kenny Root#define FLAC__PRIVATE__OGG_DECODER_ASPECT_H
35c74663799493f2b1e6123c18def94295d0afab7Kenny Root
36c74663799493f2b1e6123c18def94295d0afab7Kenny Root#include <ogg/ogg.h>
37c74663799493f2b1e6123c18def94295d0afab7Kenny Root
38c74663799493f2b1e6123c18def94295d0afab7Kenny Root#include "FLAC/ordinals.h"
39c74663799493f2b1e6123c18def94295d0afab7Kenny Root#include "FLAC/stream_decoder.h" /* for FLAC__StreamDecoderReadStatus */
40c74663799493f2b1e6123c18def94295d0afab7Kenny Root
41c74663799493f2b1e6123c18def94295d0afab7Kenny Roottypedef struct FLAC__OggDecoderAspect {
42c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/* these are storage for values that can be set through the API */
43c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__bool use_first_serial_number;
44c74663799493f2b1e6123c18def94295d0afab7Kenny Root	long serial_number;
45c74663799493f2b1e6123c18def94295d0afab7Kenny Root
46c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/* these are for internal state related to Ogg decoding */
47c74663799493f2b1e6123c18def94295d0afab7Kenny Root	ogg_stream_state stream_state;
48c74663799493f2b1e6123c18def94295d0afab7Kenny Root	ogg_sync_state sync_state;
49c74663799493f2b1e6123c18def94295d0afab7Kenny Root	unsigned version_major, version_minor;
50c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__bool need_serial_number;
51c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__bool end_of_stream;
52c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__bool have_working_page; /* only if true will the following vars be valid */
53c74663799493f2b1e6123c18def94295d0afab7Kenny Root	ogg_page working_page;
54c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__bool have_working_packet; /* only if true will the following vars be valid */
55c74663799493f2b1e6123c18def94295d0afab7Kenny Root	ogg_packet working_packet; /* as we work through the packet we will move working_packet.packet forward and working_packet.bytes down */
56c74663799493f2b1e6123c18def94295d0afab7Kenny Root} FLAC__OggDecoderAspect;
57c74663799493f2b1e6123c18def94295d0afab7Kenny Root
58c74663799493f2b1e6123c18def94295d0afab7Kenny Rootvoid FLAC__ogg_decoder_aspect_set_serial_number(FLAC__OggDecoderAspect *aspect, long value);
59c74663799493f2b1e6123c18def94295d0afab7Kenny Rootvoid FLAC__ogg_decoder_aspect_set_defaults(FLAC__OggDecoderAspect *aspect);
60c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC__bool FLAC__ogg_decoder_aspect_init(FLAC__OggDecoderAspect *aspect);
61c74663799493f2b1e6123c18def94295d0afab7Kenny Rootvoid FLAC__ogg_decoder_aspect_finish(FLAC__OggDecoderAspect *aspect);
62c74663799493f2b1e6123c18def94295d0afab7Kenny Rootvoid FLAC__ogg_decoder_aspect_flush(FLAC__OggDecoderAspect *aspect);
63c74663799493f2b1e6123c18def94295d0afab7Kenny Rootvoid FLAC__ogg_decoder_aspect_reset(FLAC__OggDecoderAspect *aspect);
64c74663799493f2b1e6123c18def94295d0afab7Kenny Root
65c74663799493f2b1e6123c18def94295d0afab7Kenny Roottypedef enum {
66c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK = 0,
67c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM,
68c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC,
69c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC,
70c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION,
71c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT,
72c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__OGG_DECODER_ASPECT_READ_STATUS_ERROR,
73c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__OGG_DECODER_ASPECT_READ_STATUS_MEMORY_ALLOCATION_ERROR
74c74663799493f2b1e6123c18def94295d0afab7Kenny Root} FLAC__OggDecoderAspectReadStatus;
75c74663799493f2b1e6123c18def94295d0afab7Kenny Root
76c74663799493f2b1e6123c18def94295d0afab7Kenny Roottypedef FLAC__OggDecoderAspectReadStatus (*FLAC__OggDecoderAspectReadCallbackProxy)(const void *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
77c74663799493f2b1e6123c18def94295d0afab7Kenny Root
78c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC__OggDecoderAspectReadStatus FLAC__ogg_decoder_aspect_read_callback_wrapper(FLAC__OggDecoderAspect *aspect, FLAC__byte buffer[], size_t *bytes, FLAC__OggDecoderAspectReadCallbackProxy read_callback, const FLAC__StreamDecoder *decoder, void *client_data);
79c74663799493f2b1e6123c18def94295d0afab7Kenny Root
80c74663799493f2b1e6123c18def94295d0afab7Kenny Root#endif
81