Lines Matching refs:aspect
52 FLAC__bool FLAC__ogg_decoder_aspect_init(FLAC__OggDecoderAspect *aspect)
55 if(ogg_stream_init(&aspect->stream_state, aspect->serial_number) != 0)
58 if(ogg_sync_init(&aspect->sync_state) != 0)
61 aspect->version_major = ~(0u);
62 aspect->version_minor = ~(0u);
64 aspect->need_serial_number = aspect->use_first_serial_number;
66 aspect->end_of_stream = false;
67 aspect->have_working_page = false;
72 void FLAC__ogg_decoder_aspect_finish(FLAC__OggDecoderAspect *aspect)
74 (void)ogg_sync_clear(&aspect->sync_state);
75 (void)ogg_stream_clear(&aspect->stream_state);
78 void FLAC__ogg_decoder_aspect_set_serial_number(FLAC__OggDecoderAspect *aspect, long value)
80 aspect->use_first_serial_number = false;
81 aspect->serial_number = value;
84 void FLAC__ogg_decoder_aspect_set_defaults(FLAC__OggDecoderAspect *aspect)
86 aspect->use_first_serial_number = true;
89 void FLAC__ogg_decoder_aspect_flush(FLAC__OggDecoderAspect *aspect)
91 (void)ogg_stream_reset(&aspect->stream_state);
92 (void)ogg_sync_reset(&aspect->sync_state);
93 aspect->end_of_stream = false;
94 aspect->have_working_page = false;
97 void FLAC__ogg_decoder_aspect_reset(FLAC__OggDecoderAspect *aspect)
99 FLAC__ogg_decoder_aspect_flush(aspect);
101 if(aspect->use_first_serial_number)
102 aspect->need_serial_number = true;
105 FLAC__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)
137 while (*bytes < bytes_requested && !aspect->end_of_stream) {
138 if (aspect->have_working_page) {
139 if (aspect->have_working_packet) {
141 if ((size_t)aspect->working_packet.bytes <= n) {
143 n = aspect->working_packet.bytes;
144 memcpy(buffer, aspect->working_packet.packet, n);
147 aspect->have_working_packet = false;
151 memcpy(buffer, aspect->working_packet.packet, n);
154 aspect->working_packet.packet += n;
155 aspect->working_packet.bytes -= n;
160 const int ret = ogg_stream_packetout(&aspect->stream_state, &aspect->working_packet);
162 aspect->have_working_packet = true;
164 if (aspect->working_packet.bytes > 0 && aspect->working_packet.packet[0] == FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE) {
165 const FLAC__byte *b = aspect->working_packet.packet;
172 if (aspect->working_packet.bytes < (long)header_length)
178 aspect->version_major = (unsigned)(*b);
180 aspect->version_minor = (unsigned)(*b);
181 if (aspect->version_major != 1)
183 aspect->working_packet.packet += header_length;
184 aspect->working_packet.bytes -= header_length;
188 aspect->have_working_page = false;
198 const int ret = ogg_sync_pageout(&aspect->sync_state, &aspect->working_page);
201 if(aspect->need_serial_number) {
202 aspect->stream_state.serialno = aspect->serial_number = ogg_page_serialno(&aspect->working_page);
203 aspect->need_serial_number = false;
205 if(ogg_stream_pagein(&aspect->stream_state, &aspect->working_page) == 0) {
206 aspect->have_working_page = true;
207 aspect->have_working_packet = false;
214 char *oggbuf = ogg_sync_buffer(&aspect->sync_state, ogg_bytes_to_read);
226 aspect->end_of_stream = true;
234 if(ogg_sync_wrote(&aspect->sync_state, ogg_bytes_read) < 0) {
248 if (aspect->end_of_stream && *bytes == 0) {